1
0
mirror of https://github.com/libretro/RetroArch synced 2024-06-28 22:44:21 +00:00

Revert "Slim down glslang"

This reverts commit e53a809e6d.
This commit is contained in:
libretroadmin 2024-06-15 06:22:57 +02:00
parent a15317907d
commit 7d1d8be14e
1642 changed files with 338900 additions and 0 deletions

View File

@ -27,6 +27,8 @@ option(ENABLE_GLSLANG_BINARIES "Builds glslangValidator and spirv-remap" ON)
option(ENABLE_NV_EXTENSIONS "Enables support of Nvidia-specific extensions" ON)
option(ENABLE_HLSL "Enables HLSL input support" ON)
option(ENABLE_OPT "Enables spirv-opt capability if present" ON)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND WIN32)
@ -45,6 +47,10 @@ if(ENABLE_NV_EXTENSIONS)
add_definitions(-DNV_EXTENSIONS)
endif(ENABLE_NV_EXTENSIONS)
if(ENABLE_HLSL)
add_definitions(-DENABLE_HLSL)
endif(ENABLE_HLSL)
if(WIN32)
set(CMAKE_DEBUG_POSTFIX "d")
if(MSVC)
@ -98,9 +104,19 @@ if(ENABLE_OPT)
message(STATUS "optimizer enabled")
add_definitions(-DENABLE_OPT=1)
else()
if(ENABLE_HLSL)
message(STATUS "spirv-tools not linked - illegal SPIRV may be generated for HLSL")
endif()
add_definitions(-DENABLE_OPT=0)
endif()
add_subdirectory(glslang)
add_subdirectory(OGLCompilersDLL)
if(ENABLE_GLSLANG_BINARIES)
add_subdirectory(StandAlone)
endif()
add_subdirectory(SPIRV)
if(ENABLE_HLSL)
add_subdirectory(hlsl)
endif(ENABLE_HLSL)
add_subdirectory(gtests)

View File

@ -0,0 +1,52 @@
add_library(glslang-default-resource-limits
${CMAKE_CURRENT_SOURCE_DIR}/ResourceLimits.cpp)
set_property(TARGET glslang-default-resource-limits PROPERTY FOLDER glslang)
set_property(TARGET glslang-default-resource-limits PROPERTY POSITION_INDEPENDENT_CODE ON)
target_include_directories(glslang-default-resource-limits
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC ${PROJECT_SOURCE_DIR})
set(SOURCES StandAlone.cpp DirStackFileIncluder.h)
set(REMAPPER_SOURCES spirv-remap.cpp)
add_executable(glslangValidator ${SOURCES})
add_executable(spirv-remap ${REMAPPER_SOURCES})
set_property(TARGET glslangValidator PROPERTY FOLDER tools)
set_property(TARGET spirv-remap PROPERTY FOLDER tools)
glslang_set_link_args(glslangValidator)
glslang_set_link_args(spirv-remap)
set(LIBRARIES
glslang
SPIRV
SPVRemapper
glslang-default-resource-limits)
if(WIN32)
set(LIBRARIES ${LIBRARIES} psapi)
elseif(UNIX)
if(NOT ANDROID)
set(LIBRARIES ${LIBRARIES} pthread)
endif()
endif(WIN32)
target_link_libraries(glslangValidator ${LIBRARIES})
target_link_libraries(spirv-remap ${LIBRARIES})
if(WIN32)
source_group("Source" FILES ${SOURCES})
endif(WIN32)
if(ENABLE_GLSLANG_INSTALL)
install(TARGETS glslangValidator
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS spirv-remap
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
if(BUILD_SHARED_LIBS)
install(TARGETS glslang-default-resource-limits
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
endif(ENABLE_GLSLANG_INSTALL)

View File

@ -0,0 +1,141 @@
//
// Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
// Copyright (C) 2017 Google, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
//
// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
#pragma once
#include <vector>
#include <string>
#include <fstream>
#include <algorithm>
#include "./../glslang/Public/ShaderLang.h"
// Default include class for normal include convention of search backward
// through the stack of active include paths (for nested includes).
// Can be overridden to customize.
class DirStackFileIncluder : public glslang::TShader::Includer {
public:
DirStackFileIncluder() : externalLocalDirectoryCount(0) { }
virtual IncludeResult* includeLocal(const char* headerName,
const char* includerName,
size_t inclusionDepth) override
{
return readLocalPath(headerName, includerName, (int)inclusionDepth);
}
virtual IncludeResult* includeSystem(const char* headerName,
const char* /*includerName*/,
size_t /*inclusionDepth*/) override
{
return readSystemPath(headerName);
}
// Externally set directories. E.g., from a command-line -I<dir>.
// - Most-recently pushed are checked first.
// - All these are checked after the parse-time stack of local directories
// is checked.
// - This only applies to the "local" form of #include.
// - Makes its own copy of the path.
virtual void pushExternalLocalDirectory(const std::string& dir)
{
directoryStack.push_back(dir);
externalLocalDirectoryCount = (int)directoryStack.size();
}
virtual void releaseInclude(IncludeResult* result) override
{
if (result != nullptr) {
delete [] static_cast<tUserDataElement*>(result->userData);
delete result;
}
}
virtual ~DirStackFileIncluder() override { }
protected:
typedef char tUserDataElement;
std::vector<std::string> directoryStack;
int externalLocalDirectoryCount;
// Search for a valid "local" path based on combining the stack of include
// directories and the nominal name of the header.
virtual IncludeResult* readLocalPath(const char* headerName, const char* includerName, int depth)
{
// Discard popped include directories, and
// initialize when at parse-time first level.
directoryStack.resize(depth + externalLocalDirectoryCount);
if (depth == 1)
directoryStack.back() = getDirectory(includerName);
// Find a directory that works, using a reverse search of the include stack.
for (auto it = directoryStack.rbegin(); it != directoryStack.rend(); ++it) {
std::string path = *it + '/' + headerName;
std::replace(path.begin(), path.end(), '\\', '/');
std::ifstream file(path, std::ios_base::binary | std::ios_base::ate);
if (file) {
directoryStack.push_back(getDirectory(path));
return newIncludeResult(path, file, (int)file.tellg());
}
}
return nullptr;
}
// Search for a valid <system> path.
// Not implemented yet; returning nullptr signals failure to find.
virtual IncludeResult* readSystemPath(const char* /*headerName*/) const
{
return nullptr;
}
// Do actual reading of the file, filling in a new include result.
virtual IncludeResult* newIncludeResult(const std::string& path, std::ifstream& file, int length) const
{
char* content = new tUserDataElement [length];
file.seekg(0, file.beg);
file.read(content, length);
return new IncludeResult(path, content, length, content);
}
// If no path markers, return current working directory.
// Otherwise, strip file name and return path leading up to it.
virtual std::string getDirectory(const std::string path) const
{
size_t last = path.find_last_of("/\\");
return last == std::string::npos ? "." : path.substr(0, last);
}
};

View File

@ -0,0 +1,458 @@
//
// Copyright (C) 2016 Google, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
//
// Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <cctype>
#include "ResourceLimits.h"
namespace glslang {
const TBuiltInResource DefaultTBuiltInResource = {
/* .MaxLights = */ 32,
/* .MaxClipPlanes = */ 6,
/* .MaxTextureUnits = */ 32,
/* .MaxTextureCoords = */ 32,
/* .MaxVertexAttribs = */ 64,
/* .MaxVertexUniformComponents = */ 4096,
/* .MaxVaryingFloats = */ 64,
/* .MaxVertexTextureImageUnits = */ 32,
/* .MaxCombinedTextureImageUnits = */ 80,
/* .MaxTextureImageUnits = */ 32,
/* .MaxFragmentUniformComponents = */ 4096,
/* .MaxDrawBuffers = */ 32,
/* .MaxVertexUniformVectors = */ 128,
/* .MaxVaryingVectors = */ 8,
/* .MaxFragmentUniformVectors = */ 16,
/* .MaxVertexOutputVectors = */ 16,
/* .MaxFragmentInputVectors = */ 15,
/* .MinProgramTexelOffset = */ -8,
/* .MaxProgramTexelOffset = */ 7,
/* .MaxClipDistances = */ 8,
/* .MaxComputeWorkGroupCountX = */ 65535,
/* .MaxComputeWorkGroupCountY = */ 65535,
/* .MaxComputeWorkGroupCountZ = */ 65535,
/* .MaxComputeWorkGroupSizeX = */ 1024,
/* .MaxComputeWorkGroupSizeY = */ 1024,
/* .MaxComputeWorkGroupSizeZ = */ 64,
/* .MaxComputeUniformComponents = */ 1024,
/* .MaxComputeTextureImageUnits = */ 16,
/* .MaxComputeImageUniforms = */ 8,
/* .MaxComputeAtomicCounters = */ 8,
/* .MaxComputeAtomicCounterBuffers = */ 1,
/* .MaxVaryingComponents = */ 60,
/* .MaxVertexOutputComponents = */ 64,
/* .MaxGeometryInputComponents = */ 64,
/* .MaxGeometryOutputComponents = */ 128,
/* .MaxFragmentInputComponents = */ 128,
/* .MaxImageUnits = */ 8,
/* .MaxCombinedImageUnitsAndFragmentOutputs = */ 8,
/* .MaxCombinedShaderOutputResources = */ 8,
/* .MaxImageSamples = */ 0,
/* .MaxVertexImageUniforms = */ 0,
/* .MaxTessControlImageUniforms = */ 0,
/* .MaxTessEvaluationImageUniforms = */ 0,
/* .MaxGeometryImageUniforms = */ 0,
/* .MaxFragmentImageUniforms = */ 8,
/* .MaxCombinedImageUniforms = */ 8,
/* .MaxGeometryTextureImageUnits = */ 16,
/* .MaxGeometryOutputVertices = */ 256,
/* .MaxGeometryTotalOutputComponents = */ 1024,
/* .MaxGeometryUniformComponents = */ 1024,
/* .MaxGeometryVaryingComponents = */ 64,
/* .MaxTessControlInputComponents = */ 128,
/* .MaxTessControlOutputComponents = */ 128,
/* .MaxTessControlTextureImageUnits = */ 16,
/* .MaxTessControlUniformComponents = */ 1024,
/* .MaxTessControlTotalOutputComponents = */ 4096,
/* .MaxTessEvaluationInputComponents = */ 128,
/* .MaxTessEvaluationOutputComponents = */ 128,
/* .MaxTessEvaluationTextureImageUnits = */ 16,
/* .MaxTessEvaluationUniformComponents = */ 1024,
/* .MaxTessPatchComponents = */ 120,
/* .MaxPatchVertices = */ 32,
/* .MaxTessGenLevel = */ 64,
/* .MaxViewports = */ 16,
/* .MaxVertexAtomicCounters = */ 0,
/* .MaxTessControlAtomicCounters = */ 0,
/* .MaxTessEvaluationAtomicCounters = */ 0,
/* .MaxGeometryAtomicCounters = */ 0,
/* .MaxFragmentAtomicCounters = */ 8,
/* .MaxCombinedAtomicCounters = */ 8,
/* .MaxAtomicCounterBindings = */ 1,
/* .MaxVertexAtomicCounterBuffers = */ 0,
/* .MaxTessControlAtomicCounterBuffers = */ 0,
/* .MaxTessEvaluationAtomicCounterBuffers = */ 0,
/* .MaxGeometryAtomicCounterBuffers = */ 0,
/* .MaxFragmentAtomicCounterBuffers = */ 1,
/* .MaxCombinedAtomicCounterBuffers = */ 1,
/* .MaxAtomicCounterBufferSize = */ 16384,
/* .MaxTransformFeedbackBuffers = */ 4,
/* .MaxTransformFeedbackInterleavedComponents = */ 64,
/* .MaxCullDistances = */ 8,
/* .MaxCombinedClipAndCullDistances = */ 8,
/* .MaxSamples = */ 4,
/* .limits = */ {
/* .nonInductiveForLoops = */ 1,
/* .whileLoops = */ 1,
/* .doWhileLoops = */ 1,
/* .generalUniformIndexing = */ 1,
/* .generalAttributeMatrixVectorIndexing = */ 1,
/* .generalVaryingIndexing = */ 1,
/* .generalSamplerIndexing = */ 1,
/* .generalVariableIndexing = */ 1,
/* .generalConstantMatrixVectorIndexing = */ 1,
}};
std::string GetDefaultTBuiltInResourceString()
{
std::ostringstream ostream;
ostream << "MaxLights " << DefaultTBuiltInResource.maxLights << "\n"
<< "MaxClipPlanes " << DefaultTBuiltInResource.maxClipPlanes << "\n"
<< "MaxTextureUnits " << DefaultTBuiltInResource.maxTextureUnits << "\n"
<< "MaxTextureCoords " << DefaultTBuiltInResource.maxTextureCoords << "\n"
<< "MaxVertexAttribs " << DefaultTBuiltInResource.maxVertexAttribs << "\n"
<< "MaxVertexUniformComponents " << DefaultTBuiltInResource.maxVertexUniformComponents << "\n"
<< "MaxVaryingFloats " << DefaultTBuiltInResource.maxVaryingFloats << "\n"
<< "MaxVertexTextureImageUnits " << DefaultTBuiltInResource.maxVertexTextureImageUnits << "\n"
<< "MaxCombinedTextureImageUnits " << DefaultTBuiltInResource.maxCombinedTextureImageUnits << "\n"
<< "MaxTextureImageUnits " << DefaultTBuiltInResource.maxTextureImageUnits << "\n"
<< "MaxFragmentUniformComponents " << DefaultTBuiltInResource.maxFragmentUniformComponents << "\n"
<< "MaxDrawBuffers " << DefaultTBuiltInResource.maxDrawBuffers << "\n"
<< "MaxVertexUniformVectors " << DefaultTBuiltInResource.maxVertexUniformVectors << "\n"
<< "MaxVaryingVectors " << DefaultTBuiltInResource.maxVaryingVectors << "\n"
<< "MaxFragmentUniformVectors " << DefaultTBuiltInResource.maxFragmentUniformVectors << "\n"
<< "MaxVertexOutputVectors " << DefaultTBuiltInResource.maxVertexOutputVectors << "\n"
<< "MaxFragmentInputVectors " << DefaultTBuiltInResource.maxFragmentInputVectors << "\n"
<< "MinProgramTexelOffset " << DefaultTBuiltInResource.minProgramTexelOffset << "\n"
<< "MaxProgramTexelOffset " << DefaultTBuiltInResource.maxProgramTexelOffset << "\n"
<< "MaxClipDistances " << DefaultTBuiltInResource.maxClipDistances << "\n"
<< "MaxComputeWorkGroupCountX " << DefaultTBuiltInResource.maxComputeWorkGroupCountX << "\n"
<< "MaxComputeWorkGroupCountY " << DefaultTBuiltInResource.maxComputeWorkGroupCountY << "\n"
<< "MaxComputeWorkGroupCountZ " << DefaultTBuiltInResource.maxComputeWorkGroupCountZ << "\n"
<< "MaxComputeWorkGroupSizeX " << DefaultTBuiltInResource.maxComputeWorkGroupSizeX << "\n"
<< "MaxComputeWorkGroupSizeY " << DefaultTBuiltInResource.maxComputeWorkGroupSizeY << "\n"
<< "MaxComputeWorkGroupSizeZ " << DefaultTBuiltInResource.maxComputeWorkGroupSizeZ << "\n"
<< "MaxComputeUniformComponents " << DefaultTBuiltInResource.maxComputeUniformComponents << "\n"
<< "MaxComputeTextureImageUnits " << DefaultTBuiltInResource.maxComputeTextureImageUnits << "\n"
<< "MaxComputeImageUniforms " << DefaultTBuiltInResource.maxComputeImageUniforms << "\n"
<< "MaxComputeAtomicCounters " << DefaultTBuiltInResource.maxComputeAtomicCounters << "\n"
<< "MaxComputeAtomicCounterBuffers " << DefaultTBuiltInResource.maxComputeAtomicCounterBuffers << "\n"
<< "MaxVaryingComponents " << DefaultTBuiltInResource.maxVaryingComponents << "\n"
<< "MaxVertexOutputComponents " << DefaultTBuiltInResource.maxVertexOutputComponents << "\n"
<< "MaxGeometryInputComponents " << DefaultTBuiltInResource.maxGeometryInputComponents << "\n"
<< "MaxGeometryOutputComponents " << DefaultTBuiltInResource.maxGeometryOutputComponents << "\n"
<< "MaxFragmentInputComponents " << DefaultTBuiltInResource.maxFragmentInputComponents << "\n"
<< "MaxImageUnits " << DefaultTBuiltInResource.maxImageUnits << "\n"
<< "MaxCombinedImageUnitsAndFragmentOutputs " << DefaultTBuiltInResource.maxCombinedImageUnitsAndFragmentOutputs << "\n"
<< "MaxCombinedShaderOutputResources " << DefaultTBuiltInResource.maxCombinedShaderOutputResources << "\n"
<< "MaxImageSamples " << DefaultTBuiltInResource.maxImageSamples << "\n"
<< "MaxVertexImageUniforms " << DefaultTBuiltInResource.maxVertexImageUniforms << "\n"
<< "MaxTessControlImageUniforms " << DefaultTBuiltInResource.maxTessControlImageUniforms << "\n"
<< "MaxTessEvaluationImageUniforms " << DefaultTBuiltInResource.maxTessEvaluationImageUniforms << "\n"
<< "MaxGeometryImageUniforms " << DefaultTBuiltInResource.maxGeometryImageUniforms << "\n"
<< "MaxFragmentImageUniforms " << DefaultTBuiltInResource.maxFragmentImageUniforms << "\n"
<< "MaxCombinedImageUniforms " << DefaultTBuiltInResource.maxCombinedImageUniforms << "\n"
<< "MaxGeometryTextureImageUnits " << DefaultTBuiltInResource.maxGeometryTextureImageUnits << "\n"
<< "MaxGeometryOutputVertices " << DefaultTBuiltInResource.maxGeometryOutputVertices << "\n"
<< "MaxGeometryTotalOutputComponents " << DefaultTBuiltInResource.maxGeometryTotalOutputComponents << "\n"
<< "MaxGeometryUniformComponents " << DefaultTBuiltInResource.maxGeometryUniformComponents << "\n"
<< "MaxGeometryVaryingComponents " << DefaultTBuiltInResource.maxGeometryVaryingComponents << "\n"
<< "MaxTessControlInputComponents " << DefaultTBuiltInResource.maxTessControlInputComponents << "\n"
<< "MaxTessControlOutputComponents " << DefaultTBuiltInResource.maxTessControlOutputComponents << "\n"
<< "MaxTessControlTextureImageUnits " << DefaultTBuiltInResource.maxTessControlTextureImageUnits << "\n"
<< "MaxTessControlUniformComponents " << DefaultTBuiltInResource.maxTessControlUniformComponents << "\n"
<< "MaxTessControlTotalOutputComponents " << DefaultTBuiltInResource.maxTessControlTotalOutputComponents << "\n"
<< "MaxTessEvaluationInputComponents " << DefaultTBuiltInResource.maxTessEvaluationInputComponents << "\n"
<< "MaxTessEvaluationOutputComponents " << DefaultTBuiltInResource.maxTessEvaluationOutputComponents << "\n"
<< "MaxTessEvaluationTextureImageUnits " << DefaultTBuiltInResource.maxTessEvaluationTextureImageUnits << "\n"
<< "MaxTessEvaluationUniformComponents " << DefaultTBuiltInResource.maxTessEvaluationUniformComponents << "\n"
<< "MaxTessPatchComponents " << DefaultTBuiltInResource.maxTessPatchComponents << "\n"
<< "MaxPatchVertices " << DefaultTBuiltInResource.maxPatchVertices << "\n"
<< "MaxTessGenLevel " << DefaultTBuiltInResource.maxTessGenLevel << "\n"
<< "MaxViewports " << DefaultTBuiltInResource.maxViewports << "\n"
<< "MaxVertexAtomicCounters " << DefaultTBuiltInResource.maxVertexAtomicCounters << "\n"
<< "MaxTessControlAtomicCounters " << DefaultTBuiltInResource.maxTessControlAtomicCounters << "\n"
<< "MaxTessEvaluationAtomicCounters " << DefaultTBuiltInResource.maxTessEvaluationAtomicCounters << "\n"
<< "MaxGeometryAtomicCounters " << DefaultTBuiltInResource.maxGeometryAtomicCounters << "\n"
<< "MaxFragmentAtomicCounters " << DefaultTBuiltInResource.maxFragmentAtomicCounters << "\n"
<< "MaxCombinedAtomicCounters " << DefaultTBuiltInResource.maxCombinedAtomicCounters << "\n"
<< "MaxAtomicCounterBindings " << DefaultTBuiltInResource.maxAtomicCounterBindings << "\n"
<< "MaxVertexAtomicCounterBuffers " << DefaultTBuiltInResource.maxVertexAtomicCounterBuffers << "\n"
<< "MaxTessControlAtomicCounterBuffers " << DefaultTBuiltInResource.maxTessControlAtomicCounterBuffers << "\n"
<< "MaxTessEvaluationAtomicCounterBuffers " << DefaultTBuiltInResource.maxTessEvaluationAtomicCounterBuffers << "\n"
<< "MaxGeometryAtomicCounterBuffers " << DefaultTBuiltInResource.maxGeometryAtomicCounterBuffers << "\n"
<< "MaxFragmentAtomicCounterBuffers " << DefaultTBuiltInResource.maxFragmentAtomicCounterBuffers << "\n"
<< "MaxCombinedAtomicCounterBuffers " << DefaultTBuiltInResource.maxCombinedAtomicCounterBuffers << "\n"
<< "MaxAtomicCounterBufferSize " << DefaultTBuiltInResource.maxAtomicCounterBufferSize << "\n"
<< "MaxTransformFeedbackBuffers " << DefaultTBuiltInResource.maxTransformFeedbackBuffers << "\n"
<< "MaxTransformFeedbackInterleavedComponents " << DefaultTBuiltInResource.maxTransformFeedbackInterleavedComponents << "\n"
<< "MaxCullDistances " << DefaultTBuiltInResource.maxCullDistances << "\n"
<< "MaxCombinedClipAndCullDistances " << DefaultTBuiltInResource.maxCombinedClipAndCullDistances << "\n"
<< "MaxSamples " << DefaultTBuiltInResource.maxSamples << "\n"
<< "nonInductiveForLoops " << DefaultTBuiltInResource.limits.nonInductiveForLoops << "\n"
<< "whileLoops " << DefaultTBuiltInResource.limits.whileLoops << "\n"
<< "doWhileLoops " << DefaultTBuiltInResource.limits.doWhileLoops << "\n"
<< "generalUniformIndexing " << DefaultTBuiltInResource.limits.generalUniformIndexing << "\n"
<< "generalAttributeMatrixVectorIndexing " << DefaultTBuiltInResource.limits.generalAttributeMatrixVectorIndexing << "\n"
<< "generalVaryingIndexing " << DefaultTBuiltInResource.limits.generalVaryingIndexing << "\n"
<< "generalSamplerIndexing " << DefaultTBuiltInResource.limits.generalSamplerIndexing << "\n"
<< "generalVariableIndexing " << DefaultTBuiltInResource.limits.generalVariableIndexing << "\n"
<< "generalConstantMatrixVectorIndexing " << DefaultTBuiltInResource.limits.generalConstantMatrixVectorIndexing << "\n"
;
return ostream.str();
}
void DecodeResourceLimits(TBuiltInResource* resources, char* config)
{
static const char* delims = " \t\n\r";
size_t pos = 0;
std::string configStr(config);
while ((pos = configStr.find_first_not_of(delims, pos)) != std::string::npos) {
const size_t token_s = pos;
const size_t token_e = configStr.find_first_of(delims, token_s);
const size_t value_s = configStr.find_first_not_of(delims, token_e);
const size_t value_e = configStr.find_first_of(delims, value_s);
pos = value_e;
// Faster to use compare(), but prefering readability.
const std::string tokenStr = configStr.substr(token_s, token_e-token_s);
const std::string valueStr = configStr.substr(value_s, value_e-value_s);
if (value_s == std::string::npos || ! (valueStr[0] == '-' || isdigit(valueStr[0]))) {
printf("Error: '%s' bad .conf file. Each name must be followed by one number.\n",
valueStr.c_str());
return;
}
const int value = std::atoi(valueStr.c_str());
if (tokenStr == "MaxLights")
resources->maxLights = value;
else if (tokenStr == "MaxClipPlanes")
resources->maxClipPlanes = value;
else if (tokenStr == "MaxTextureUnits")
resources->maxTextureUnits = value;
else if (tokenStr == "MaxTextureCoords")
resources->maxTextureCoords = value;
else if (tokenStr == "MaxVertexAttribs")
resources->maxVertexAttribs = value;
else if (tokenStr == "MaxVertexUniformComponents")
resources->maxVertexUniformComponents = value;
else if (tokenStr == "MaxVaryingFloats")
resources->maxVaryingFloats = value;
else if (tokenStr == "MaxVertexTextureImageUnits")
resources->maxVertexTextureImageUnits = value;
else if (tokenStr == "MaxCombinedTextureImageUnits")
resources->maxCombinedTextureImageUnits = value;
else if (tokenStr == "MaxTextureImageUnits")
resources->maxTextureImageUnits = value;
else if (tokenStr == "MaxFragmentUniformComponents")
resources->maxFragmentUniformComponents = value;
else if (tokenStr == "MaxDrawBuffers")
resources->maxDrawBuffers = value;
else if (tokenStr == "MaxVertexUniformVectors")
resources->maxVertexUniformVectors = value;
else if (tokenStr == "MaxVaryingVectors")
resources->maxVaryingVectors = value;
else if (tokenStr == "MaxFragmentUniformVectors")
resources->maxFragmentUniformVectors = value;
else if (tokenStr == "MaxVertexOutputVectors")
resources->maxVertexOutputVectors = value;
else if (tokenStr == "MaxFragmentInputVectors")
resources->maxFragmentInputVectors = value;
else if (tokenStr == "MinProgramTexelOffset")
resources->minProgramTexelOffset = value;
else if (tokenStr == "MaxProgramTexelOffset")
resources->maxProgramTexelOffset = value;
else if (tokenStr == "MaxClipDistances")
resources->maxClipDistances = value;
else if (tokenStr == "MaxComputeWorkGroupCountX")
resources->maxComputeWorkGroupCountX = value;
else if (tokenStr == "MaxComputeWorkGroupCountY")
resources->maxComputeWorkGroupCountY = value;
else if (tokenStr == "MaxComputeWorkGroupCountZ")
resources->maxComputeWorkGroupCountZ = value;
else if (tokenStr == "MaxComputeWorkGroupSizeX")
resources->maxComputeWorkGroupSizeX = value;
else if (tokenStr == "MaxComputeWorkGroupSizeY")
resources->maxComputeWorkGroupSizeY = value;
else if (tokenStr == "MaxComputeWorkGroupSizeZ")
resources->maxComputeWorkGroupSizeZ = value;
else if (tokenStr == "MaxComputeUniformComponents")
resources->maxComputeUniformComponents = value;
else if (tokenStr == "MaxComputeTextureImageUnits")
resources->maxComputeTextureImageUnits = value;
else if (tokenStr == "MaxComputeImageUniforms")
resources->maxComputeImageUniforms = value;
else if (tokenStr == "MaxComputeAtomicCounters")
resources->maxComputeAtomicCounters = value;
else if (tokenStr == "MaxComputeAtomicCounterBuffers")
resources->maxComputeAtomicCounterBuffers = value;
else if (tokenStr == "MaxVaryingComponents")
resources->maxVaryingComponents = value;
else if (tokenStr == "MaxVertexOutputComponents")
resources->maxVertexOutputComponents = value;
else if (tokenStr == "MaxGeometryInputComponents")
resources->maxGeometryInputComponents = value;
else if (tokenStr == "MaxGeometryOutputComponents")
resources->maxGeometryOutputComponents = value;
else if (tokenStr == "MaxFragmentInputComponents")
resources->maxFragmentInputComponents = value;
else if (tokenStr == "MaxImageUnits")
resources->maxImageUnits = value;
else if (tokenStr == "MaxCombinedImageUnitsAndFragmentOutputs")
resources->maxCombinedImageUnitsAndFragmentOutputs = value;
else if (tokenStr == "MaxCombinedShaderOutputResources")
resources->maxCombinedShaderOutputResources = value;
else if (tokenStr == "MaxImageSamples")
resources->maxImageSamples = value;
else if (tokenStr == "MaxVertexImageUniforms")
resources->maxVertexImageUniforms = value;
else if (tokenStr == "MaxTessControlImageUniforms")
resources->maxTessControlImageUniforms = value;
else if (tokenStr == "MaxTessEvaluationImageUniforms")
resources->maxTessEvaluationImageUniforms = value;
else if (tokenStr == "MaxGeometryImageUniforms")
resources->maxGeometryImageUniforms = value;
else if (tokenStr == "MaxFragmentImageUniforms")
resources->maxFragmentImageUniforms = value;
else if (tokenStr == "MaxCombinedImageUniforms")
resources->maxCombinedImageUniforms = value;
else if (tokenStr == "MaxGeometryTextureImageUnits")
resources->maxGeometryTextureImageUnits = value;
else if (tokenStr == "MaxGeometryOutputVertices")
resources->maxGeometryOutputVertices = value;
else if (tokenStr == "MaxGeometryTotalOutputComponents")
resources->maxGeometryTotalOutputComponents = value;
else if (tokenStr == "MaxGeometryUniformComponents")
resources->maxGeometryUniformComponents = value;
else if (tokenStr == "MaxGeometryVaryingComponents")
resources->maxGeometryVaryingComponents = value;
else if (tokenStr == "MaxTessControlInputComponents")
resources->maxTessControlInputComponents = value;
else if (tokenStr == "MaxTessControlOutputComponents")
resources->maxTessControlOutputComponents = value;
else if (tokenStr == "MaxTessControlTextureImageUnits")
resources->maxTessControlTextureImageUnits = value;
else if (tokenStr == "MaxTessControlUniformComponents")
resources->maxTessControlUniformComponents = value;
else if (tokenStr == "MaxTessControlTotalOutputComponents")
resources->maxTessControlTotalOutputComponents = value;
else if (tokenStr == "MaxTessEvaluationInputComponents")
resources->maxTessEvaluationInputComponents = value;
else if (tokenStr == "MaxTessEvaluationOutputComponents")
resources->maxTessEvaluationOutputComponents = value;
else if (tokenStr == "MaxTessEvaluationTextureImageUnits")
resources->maxTessEvaluationTextureImageUnits = value;
else if (tokenStr == "MaxTessEvaluationUniformComponents")
resources->maxTessEvaluationUniformComponents = value;
else if (tokenStr == "MaxTessPatchComponents")
resources->maxTessPatchComponents = value;
else if (tokenStr == "MaxPatchVertices")
resources->maxPatchVertices = value;
else if (tokenStr == "MaxTessGenLevel")
resources->maxTessGenLevel = value;
else if (tokenStr == "MaxViewports")
resources->maxViewports = value;
else if (tokenStr == "MaxVertexAtomicCounters")
resources->maxVertexAtomicCounters = value;
else if (tokenStr == "MaxTessControlAtomicCounters")
resources->maxTessControlAtomicCounters = value;
else if (tokenStr == "MaxTessEvaluationAtomicCounters")
resources->maxTessEvaluationAtomicCounters = value;
else if (tokenStr == "MaxGeometryAtomicCounters")
resources->maxGeometryAtomicCounters = value;
else if (tokenStr == "MaxFragmentAtomicCounters")
resources->maxFragmentAtomicCounters = value;
else if (tokenStr == "MaxCombinedAtomicCounters")
resources->maxCombinedAtomicCounters = value;
else if (tokenStr == "MaxAtomicCounterBindings")
resources->maxAtomicCounterBindings = value;
else if (tokenStr == "MaxVertexAtomicCounterBuffers")
resources->maxVertexAtomicCounterBuffers = value;
else if (tokenStr == "MaxTessControlAtomicCounterBuffers")
resources->maxTessControlAtomicCounterBuffers = value;
else if (tokenStr == "MaxTessEvaluationAtomicCounterBuffers")
resources->maxTessEvaluationAtomicCounterBuffers = value;
else if (tokenStr == "MaxGeometryAtomicCounterBuffers")
resources->maxGeometryAtomicCounterBuffers = value;
else if (tokenStr == "MaxFragmentAtomicCounterBuffers")
resources->maxFragmentAtomicCounterBuffers = value;
else if (tokenStr == "MaxCombinedAtomicCounterBuffers")
resources->maxCombinedAtomicCounterBuffers = value;
else if (tokenStr == "MaxAtomicCounterBufferSize")
resources->maxAtomicCounterBufferSize = value;
else if (tokenStr == "MaxTransformFeedbackBuffers")
resources->maxTransformFeedbackBuffers = value;
else if (tokenStr == "MaxTransformFeedbackInterleavedComponents")
resources->maxTransformFeedbackInterleavedComponents = value;
else if (tokenStr == "MaxCullDistances")
resources->maxCullDistances = value;
else if (tokenStr == "MaxCombinedClipAndCullDistances")
resources->maxCombinedClipAndCullDistances = value;
else if (tokenStr == "MaxSamples")
resources->maxSamples = value;
else if (tokenStr == "nonInductiveForLoops")
resources->limits.nonInductiveForLoops = (value != 0);
else if (tokenStr == "whileLoops")
resources->limits.whileLoops = (value != 0);
else if (tokenStr == "doWhileLoops")
resources->limits.doWhileLoops = (value != 0);
else if (tokenStr == "generalUniformIndexing")
resources->limits.generalUniformIndexing = (value != 0);
else if (tokenStr == "generalAttributeMatrixVectorIndexing")
resources->limits.generalAttributeMatrixVectorIndexing = (value != 0);
else if (tokenStr == "generalVaryingIndexing")
resources->limits.generalVaryingIndexing = (value != 0);
else if (tokenStr == "generalSamplerIndexing")
resources->limits.generalSamplerIndexing = (value != 0);
else if (tokenStr == "generalVariableIndexing")
resources->limits.generalVariableIndexing = (value != 0);
else if (tokenStr == "generalConstantMatrixVectorIndexing")
resources->limits.generalConstantMatrixVectorIndexing = (value != 0);
else
printf("Warning: unrecognized limit (%s) in configuration file.\n", tokenStr.c_str());
}
}
} // end namespace glslang

View File

@ -0,0 +1,57 @@
//
// Copyright (C) 2016 Google, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
//
// Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#ifndef _STAND_ALONE_RESOURCE_LIMITS_INCLUDED_
#define _STAND_ALONE_RESOURCE_LIMITS_INCLUDED_
#include <string>
#include "glslang/Include/ResourceLimits.h"
namespace glslang {
// These are the default resources for TBuiltInResources, used for both
// - parsing this string for the case where the user didn't supply one,
// - dumping out a template for user construction of a config file.
extern const TBuiltInResource DefaultTBuiltInResource;
// Returns the DefaultTBuiltInResource as a human-readable string.
std::string GetDefaultTBuiltInResourceString();
// Decodes the resource limits from |config| to |resources|.
void DecodeResourceLimits(TBuiltInResource* resources, char* config);
} // end namespace glslang
#endif // _STAND_ALONE_RESOURCE_LIMITS_INCLUDED_

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,95 @@
//
// Copyright (C) 2013 LunarG, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
//
// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
#ifndef WORKLIST_H_INCLUDED
#define WORKLIST_H_INCLUDED
#include "../glslang/OSDependent/osinclude.h"
#include <list>
#include <mutex>
#include <string>
namespace glslang {
class TWorkItem {
public:
TWorkItem() { }
explicit TWorkItem(const std::string& s) :
name(s) { }
std::string name;
std::string results;
std::string resultsIndex;
};
class TWorklist {
public:
TWorklist() { }
virtual ~TWorklist() { }
void add(TWorkItem* item)
{
std::lock_guard<std::mutex> guard(mutex);
worklist.push_back(item);
}
bool remove(TWorkItem*& item)
{
std::lock_guard<std::mutex> guard(mutex);
if (worklist.empty())
return false;
item = worklist.front();
worklist.pop_front();
return true;
}
int size()
{
return (int)worklist.size();
}
bool empty()
{
return worklist.empty();
}
protected:
std::mutex mutex;
std::list<TWorkItem*> worklist;
};
} // end namespace glslang
#endif // WORKLIST_H_INCLUDED

View File

@ -0,0 +1,343 @@
//
// Copyright (C) 2015 LunarG, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
//
// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
#include <iostream>
#include <fstream>
#include <cstring>
#include <stdexcept>
#include "../SPIRV/SPVRemapper.h"
namespace {
typedef unsigned int SpvWord;
// Poor man's basename: given a complete path, return file portion.
// E.g:
// Linux: /foo/bar/test -> test
// Win: c:\foo\bar\test -> test
// It's not very efficient, but that doesn't matter for our minimal-duty use.
// Using boost::filesystem would be better in many ways, but want to avoid that dependency.
// OS dependent path separator (avoiding boost::filesystem dependency)
#if defined(_WIN32)
char path_sep_char() { return '\\'; }
#else
char path_sep_char() { return '/'; }
#endif
std::string basename(const std::string filename)
{
const size_t sepLoc = filename.find_last_of(path_sep_char());
return (sepLoc == filename.npos) ? filename : filename.substr(sepLoc+1);
}
void errHandler(const std::string& str) {
std::cout << str << std::endl;
exit(5);
}
void logHandler(const std::string& str) {
std::cout << str << std::endl;
}
// Read word stream from disk
void read(std::vector<SpvWord>& spv, const std::string& inFilename, int verbosity)
{
std::ifstream fp;
if (verbosity > 0)
logHandler(std::string(" reading: ") + inFilename);
spv.clear();
fp.open(inFilename, std::fstream::in | std::fstream::binary);
if (fp.fail())
errHandler("error opening file for read: ");
// Reserve space (for efficiency, not for correctness)
fp.seekg(0, fp.end);
spv.reserve(size_t(fp.tellg()) / sizeof(SpvWord));
fp.seekg(0, fp.beg);
while (!fp.eof()) {
SpvWord inWord;
fp.read((char *)&inWord, sizeof(inWord));
if (!fp.eof()) {
spv.push_back(inWord);
if (fp.fail())
errHandler(std::string("error reading file: ") + inFilename);
}
}
}
void write(std::vector<SpvWord>& spv, const std::string& outFile, int verbosity)
{
if (outFile.empty())
errHandler("missing output filename.");
std::ofstream fp;
if (verbosity > 0)
logHandler(std::string(" writing: ") + outFile);
fp.open(outFile, std::fstream::out | std::fstream::binary);
if (fp.fail())
errHandler(std::string("error opening file for write: ") + outFile);
for (auto it = spv.cbegin(); it != spv.cend(); ++it) {
SpvWord word = *it;
fp.write((char *)&word, sizeof(word));
if (fp.fail())
errHandler(std::string("error writing file: ") + outFile);
}
// file is closed by destructor
}
// Print helpful usage message to stdout, and exit
void usage(const char* const name, const char* const msg = 0)
{
if (msg)
std::cout << msg << std::endl << std::endl;
std::cout << "Usage: " << std::endl;
std::cout << " " << basename(name)
<< " [-v[v[...]] | --verbose [int]]"
<< " [--map (all|types|names|funcs)]"
<< " [--dce (all|types|funcs)]"
<< " [--opt (all|loadstore)]"
<< " [--strip-all | --strip all | -s]"
<< " [--do-everything]"
<< " --input | -i file1 [file2...] --output|-o DESTDIR"
<< std::endl;
std::cout << " " << basename(name) << " [--version | -V]" << std::endl;
std::cout << " " << basename(name) << " [--help | -?]" << std::endl;
exit(5);
}
// grind through each SPIR in turn
void execute(const std::vector<std::string>& inputFile, const std::string& outputDir,
int opts, int verbosity)
{
for (auto it = inputFile.cbegin(); it != inputFile.cend(); ++it) {
const std::string &filename = *it;
std::vector<SpvWord> spv;
read(spv, filename, verbosity);
spv::spirvbin_t(verbosity).remap(spv, opts);
const std::string outfile = outputDir + path_sep_char() + basename(filename);
write(spv, outfile, verbosity);
}
if (verbosity > 0)
std::cout << "Done: " << inputFile.size() << " file(s) processed" << std::endl;
}
// Parse command line options
void parseCmdLine(int argc, char** argv, std::vector<std::string>& inputFile,
std::string& outputDir,
int& options,
int& verbosity)
{
if (argc < 2)
usage(argv[0]);
verbosity = 0;
options = spv::spirvbin_t::NONE;
// Parse command line.
// boost::program_options would be quite a bit nicer, but we don't want to
// introduce a dependency on boost.
for (int a=1; a<argc; ) {
const std::string arg = argv[a];
if (arg == "--output" || arg == "-o") {
// Output directory
if (++a >= argc)
usage(argv[0], "--output requires an argument");
if (!outputDir.empty())
usage(argv[0], "--output can be provided only once");
outputDir = argv[a++];
// Remove trailing directory separator characters
while (!outputDir.empty() && outputDir.back() == path_sep_char())
outputDir.pop_back();
}
else if (arg == "-vv") { verbosity = 2; ++a; } // verbosity shortcuts
else if (arg == "-vvv") { verbosity = 3; ++a; } // ...
else if (arg == "-vvvv") { verbosity = 4; ++a; } // ...
else if (arg == "-vvvvv") { verbosity = 5; ++a; } // ...
else if (arg == "--verbose" || arg == "-v") {
++a;
verbosity = 1;
if (a < argc) {
char* end_ptr = 0;
int verb = ::strtol(argv[a], &end_ptr, 10);
// If we have not read to the end of the string or
// the string contained no elements, then we do not want to
// store the value.
if (*end_ptr == '\0' && end_ptr != argv[a]) {
verbosity = verb;
++a;
}
}
}
else if (arg == "--version" || arg == "-V") {
std::cout << basename(argv[0]) << " version 0.97 " << __DATE__ << " " << __TIME__ << std::endl;
exit(0);
} else if (arg == "--input" || arg == "-i") {
// Collect input files
for (++a; a < argc && argv[a][0] != '-'; ++a)
inputFile.push_back(argv[a]);
} else if (arg == "--do-everything") {
++a;
options = options | spv::spirvbin_t::DO_EVERYTHING;
} else if (arg == "--strip-all" || arg == "-s") {
++a;
options = options | spv::spirvbin_t::STRIP;
} else if (arg == "--strip") {
++a;
if (strncmp(argv[a], "all", 3) == 0) {
options = options | spv::spirvbin_t::STRIP;
++a;
}
} else if (arg == "--dce") {
// Parse comma (or colon, etc) separated list of things to dce
++a;
for (const char* c = argv[a]; *c; ++c) {
if (strncmp(c, "all", 3) == 0) {
options = (options | spv::spirvbin_t::DCE_ALL);
c += 3;
} else if (strncmp(c, "*", 1) == 0) {
options = (options | spv::spirvbin_t::DCE_ALL);
c += 1;
} else if (strncmp(c, "funcs", 5) == 0) {
options = (options | spv::spirvbin_t::DCE_FUNCS);
c += 5;
} else if (strncmp(c, "types", 5) == 0) {
options = (options | spv::spirvbin_t::DCE_TYPES);
c += 5;
}
}
++a;
} else if (arg == "--map") {
// Parse comma (or colon, etc) separated list of things to map
++a;
for (const char* c = argv[a]; *c; ++c) {
if (strncmp(c, "all", 3) == 0) {
options = (options | spv::spirvbin_t::MAP_ALL);
c += 3;
} else if (strncmp(c, "*", 1) == 0) {
options = (options | spv::spirvbin_t::MAP_ALL);
c += 1;
} else if (strncmp(c, "types", 5) == 0) {
options = (options | spv::spirvbin_t::MAP_TYPES);
c += 5;
} else if (strncmp(c, "names", 5) == 0) {
options = (options | spv::spirvbin_t::MAP_NAMES);
c += 5;
} else if (strncmp(c, "funcs", 5) == 0) {
options = (options | spv::spirvbin_t::MAP_FUNCS);
c += 5;
}
}
++a;
} else if (arg == "--opt") {
++a;
for (const char* c = argv[a]; *c; ++c) {
if (strncmp(c, "all", 3) == 0) {
options = (options | spv::spirvbin_t::OPT_ALL);
c += 3;
} else if (strncmp(c, "*", 1) == 0) {
options = (options | spv::spirvbin_t::OPT_ALL);
c += 1;
} else if (strncmp(c, "loadstore", 9) == 0) {
options = (options | spv::spirvbin_t::OPT_LOADSTORE);
c += 9;
}
}
++a;
} else if (arg == "--help" || arg == "-?") {
usage(argv[0]);
} else {
usage(argv[0], "Unknown command line option");
}
}
}
} // namespace
int main(int argc, char** argv)
{
std::vector<std::string> inputFile;
std::string outputDir;
int opts;
int verbosity;
#ifdef use_cpp11
// handle errors by exiting
spv::spirvbin_t::registerErrorHandler(errHandler);
// Log messages to std::cout
spv::spirvbin_t::registerLogHandler(logHandler);
#endif
if (argc < 2)
usage(argv[0]);
parseCmdLine(argc, argv, inputFile, outputDir, opts, verbosity);
if (outputDir.empty())
usage(argv[0], "Output directory required");
std::string errmsg;
// Main operations: read, remap, and write.
execute(inputFile, outputDir, opts, verbosity);
// If we get here, everything went OK! Nothing more to be done.
}

28
deps/glslang/glslang/Test/100.conf vendored Normal file
View File

@ -0,0 +1,28 @@
MaxLights 32
MaxClipPlanes 6
MaxTextureUnits 32
MaxTextureCoords 32
MaxVertexAttribs 8
MaxVertexUniformComponents 4096
MaxVaryingFloats 64
MaxVertexTextureImageUnits 0
MaxCombinedTextureImageUnits 8
MaxTextureImageUnits 8
MaxFragmentUniformComponents 4096
MaxDrawBuffers 1
MaxVertexUniformVectors 16
MaxVaryingVectors 8
MaxFragmentUniformVectors 16
MaxVertexOutputVectors 16
MaxFragmentInputVectors 15
MinProgramTexelOffset -8
MaxProgramTexelOffset 7
nonInductiveForLoops 0
whileLoops 0
doWhileLoops 0
generalUniformIndexing 0
generalAttributeMatrixVectorIndexing 0
generalVaryingIndexing 0
generalSamplerIndexing 0
generalVariableIndexing 0
generalConstantMatrixVectorIndexing 0

227
deps/glslang/glslang/Test/100.frag vendored Normal file
View File

@ -0,0 +1,227 @@
// okay
#version 100
int a[3] = { 2, 3, 4, }; // ERROR (lots)
#version 100
int uint;
attribute vec4 v[3]; // ERROR
float f = 2; // ERROR
uniform block { // ERROR
int x;
};
void foo(float);
void main()
{
foo(3); // ERROR
int s = 1 << 4; // ERROR
s = 16 >> 2; // ERROR
if (a == a); // ERROR
int b, c;
b = c & 4; // ERROR
b = c % 4; // ERROR
b = c | 4; // ERROR
b >>= 2; // ERROR
b <<= 2; // ERROR
b %= 3; // ERROR
struct S {
float f;
float a[10];
} s1, s2;
s1 = s2; // ERROR
if (s1 == s2); // ERROR
if (s1 != s2); // ERROR
switch(b) { // ERROR
}
}
invariant gl_FragColor;
float fa[]; // ERROR
float f13;
invariant f13; // ERROR
struct S { int a; };
invariant S; // ERROR, not an input or output
invariant float fi; // ERROR
varying vec4 av;
invariant av; // okay in v100
void foo10()
{
invariant f; // ERROR
invariant float f2; // ERROR
float f3;
invariant f3; // ERROR
}
uniform vec2 uv2;
invariant uv2; // ERROR
invariant uniform vec3 uv3; // ERROR
sampler2D glob2D; // ERROR
void f11(sampler2D p2d)
{
sampler2D v2D; // ERROR
}
varying sampler2D vary2D; // ERROR
struct sp {
highp float f;
in float g; // ERROR
uniform float h; // ERROR
invariant float i; // ERROR
};
uniform sampler3D s3D; // ERROR
#extension GL_OES_texture_3D : enable
precision highp sampler3D;
uniform sampler3D s3D2;
void foo234()
{
texture3D(s3D2, vec3(0.2), 0.2);
texture3DProj(s3D2, v[1], 0.4);
dFdx(v[0]); // ERROR
dFdy(3.2); // ERROR
fwidth(f13); // ERROR
}
#extension GL_OES_standard_derivatives : enable
void foo236()
{
dFdx(v[0]);
dFdy(3.2);
fwidth(f13);
gl_FragDepth = f13; // ERROR
gl_FragDepthEXT = f13; // ERROR
}
#extension GL_EXT_frag_depth : enable
void foo239()
{
gl_FragDepth = f13; // ERROR
gl_FragDepthEXT = f13;
}
#extension GL_OES_EGL_image_external : enable
uniform samplerExternalOES sExt;
void foo245()
{
texture2D(sExt, vec2(0.2));
texture2DProj(sExt, vec3(f13));
texture2DProj(sExt, v[2]);
}
precision mediump samplerExternalOES;
uniform samplerExternalOES mediumExt;
uniform highp samplerExternalOES highExt;
void foo246()
{
texture2D(mediumExt, vec2(0.2));
texture2DProj(highExt, v[2]);
texture3D(sExt, vec3(f13)); // ERROR
texture2DProjLod(sExt, vec3(f13), f13); // ERROR
int a;
~a; // ERROR
a | a; // ERROR
a & a; // ERROR
}
#extension GL_OES_EGL_image_external : disable
uniform sampler2D s2Dg;
int foo203940(int a, float b, float a) // ERROR, a redefined
{
texture2DProjGradEXT(s2Dg, vec3(f13), uv2, uv2); // ERROR, extension not enabled
return a;
}
float f123 = 4.0f; // ERROR
float f124 = 5e10F; // ERROR
#extension GL_EXT_shader_texture_lod : enable
uniform samplerCube sCube;
void foo323433()
{
texture2DLodEXT(s2Dg, uv2, f13);
texture2DProjGradEXT(s2Dg, vec3(f13), uv2, uv2);
texture2DGradEXT(s2Dg, uv2, uv2, uv2);
textureCubeGradEXT(sCube, vec3(f13), vec3(f13), vec3(f13));
}
int fgfg(float f, mediump int i);
int fgfg(float f, highp int i) { return 2; } // ERROR, precision qualifier difference
int fffg(float f);
int fffg(float f); // ERROR, can't have multiple prototypes
int gggf(float f);
int gggf(float f) { return 2; }
int agggf(float f) { return 2; }
int agggf(float f);
int agggf(float f); // ERROR, second prototype
varying struct SSS { float f; } s; // ERROR
int vf(void);
int vf2();
int vf3(void v); // ERROR
int vf4(int, void); // ERROR
int vf5(int, void v); // ERROR
void badswizzle()
{
vec3 a[5];
a.y; // ERROR, no array swizzle
a.zy; // ERROR, no array swizzle
a.nothing; // ERROR
a.length(); // ERROR, not this version
a.method(); // ERROR
}
float fooinit();
float fooinittest()
{
return fooinit();
}
// Test extra-function initializers
const float fi1 = 3.0;
const float fi2 = 4.0;
const float fi3 = 5.0;
float fooinit()
{
return fi1 + fi2 + fi3; // should make a constant of 12.0
}
int init1 = gl_FrontFacing ? 1 : 2; // ERROR, non-const initializer
#ifdef GL_EXT_shader_non_constant_global_initializers
#extension GL_EXT_shader_non_constant_global_initializers : enable
#endif
int init2 = gl_FrontFacing ? 1 : 2;
#pragma STDGL invariant(all)
#line 3000
#error line of this error should be 3000
uniform samplerExternalOES badExt; // syntax ERROR

View File

@ -0,0 +1,76 @@
#version 100
int ga, gb;
float f;
uniform sampler2D fsa[3];
uniform float fua[10];
attribute mat3 am3;
attribute vec2 av2;
varying vec4 va[4];
const mat2 m2 = mat2(1.0);
const vec3 v3 = vec3(2.0);
void foo(inout float a) {}
int bar()
{
return 1;
}
void main()
{
while (ga < gb) { }
do { } while (false);
for ( ; ; ); // ERROR
for ( ; ga==gb; ); // ERROR
for ( ; ; f++); // ERROR
for ( ga = 0; ; ); // ERROR
for ( bool a = false; ; ); // ERROR
for (float a = 0.0; a == sin(f); ); // ERROR
for ( int a = 0; a < 10; a *= 2); // ERROR
for ( int a = 0; a <= 20; a++) --a; // ERROR
for ( int a = 0; a <= 20; a++) { if (ga==0) a = 4; } // ERROR
for (float a = 0.0; a <= 20.0; a += 2.0);
for (float a = 0.0; a != 20.0; a -= 2.0) { if (ga==0) ga = 4; }
for (float a = 0.0; a == 20.0; a--) for (float a = 0.0; a == 20.0; a--); // two different 'a's, everything okay
for (float a = 0.0; a <= 20.0; a += 2.0);
for (float a = 0.0; a <= 20.0; a += 2.0);
for (float a = 0.0; a > 2.0 * 20.0; a += v3.y);
for (float a = 0.0; a >= 20.0; a += 2.0) foo(a); // ERROR
int ia[9];
fsa[ga]; // ERROR
fua[ga];
am3[ga]; // ERROR
av2[ga]; // ERROR
va[2+ga]; // ERROR
m2[ga]; // ERROR
v3[ga/2]; // ERROR
ia[ga]; // ERROR
for (int a = 3; a >= 0; a--) {
fsa[a];
fua[a+2];
am3[3*a];
av2[3*a];
va[a-1];
m2[a/2];
v3[a];
ia[a];
ia[bar()]; // ERROR
}
fsa[2];
fua[3];
am3[2];
av2[1];
va[1];
m2[1];
v3[1];
ia[3];
}

View File

@ -0,0 +1,41 @@
#version 100
#extension GL_OES_EGL_image_external : enable
uniform samplerExternalOES sExt;
precision mediump samplerExternalOES;
uniform samplerExternalOES mediumExt;
uniform highp samplerExternalOES highExt;
void main()
{
texture2D(sExt, vec2(0.2));
texture2D(mediumExt, vec2(0.2));
texture2D(highExt, vec2(0.2));
texture2DProj(sExt, vec3(0.3));
texture2DProj(sExt, vec4(0.3));
int lod = 0;
highp float bias = 0.01;
textureSize(sExt, lod); // ERROR
texture(sExt, vec2(0.2)); // ERROR
texture(sExt, vec2(0.2), bias); // ERROR
textureProj(sExt, vec3(0.2)); // ERROR
textureProj(sExt, vec3(0.2), bias); // ERROR
textureProj(sExt, vec4(0.2)); // ERROR
textureProj(sExt, vec4(0.2), bias); // ERROR
texelFetch(sExt, ivec2(4), lod); // ERROR
texture3D(sExt, vec3(0.3)); // ERROR
texture2DProjLod(sExt, vec3(0.3), 0.3); // ERROR
texture(sExt, vec3(0.3)); // ERROR
textureProjLod(sExt, vec3(0.3), 0.3); // ERROR
}
#extension GL_OES_EGL_image_external : disable
#extension GL_OES_EGL_image_external_essl3 : enable
uniform samplerExternalOES badExt; // ERROR
#extension GL_OES_EGL_image_external_essl3 : disable
uniform samplerExternalOES badExt; // ERROR

76
deps/glslang/glslang/Test/100scope.vert vendored Normal file
View File

@ -0,0 +1,76 @@
#version 100
int f(int a, int b, int c)
{
int a = b; // ERROR, redefinition
{
float a = float(a) + 1.0;
}
return a;
}
int f(int a, int b, int c); // okay to redeclare
bool b;
float b(int a); // ERROR: redefinition
float c(int a);
bool c; // ERROR: redefinition
float f; // ERROR: redefinition
float tan; // okay, built-in is in an outer scope
float sin(float x); // ERROR: can't redefine built-in functions
float cos(float x) // ERROR: can't redefine built-in functions
{
return 1.0;
}
bool radians(bool x) // okay, can overload built-in functions
{
return true;
}
invariant gl_Position;
void main()
{
int g(); // ERROR: no local function declarations
g();
float sin; // okay
sin;
sin(0.7); // ERROR, use of hidden function
f(1,2,3);
float f; // hides f()
f = 3.0;
gl_Position = vec4(f);
for (int f = 0; f < 10; ++f)
++f;
int x = 1;
{
float x = 2.0, /* 2nd x visible here */ y = x; // y is initialized to 2
int z = z; // ERROR: z not previously defined.
}
{
int x = x; // x is initialized to '1'
}
struct S
{
int x;
};
{
S S = S(0); // 'S' is only visible as a struct and constructor
S.x; // 'S' is now visible as a variable
}
int degrees;
degrees(3.2); // ERROR, use of hidden built-in function
}
varying struct SSS { float f; } s; // ERROR

87
deps/glslang/glslang/Test/110scope.vert vendored Normal file
View File

@ -0,0 +1,87 @@
#version 110
int f(int a, int b, int c)
{
int a = b; // ERROR, redefinition
{
float a = float(a) + 1.0; // okay
}
return a;
}
int f(int a, int b, int c); // okay to redeclare
bool b;
float b(int a); // okay, b and b() are different
float c(int a);
bool c; // okay, and c() are different
float f; // okay f and f() are different
float tan; // okay, hides built-in function
float sin(float x); // okay, can redefine built-in functions
float cos(float x) // okay, can redefine built-in functions
{
return 1.0;
}
bool radians(bool x) // okay, can overload built-in functions
{
return true;
}
int gi = f(1,2,3); // ERROR, can't call user-defined function from global scope
void main()
{
int g(); // okay
g();
float sin; // okay
sin;
sin(0.7); // okay
f(1,2,3);
float f;
f = 3.0;
gl_Position = vec4(f);
for (int f = 0; f < 10; ++f)
++f;
int x = 1;
{
float x = 2.0, /* 2nd x visible here */ y = x; // y is initialized to 2
int z = z; // ERROR: z not previously defined.
}
{
int x = x; // x is initialized to '1'
}
struct S
{
int x;
};
{
S S = S(0); // 'S' is only visible as a struct and constructor
S.x; // 'S' is now visible as a variable
}
int degrees;
degrees(3.2);
{
S s;
s.x = 3;
struct S { // okay, hides S
bool b;
};
S t;
t.b = true;
struct S { // ERROR, redefinition of struct S
float f;
};
}
}

248
deps/glslang/glslang/Test/120.frag vendored Normal file
View File

@ -0,0 +1,248 @@
#version 120
float lowp;
float mediump;
float highp;
float precision;
in vec4 i;
out vec4 o;
uniform sampler2D s2D;
centroid varying vec2 centTexCoord;
uniform mat4x2 m;
struct s {
float f;
};
void main()
{
mat2x3 m23 = mat2x3(m);
int a;
bool b;
s sv = s(a);
float[2] ia = float[2](3, i.y);
float f1 = 1;
float f = a;
f = a;
ivec3 iv3;
vec3 v3 = iv3;
f = f + a;
f = a - f;
f += a;
f = a - f;
v3 *= iv3;
v3 = iv3 / 2.0f;
v3 = 3.0 * iv3;
v3 = 2 * v3;
v3 = v3 - 2;
if (f < a ||
a <= f ||
f > a ||
f >= a ||
a == f ||
f != a);
f = b ? a : f;
f = b ? f : a;
f = b ? a : a;
s news = sv;
i.xy + i.xyz; // ERROR
m * i.xyz; // ERROR
m + i; // ERROR
int aoeu = 1.0; // ERROR
f = b; // ERROR
f = a + b; // ERROR
f = b * a; // ERROR
b = a; // ERROR
b = b + f; // ERROR
f |= b; // ERROR
gl_FragColor = texture2D(s2D, centTexCoord);
float flat;
float smooth;
float noperspective;
float uvec2;
float uvec3;
float uvec4;
//packed; // ERROR, reserved word
{
mat4 m;
vec4 v;
bool b;
gl_FragColor += b ? v : m; // ERROR, types don't match around ":"
}
gl_FragColor.xr; // ERROR, swizzlers not from same field space
gl_FragColor.xyxyx.xy; // ERROR, cannot make a vec5, even temporarily
centTexCoord.z; // ERROR, swizzler out of range
(a,b) = true; // ERROR, not an l-value
}
float imageBuffer;
float uimage2DRect;
int main() {} // ERROR
void main(int a) {} // ERROR
const int a; // ERROR
int foo(in float a);
int foo(out float a) // ERROR
{
return 3.2; // ERROR
foo(a); // ERROR
}
bool gen(vec3 v)
{
if (abs(v[0]) < 1e-4F && abs(v[1]) < 1e-4)
return true;
}
void v1()
{
}
void v2()
{
return v1(); // ERROR, no expression allowed, even though void
}
void atest()
{
vec4 v = gl_TexCoord[1];
v += gl_TexCoord[3];
}
varying vec4 gl_TexCoord[6]; // okay, assigning a size
varying vec4 gl_TexCoord[5]; // ERROR, changing size
mat2x2 m22;
mat2x3 m23;
mat2x4 m24;
mat3x2 m32;
mat3x3 m33;
mat3x4 m34;
mat4x2 m42;
mat4x3 m43;
mat4x4 m44;
void foo123()
{
mat2 r2 = matrixCompMult(m22, m22);
mat3 r3 = matrixCompMult(m33, m33);
mat4 r4 = matrixCompMult(m44, m44);
mat2x3 r23 = matrixCompMult(m23, m23);
mat2x4 r24 = matrixCompMult(m24, m24);
mat3x2 r32 = matrixCompMult(m32, m32);
mat3x4 r34 = matrixCompMult(m34, m34);
mat4x2 r42 = matrixCompMult(m42, m42);
mat4x3 r43 = matrixCompMult(m43, m43);
mat3x2 rfoo1 = matrixCompMult(m23, m32); // ERROR
mat3x4 rfoo2 = matrixCompMult(m34, m44); // ERROR
}
void matConst()
{
vec2 v2;
vec3 v3;
mat4 m4b1 = mat4(v2, v3); // ERROR, not enough
mat4 m4b2 = mat4(v2, v3, v3, v3, v3, v2, v2); // ERROR, too much
mat4 m4g = mat4(v2, v3, v3, v3, v3, v3);
mat4 m4 = mat4(v2, v3, v3, v3, v3, v2);
mat3 m3 = mat3(m4);
mat3 m3b1 = mat3(m4, v2); // ERROR, extra arg
mat3 m3b2 = mat3(m4, m4); // ERROR, extra arg
mat3x2 m32 = mat3x2(m4);
mat4 m4c = mat4(m32);
mat3 m3s = mat3(v2.x);
mat3 m3a1[2] = mat3[2](m3s, m3s);
mat3 m3a2[2] = mat3[2](m3s, m3s, m3s); // ERROR, too many args
}
uniform sampler3D s3D;
uniform sampler1D s1D;
uniform sampler2DShadow s2DS;
void foo2323()
{
vec4 v;
vec2 v2;
float f;
v = texture2DLod(s2D, v2, f); // ERROR
v = texture3DProjLod(s3D, v, f); // ERROR
v = texture1DProjLod(s1D, v, f); // ERROR
v = shadow2DProjLod(s2DS, v, f); // ERROR
v = texture1DGradARB(s1D, f, f, f); // ERROR
v = texture2DProjGradARB(s2D, v, v2, v2); // ERROR
v = shadow2DProjGradARB(s2DS, v, v2, v2); // ERROR
}
#extension GL_ARB_shader_texture_lod : require
void foo2324()
{
vec4 v;
vec2 v2;
float f;
v = texture2DLod(s2D, v2, f);
v = texture3DProjLod(s3D, v, f);
v = texture1DProjLod(s1D, v, f);
v = shadow2DProjLod(s2DS, v, f);
v = texture1DGradARB(s1D, f, f, f);
v = texture2DProjGradARB(s2D, v, v2, v2);
v = shadow2DProjGradARB(s2DS, v, v2, v2);
v = shadow2DRectProjGradARB(s2DS, v, v2, v2); // ERROR
}
uniform sampler2DRect s2DRbad; // ERROR
void foo121111()
{
vec2 v2;
vec4 v = texture2DRect(s2DRbad, v2);
}
#extension GL_ARB_texture_rectangle : enable
uniform sampler2DRect s2DR;
uniform sampler2DRectShadow s2DRS;
void foo12111()
{
vec2 v2;
vec3 v3;
vec4 v4;
vec4 v;
v = texture2DRect(s2DR, v2);
v = texture2DRectProj(s2DR, v3);
v = texture2DRectProj(s2DR, v4);
v = shadow2DRect(s2DRS, v3);
v = shadow2DRectProj(s2DRS, v4);
v = shadow2DRectProjGradARB(s2DRS, v, v2, v2);
}
void voidTernary()
{
bool b;
b ? foo121111() : foo12111();
b ? foo121111() : 4; // ERROR
b ? 3 : foo12111(); // ERROR
}
float halfFloat1 = 1.0h; // syntax ERROR

203
deps/glslang/glslang/Test/120.vert vendored Normal file
View File

@ -0,0 +1,203 @@
#version 120
in vec4 i; // ERROR
out vec4 o; // ERROR
attribute vec2 attv2;
attribute vec4 attv4;
uniform sampler2D s2D;
invariant varying vec2 centTexCoord;
invariant gl_Position;
centroid gl_Position; // ERROR
centroid centroid foo; // ERROR
invariant gl_Position, gl_PointSize;
void main()
{
centTexCoord = attv2;
gl_Position = attv4;
gl_ClipVertex = attv4;
gl_ClipDistance[1] = 0.2; // ERROR
vec3[12] a;
vec4[a.length()] b;
gl_Position = b[b.length()-1];
float f[];
int a1 = f.length(); // ERROR
float f[7];
int aa = f.length();
int a2 = f.length; // ERROR
int a3 = f.length(a); // ERROR
int a4 = f.flizbit; // ERROR
int a4 = f.flizbit(); // ERROR
float md[2][4]; // ERROR
float[2] md2[4]; // ERROR
float[2][4] md3; // ERROR
float md5, md6[2][3]; // ERROR
float[2] md4, md7[4]; // ERROR
float md9[2][3] = float[2][3](1, 2, 3, 4, 5, 6); // ERROR
float md10, md11[2][3] = float[2][3](1, 2, 3, 4, 5, 6); // ERROR
gl_PointSize = 3.8;
}
uniform float initted = 3.4; // okay
const float concall = sin(0.3);
int[2][3] foo( // ERROR
float[2][3] a, // ERROR
float[2] b[3], // ERROR
float c[2][3]); // ERROR
int overloadA(in float f);
int overloadA(out float f); // ERROR, different qualifiers
float overloadA(float); // ERROR, different return value for same signature
float overloadA(out float f, int);
float overloadA(int i);
void overloadB(float, const in float) { }
vec2 overloadC(int, int);
vec2 overloadC(const in int, float);
vec2 overloadC(float, int);
vec2 overloadC(vec2, vec2);
vec3 overloadD(int, float);
vec3 overloadD(float, in int);
vec3 overloadE(float[2]);
vec3 overloadE(mat2 m);
vec3 overloadE(vec2 v);
vec3 overloadF(int);
vec3 overloadF(float);
void foo()
{
float f;
int i;
overloadB(f, f);
overloadB(f, 2);
overloadB(1, i);
overloadC(1); // ERROR
overloadC(1, i);
overloadC(vec2(1), vec2(2));
overloadC(f, 3.0); // ERROR, no way
overloadC(ivec2(1), vec2(2));
overloadD(i, f);
overloadD(f, i);
overloadD(i, i); // ERROR, ambiguous
int overloadB; // hiding
overloadB(1, i); // ERROR
sin(1);
texture2D(s2D, ivec2(0));
clamp(attv4, 0, 1);
clamp(ivec4(attv4), 0, 1);
int a[2];
overloadC(a, 3); // ERROR
overloadE(a); // ERROR
overloadE(3.3); // ERROR
overloadE(vec2(3.3));
overloadE(mat2(0.5));
overloadE(ivec4(1)); // ERROR
overloadE(ivec2(1));
float b[2];
overloadE(b);
overloadF(1, 1); // ERROR
overloadF(1);
}
varying vec4 gl_TexCoord[35]; // ERROR, size too big
// tests for output conversions
void outFun(in float, out ivec2, in int, out float);
int outFunRet(in float, out int, const in int, out ivec4);
ivec2 outFunRet(in float, out ivec4, in int, out ivec4);
void foo2()
{
vec2 v2;
vec4 v4;
float f;
int i;
outFun(i, v2, i, f);
outFunRet(i, f, i, v4);
float ret = outFunRet(i, f, i, v4);
vec2 ret2 = outFunRet(i, v4, i, v4);
bool b = any(lessThan(v4, attv4)); // tests aggregate arg to unary built-in
}
void noise()
{
float f1 = noise1(1.0);
vec2 f2 = noise2(vec2(1.0));
vec3 f3 = noise3(vec3(1.0));
vec4 f4 = noise4(vec4(1.0));
}
// version 130 features
uniform int c;
attribute ivec2 x;
attribute vec2 v2a;
attribute float c1D;
attribute vec2 c2D;
attribute vec3 c3D;
uniform vec4 v4;
void foo213()
{
float f = 3;
switch (c) { // ERRORs...
case 1:
f = sin(f);
break;
case 2:
f = f * f;
default:
f = 3.0;
}
int i;
i << 3 | 0x8A >> 1 & 0xFF; // ERRORs...
vec3 modfOut, modfIn;
vec3 v11 = modf(modfIn, modfOut); // ERRORS...
float t = trunc(f);
vec2 v12 = round(v2a);
vec2 v13 = roundEven(v2a);
bvec2 b10 = isnan(v2a);
bvec4 b11 = isinf(v4);
sinh(c1D) + // ERRORS...
cosh(c1D) * tanh(c2D);
asinh(c4D) + acosh(c4D);
atanh(c3D);
int id = gl_VertexID; // ERROR
gl_ClipDistance[1] = 0.3; // ERROR
}
int gl_ModelViewMatrix[] = 0;
// token pasting (ERRORS...)
#define mac abc##def
int mac;
#define macr(A,B) A ## B
int macr(qrs,tuv);

169
deps/glslang/glslang/Test/130.frag vendored Normal file
View File

@ -0,0 +1,169 @@
#version 130
lowp vec3 a;
mediump float b;
highp int c;
precision highp float;
in vec4 i;
out vec4 o;
flat in float fflat;
smooth in float fsmooth;
noperspective in float fnop;
void main()
{
float clip = gl_ClipDistance[3];
}
uniform samplerCube sampC;
void foo()
{
vec4 s = textureGather(sampC, vec3(0.2));
}
#extension GL_ARB_texture_gather : enable
void bar()
{
vec4 s = textureGather(sampC, vec3(0.2));
}
flat in vec3 gl_Color; // ERROR, type
in vec4 gl_Color;
flat in vec4 gl_Color;
flat in vec4 gl_Color[2]; // ERROR, array
vec4 gl_Color; // ERROR, storage
#extension GL_ARB_texture_gather : warn
void bar2()
{
vec4 s = textureGather(sampC, vec3(0.2));
uvec3 uv3;
bvec3 b3;
b3 = lessThan(uv3, uv3);
b3 = equal(uv3, uv3);
const bvec2 bl1 = greaterThanEqual(uvec2(2, 3), uvec2(3,3));
const bvec2 bl2 = equal(uvec2(2, 3), uvec2(3,3));
const bvec2 bl3 = equal(bl1, bl2); // yes, equal
int a1[int(bl3.x)];
int a2[int(bl3.y)];
a1[0]; // size 1
a2[0]; // size 1
const bvec4 bl4 = notEqual(greaterThan(uvec4(1,2,3,4), uvec4(0,2,0,6)), lessThanEqual(uvec4(7,8,9,10), uvec4(6, 8, 0, 11))); // compare (t,f,t,f) with (f,t,f,t)
int a3[int(bl4.x)+int(bl4.y)+int(bl4.z)+int(bl4.w)];
a3[3]; // size 4
b3 != b3;
b3 < b3; // ERROR
uv3 > uv3; // ERROR
uvec2(2, 3) >= uvec2(3,3); // ERROR
int(bl4) <= int(bl4); // true
int(bl4.x) > int(bl4.y); // false
}
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_texture_rectangle : enable
uniform sampler2D samp2D;
uniform sampler2DShadow samp2DS;
uniform sampler2DRect samp2DR;
uniform sampler2DArray samp2DA;
void bar23()
{
vec4 s;
s = textureGatherOffset(sampC, vec3(0.3), ivec2(1)); // ERROR
s = textureGatherOffset(samp2DR, vec2(0.3), ivec2(1)); // ERROR
s = textureGatherOffset(samp2D, vec2(0.3), ivec2(1));
s = textureGatherOffset(samp2DA, vec3(0.3), ivec2(1));
s = textureGatherOffset(samp2DS, vec2(0.3), 1.3, ivec2(1)); // ERROR
s = textureGatherOffset(samp2D, vec2(0.3), ivec2(1), 2); // ERROR
}
#extension GL_ARB_gpu_shader5 : enable
void bar234()
{
vec4 s;
s = textureGatherOffset(samp2D, vec2(0.3), ivec2(1));
s = textureGatherOffset(samp2DA, vec3(0.3), ivec2(1));
s = textureGatherOffset(samp2DR, vec2(0.3), ivec2(1));
s = textureGatherOffset(samp2DS, vec2(0.3), 1.3, ivec2(1));
s = textureGatherOffset(samp2D, vec2(0.3), ivec2(1), 2);
}
#extension GL_ARB_texture_cube_map_array : enable
uniform samplerCubeArray Sca;
uniform isamplerCubeArray Isca;
uniform usamplerCubeArray Usca;
uniform samplerCubeArrayShadow Scas;
void bar235()
{
ivec3 a = textureSize(Sca, 3);
vec4 b = texture(Sca, i);
ivec4 c = texture(Isca, i, 0.7);
uvec4 d = texture(Usca, i);
b = textureLod(Sca, i, 1.7);
a = textureSize(Scas, a.x);
float f = texture(Scas, i, b.y);
c = textureGrad(Isca, i, vec3(0.1), vec3(0.2));
}
int \
x; // ERROR until 420pack is turned on
#extension GL_ARB_shading_language_420pack : enable
const int ai[3] = { 10, 23, 32 };
layout(binding=0) uniform blockname { int a; } instanceName; // ERROR
uniform layout(binding=0) sampler2D bounds;
void bar23444()
{
mat4x3 m43; \
float a1 = m43[3].y;
vec3 v3;
int a2 = m43.length();
a2 += m43[1].length();
a2 += v3.length();
const float b = 2 * a1;
a.x = gl_MinProgramTexelOffset + gl_MaxProgramTexelOffset;
bool boolb;
boolb.length(); // ERROR
m43[3][1].length(); // ERROR
v3.length; // ERROR
v3.length(b); // ERROR
}
in float gl_FogFragCoord;
#extension GL_ARB_separate_shader_objects : enable
in float gl_FogFragCoord;
in int gl_FogFragCoord; // ERROR
layout(early_fragment_tests) in; // ERROR
layout(r32i) uniform iimage2D iimg2Dbad; // ERROR
#extension GL_ARB_shader_image_load_store : enable
layout(early_fragment_tests) in;
layout(r32i) uniform iimage2D iimg2D;
void qux2()
{
int i;
imageAtomicCompSwap(iimg2D, ivec2(i,i), i, i);
ivec4 pos = imageLoad(iimg2D, ivec2(i,i));
}
layout(early_fragment_tests) out; // ERROR

78
deps/glslang/glslang/Test/130.vert vendored Normal file
View File

@ -0,0 +1,78 @@
#version 130
uniform int c;
uniform usampler2D us2D;
in ivec2 x;
in vec2 v2a;
in float c1D;
in vec2 c2D;
in vec3 c3D;
smooth vec4 c4D; // ??
uniform vec4 v4;
void main()
{
float f = 3;
switch (c) { // full switch testing in switch.frag
case 1:
f = sin(f);
break;
case 2:
f = f * f;
default:
f = 3.0;
}
uint i;
i = texture(us2D, x).w; // full uint testing in uint.frag
i << 3u | 0x8Au >> 1u & 0xFFu;
vec3 modfOut, modfIn;
vec3 v11 = modf(modfIn, modfOut);
float t = trunc(f);
vec2 v12 = round(v2a);
vec2 v13 = roundEven(v2a);
bvec2 b10 = isnan(v2a);
bvec4 b11 = isinf(v4);
sinh(c1D) +
cosh(c1D) * tanh(c2D);
asinh(c4D) + acosh(c4D);
atanh(c3D);
int id = gl_VertexID;
gl_ClipDistance[1] = 0.3;
}
// version 140 features
//uniform isamplerBuffer sbuf;
//layout(std140) uniform blockName {
// int anonMem;
//};
void foo88()
{
int id = gl_InstanceID; // ERROR
//id += anonMem;
id += texelFetch(id, 8);
gl_ClipVertex; // these are all present...
gl_Color;
gl_LightSource[0];
gl_DepthRange.far;
gl_TexCoord;
gl_FogFragCoord;
gl_FrontColor;
}
// token pasting
#define mac abc##def
int mac;
#define macr(A,B) A##B
int macr(qrs,tuv);

53
deps/glslang/glslang/Test/140.frag vendored Normal file
View File

@ -0,0 +1,53 @@
#version 140
varying vec4 v;
in vec4 i;
out vec4 o;
in float gl_ClipDistance[5];
void main()
{
float clip = gl_ClipDistance[2];
}
#ifdef GL_ES
#error GL_ES is set
#else
#error GL_ES is not set
#endif
in struct S { float f; } s; // ERROR
float patch = 3.1;
layout(location=3) in vec4 vl; // ERROR
layout(location = 3) out vec4 factorBad; // ERROR
#extension GL_ARB_explicit_attrib_location : enable
layout(location = 5) out vec4 factor;
#extension GL_ARB_separate_shader_objects : enable
layout(location=4) in vec4 vl2;
float fooi();
void foo()
{
vec2 r1 = modf(v.xy, v.zw); // ERROR, v.zw not l-value
vec2 r2 = modf(o.xy, o.zw);
o.z = fooi();
}
// Test extra-function initializers
float i1 = gl_FrontFacing ? -2.0 : 2.0;
float i2 = 102;
float fooi()
{
return i1 + i2;
}

79
deps/glslang/glslang/Test/140.vert vendored Normal file
View File

@ -0,0 +1,79 @@
#version 140
uniform isamplerBuffer sbuf;
layout(std140) uniform blockName {
int anonMem;
};
void main()
{
int id = gl_InstanceID;
id += anonMem;
id += texelFetch(sbuf, 8).w;
gl_ClipVertex; // could be ERROR, but compiling under compatibility profile
gl_Color; // could be ERROR, but compiling under compatibility profile
gl_LightSource[0]; // could be ERROR, but compiling under compatibility profile
gl_DepthRange.far;
gl_TexCoord; // could be ERROR, but compiling under compatibility profile
gl_FogFragCoord; // could be ERROR, but compiling under compatibility profile
gl_FrontColor; // could be ERROR, but compiling under compatibility profile
}
out vec4 gl_Position; // ERROR
layout(location = 9) in vec4 locBad; // ERROR
#extension GL_ARB_explicit_attrib_location : enable
layout(location = 9) in vec4 loc;
#extension GL_ARB_separate_shader_objects : enable
out vec4 gl_Position;
in vec4 gl_Position; // ERROR
out vec3 gl_Position; // ERROR
out float gl_PointSize;
out vec4 gl_ClipVertex;
out float gl_FogFragCoord;
uniform sampler2DRect s2dr;
uniform sampler2DRectShadow s2drs;
in ivec2 itloc2;
in vec2 tloc2;
in vec3 tloc3;
in vec4 tloc4;
void foo()
{
vec4 v = texelFetch(s2dr, itloc2);
v += texelFetch(s2dr, itloc2, 0.2); // ERROR, no lod
v += texture(s2dr, tloc2);
v += texture(s2dr, tloc2, 0.3); // ERROR, no bias
v += texture(s2drs, tloc3);
v += textureProj(s2dr, tloc3);
v += textureProj(s2dr, tloc4);
v += textureProjGradOffset(s2dr, tloc4, ivec2(0.0), ivec2(0.0), ivec2(1,2));
v += textureProjGradOffset(s2drs, tloc4, ivec2(0.0), ivec2(0.0), ivec2(1,2));
}
void devi()
{
gl_DeviceIndex; // ERROR, no extension
gl_ViewIndex; // ERROR, no extension
}
#ifdef GL_EXT_device_group
#extension GL_EXT_device_group : enable
#endif
#ifdef GL_EXT_device_group
#extension GL_EXT_multiview : enable
#endif
void devie()
{
gl_DeviceIndex;
gl_ViewIndex;
}

50
deps/glslang/glslang/Test/150.frag vendored Normal file
View File

@ -0,0 +1,50 @@
#version 150 core
in vec4 gl_FragCoord;
layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; // ERROR
layout(pixel_center_integer) in vec4 gl_FragCoord; // ERROR
layout(origin_upper_left) in vec4 foo; // ERROR
layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
void main()
{
vec4 c = gl_FragCoord;
}
layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; // ERROR, declared after use
in struct S { float f; } s;
float patch = 3.1;
uniform sampler2DMS sms;
uniform isampler2DMS isms;
uniform usampler2DMS usms;
uniform sampler2DMSArray smsa;
uniform isampler2DMSArray ismsa;
uniform usampler2DMSArray usmsa;
flat in ivec2 p2;
flat in ivec3 p3;
flat in int samp;
void barWxyz()
{
ivec2 t11 = textureSize( sms);
ivec2 t12 = textureSize(isms);
ivec2 t13 = textureSize(usms);
ivec3 t21 = textureSize( smsa);
ivec3 t22 = textureSize(ismsa);
ivec3 t23 = textureSize(usmsa);
vec4 t31 = texelFetch( sms, p2, samp);
ivec4 t32 = texelFetch(isms, p2, samp);
uvec4 t33 = texelFetch(usms, p2, 3);
vec4 t41 = texelFetch( smsa, p3, samp);
ivec4 t42 = texelFetch(ismsa, ivec3(2), samp);
uvec4 t43 = texelFetch(usmsa, p3, samp);
}
int primitiveID()
{
return gl_PrimitiveID;
}

139
deps/glslang/glslang/Test/150.geom vendored Normal file
View File

@ -0,0 +1,139 @@
#version 150 core
in fromVertex {
in vec3 color;
} fromV[];
out toFragment {
out vec3 color;
} toF;
out fromVertex { // okay to reuse a block name for another block name
vec3 color;
};
out fooB {
vec2 color;
} fromVertex; // ERROR, cannot reuse block name as block instance
int fromVertex; // ERROR, cannot reuse a block name for something else
out fooC {
vec2 color;
} fooC; // ERROR, cannot have same name for block and instance name
void main()
{
EmitVertex();
EndPrimitive();
EmitStreamVertex(1); // ERROR
EndStreamPrimitive(0); // ERROR
color = fromV[0].color;
gl_ClipDistance[3] = gl_in[1].gl_ClipDistance[2];
gl_Position = gl_in[0].gl_Position;
gl_PointSize = gl_in[3].gl_PointSize;
gl_PrimitiveID = gl_PrimitiveIDIn;
gl_Layer = 2;
}
out vec4 ov0; // stream should be 0
layout(stream = 4) out vec4 ov4;
out vec4 o1v0; // stream should be 0
layout(stream = 3) uniform; // ERROR
layout(stream = 3) in; // ERROR
layout(stream = 3) uniform int ua; // ERROR
layout(stream = 3) uniform ubb { int ua; } ibb; // ERROR
layout(line_strip, points, triangle_strip, stream = 3, points, triangle_strip) out; // just means "stream = 3, triangle_strip"
layout(stream = 3, triangle_strip) out;
out vec4 ov3; // stream should be 3
layout(stream = 6) out ooutb { vec4 a; } ouuaa6;
layout(stream = 6) out ooutb2 {
layout(stream = 6) vec4 a;
} ouua6;
layout(stream = 7) out ooutb3 {
layout(stream = 6) vec4 a; // ERROR
} ouua7;
out vec4 ov2s3; // stream should be 3
layout(max_vertices = 200) out;
layout(max_vertices = 300) out; // ERROR, too big
void foo(layout(max_vertices = 4) int a) // ERROR
{
ouuaa6.a = vec4(1.0);
}
layout(line_strip, points, triangle_strip, stream = 3, points) out; // ERROR, changing output primitive
layout(line_strip, points, stream = 3) out; // ERROR, changing output primitive
layout(triangle_strip) in; // ERROR, not an input primitive
layout(triangle_strip) uniform; // ERROR
layout(triangle_strip) out vec4 badv4; // ERROR, not on a variable
layout(triangle_strip) in vec4 bad2v4[]; // ERROR, not on a variable or input
layout(invocations = 3) out outbn { int a; }; // 2 ERROR, not on a block, not until 4.0
out outbn2 {
layout(invocations = 3) int a; // 2 ERRORs, not on a block member, not until 4.0
layout(max_vertices = 3) int b; // ERROR, not on a block member
layout(triangle_strip) int c; // ERROR, not on a block member
} outbi;
layout(lines) out; // ERROR, not on output
layout(lines_adjacency) in;
layout(triangles) in; // ERROR, can't change it
layout(triangles_adjacency) in; // ERROR, can't change it
layout(invocations = 4) in; // ERROR, not until 4.0
in inbn {
layout(stream = 2) int a; // ERROR, stream on input
} inbi[];
in sameName {
int a15;
} insn[];
out sameName {
float f15;
};
uniform sameName {
bool b15;
};
float summ = gl_MaxVertexAttribs +
gl_MaxVertexUniformComponents +
gl_MaxVaryingFloats +
gl_MaxVaryingComponents +
gl_MaxVertexOutputComponents +
gl_MaxGeometryInputComponents +
gl_MaxGeometryOutputComponents +
gl_MaxFragmentInputComponents +
gl_MaxVertexTextureImageUnits +
gl_MaxCombinedTextureImageUnits +
gl_MaxTextureImageUnits +
gl_MaxFragmentUniformComponents +
gl_MaxDrawBuffers +
gl_MaxClipDistances +
gl_MaxGeometryTextureImageUnits +
gl_MaxGeometryOutputVertices +
gl_MaxGeometryTotalOutputComponents +
gl_MaxGeometryUniformComponents +
gl_MaxGeometryVaryingComponents;
void fooe1()
{
gl_ViewportIndex = gl_MaxViewports - 1;
}
#extension GL_ARB_viewport_array : enable
void fooe2()
{
gl_ViewportIndex = gl_MaxViewports - 1;
}
out int gl_ViewportIndex;

34
deps/glslang/glslang/Test/150.tesc vendored Normal file
View File

@ -0,0 +1,34 @@
#version 150
#extension GL_ARB_tessellation_shader : enable
layout(vertices = 4) out;
int outa[gl_out.length()];
patch out vec4 patchOut;
void main()
{
barrier();
int a = gl_MaxTessControlInputComponents +
gl_MaxTessControlOutputComponents +
gl_MaxTessControlTextureImageUnits +
gl_MaxTessControlUniformComponents +
gl_MaxTessControlTotalOutputComponents;
vec4 p = gl_in[1].gl_Position;
float ps = gl_in[1].gl_PointSize;
float cd = gl_in[1].gl_ClipDistance[2];
int pvi = gl_PatchVerticesIn;
int pid = gl_PrimitiveID;
int iid = gl_InvocationID;
gl_out[gl_InvocationID].gl_Position = p;
gl_out[gl_InvocationID].gl_PointSize = ps;
gl_out[gl_InvocationID].gl_ClipDistance[1] = cd;
gl_TessLevelOuter[3] = 3.2;
gl_TessLevelInner[1] = 1.3;
}

35
deps/glslang/glslang/Test/150.tese vendored Normal file
View File

@ -0,0 +1,35 @@
#version 150
#extension GL_ARB_tessellation_shader : enable
layout(quads, cw) in;
layout(fractional_odd_spacing) in;
layout(point_mode) in;
patch in vec4 patchIn;
void main()
{
barrier(); // ERROR
int a = gl_MaxTessEvaluationInputComponents +
gl_MaxTessEvaluationOutputComponents +
gl_MaxTessEvaluationTextureImageUnits +
gl_MaxTessEvaluationUniformComponents +
gl_MaxTessPatchComponents +
gl_MaxPatchVertices +
gl_MaxTessGenLevel;
vec4 p = gl_in[1].gl_Position;
float ps = gl_in[1].gl_PointSize;
float cd = gl_in[1].gl_ClipDistance[2];
int pvi = gl_PatchVerticesIn;
int pid = gl_PrimitiveID;
vec3 tc = gl_TessCoord;
float tlo = gl_TessLevelOuter[3];
float tli = gl_TessLevelInner[1];
gl_Position = p;
gl_PointSize = ps;
gl_ClipDistance[2] = cd;
}

29
deps/glslang/glslang/Test/150.vert vendored Normal file
View File

@ -0,0 +1,29 @@
#version 150 core
#ifndef GL_core_profile
# error standard macro GL_core_profile not defined
#endif
in vec4 iv4;
uniform float ps;
invariant gl_Position;
void main()
{
gl_Position = iv4;
gl_PointSize = ps;
gl_ClipDistance[2] = iv4.x;
gl_ClipVertex = iv4;
}
out float gl_ClipDistance[4];
uniform foob {
int a[];
};
int a[5]; // ERROR, resizing user-block member
#line 3000
#error line of this error should be 3001

161
deps/glslang/glslang/Test/300.frag vendored Normal file
View File

@ -0,0 +1,161 @@
#version 300 es
void nodef1(float f); // ERROR, no default precision
uniform sampler2D s2D;
uniform lowp sampler3D s3D;
uniform samplerCube sCube;
uniform lowp samplerCubeShadow sCubeShadow;
uniform lowp sampler2DShadow s2DShadow;
uniform lowp sampler2DArray s2DArray;
uniform lowp sampler2DArrayShadow s2DArrayShadow;
uniform lowp isampler2D is2D;
uniform lowp isampler3D is3D;
uniform lowp isamplerCube isCube;
uniform lowp isampler2DArray is2DArray;
uniform lowp usampler2D us2D;
uniform lowp usampler3D us3D;
uniform lowp usamplerCube usCube;
uniform lowp usampler2DArray us2DArray;
precision lowp float;
in float c1D;
in vec2 c2D;
in vec3 c3D;
smooth vec4 c4D;
flat in int ic1D;
flat in ivec2 ic2D;
flat in ivec3 ic3D;
flat in ivec4 ic4D;
noperspective in vec4 badv; // ERROR
in sampler2D bads; // ERROR
precision lowp uint; // ERROR
struct s {
int i;
sampler2D s;
};
in s badout; // ERROR, can't contain a sampler
// ERROR, can't have int in struct without flat
struct S2 {
vec3 c;
float f;
};
in S2 s2;
out vec3 sc;
out float sf;
uniform sampler2D arrayedSampler[5];
void main()
{
float f;
vec4 v;
v = texture(s2D, c2D);
v = textureProj(s3D, c4D);
v = textureLod(s2DArray, c3D, 1.2);
f = textureOffset(s2DShadow, c3D, ic2D, c1D); // ERROR, offset argument not constant
v = texelFetch(s3D, ic3D, ic1D);
v = texelFetchOffset(arrayedSampler[2], ic2D, 4, ic2D); // ERROR, offset argument not constant
f = textureLodOffset(s2DShadow, c3D, c1D, ic2D);
v = textureProjLodOffset(s2D, c3D, c1D, ic2D);
v = textureGrad(sCube, c3D, c3D, c3D);
f = textureGradOffset(s2DArrayShadow, c4D, c2D, c2D, ic2D);
v = textureProjGrad(s3D, c4D, c3D, c3D);
v = textureProjGradOffset(s2D, c3D, c2D, c2D, ic2D);
v = texture(arrayedSampler[ic1D], c2D); // ERROR
ivec4 iv;
iv = texture(is2D, c2D);
iv = textureProjOffset(is2D, c4D, ic2D);
iv = textureProjLod(is2D, c3D, c1D);
iv = textureProjGrad(is2D, c3D, c2D, c2D);
iv = texture(is3D, c3D, 4.2);
iv = textureLod(isCube, c3D, c1D);
iv = texelFetch(is2DArray, ic3D, ic1D);
iv.xy = textureSize(sCubeShadow, 2);
float precise;
double boo; // ERROR
dvec2 boo2; // ERROR
dvec3 boo3; // ERROR
dvec4 boo4; // ERROR
f += gl_FragCoord.y;
gl_FragDepth = f;
sc = s2.c;
sf = s2.f;
sinh(c1D) +
cosh(c1D) * tanh(c2D);
asinh(c4D) + acosh(c4D);
atanh(c3D);
}
uniform multi {
int[2] a[3]; // ERROR
int[2][3] b; // ERROR
int c[2][3]; // ERROR
} multiInst[2][3]; // ERROR
out vec4 colors[4];
void foo()
{
colors[2] = c4D;
colors[ic1D] = c4D; // ERROR
}
uniform s st1;
uniform s st2;
void foo13(s inSt2)
{
if (st1 == st2); // ERROR
if (st1 != st2); // ERROR
st1.s == st2.s; // ERROR
inSt2 = st1; // ERROR
inSt2 == st1; // ERROR
}
void foo23()
{
textureOffset(s2DShadow, c3D, ivec2(-8, 7), c1D);
textureOffset(s2DShadow, c3D, ivec2(-9, 8), c1D);
}
void foo324(void)
{
float p = pow(3.2, 4.6);
p += sin(0.4);
p += distance(vec2(10.0, 11.0), vec2(13.0, 15.0)); // 5
p += dot(vec3(2,3,5), vec3(-2,-1,4)); // 13
vec3 c3 = cross(vec3(3,-3,1), vec3(4,9,2)); // (-15, -2, 39)
c3 += faceforward(vec3(1,2,3), vec3(2,3,5), vec3(-2,-1,4)); // (-1,-2,-3)
c3 += faceforward(vec3(1,2,3), vec3(-2,-3,-5), vec3(-2,-1,4)); // (1,2,3)
vec2 c2 = reflect(vec2(1,3), vec2(0,1)); // (1,-3)
c2 += refract(vec2(1,3), vec2(0,1), 1.0); // (1,-3)
c2 += refract(vec2(1,3), vec2(0,1), 3.0);
c2 += refract(vec2(1,0.1), vec2(0,1), 5.0); // (0,0)
mat3x2 m32 = outerProduct(vec2(2,3), vec3(5,7,11));// rows: (10, 14, 22), (15, 21, 33)
}
uniform mediump; // ERROR
layout(early_fragment_tests) in; // ERROR
#ifndef GL_FRAGMENT_PRECISION_HIGH
#error missing GL_FRAGMENT_PRECISION_HIGH
#endif
invariant in; // ERROR
invariant in vec4; // ERROR
invariant in vec4 fooinv; // ERROR
float imageBuffer; // ERROR, reserved
float uimage2DRect; // ERROR, reserved

204
deps/glslang/glslang/Test/300.vert vendored Normal file
View File

@ -0,0 +1,204 @@
#version 300 es
uniform mat4x3 m43;
uniform mat3x3 m33;
uniform mat4x4 m44;
in vec3 v3;
varying vec2 v2; // ERROR, varying reserved
in vec4 bad[10]; // ERROR, no arrayed inputs
highp in vec4 badorder; // ERROR, incorrect qualifier order
out invariant vec4 badorder2; // ERROR, incorrect qualifier order
in centroid vec4 badorder4; // ERROR, incorrect qualifier order
out flat vec4 badorder3; // ERROR, incorrect qualifier order
void bar(in const float a); // ERROR, incorrect qualifier order
void bar2(highp in float b); // ERROR, incorrect qualifier order
smooth flat out vec4 rep; // ERROR, replicating interpolation qualification
centroid sample out vec4 rep2; // ERROR, replicating auxiliary qualification
in uniform vec4 rep3; // ERROR, replicating storage qualification
struct S {
vec3 c;
float f;
};
out S s;
void main()
{
int id = gl_VertexID + gl_InstanceID;
int c0 = gl_MaxVertexAttribs;
int c1 = gl_MaxVertexUniformVectors;
int c2 = gl_MaxVertexOutputVectors;
int c3 = gl_MaxFragmentInputVectors;
int c4 = gl_MaxVertexTextureImageUnits;
int c5 = gl_MaxCombinedTextureImageUnits;
int c6 = gl_MaxTextureImageUnits;
int c7 = gl_MaxFragmentUniformVectors;
int c8 = gl_MaxDrawBuffers;
int c9 = gl_MinProgramTexelOffset;
int c10 = gl_MaxProgramTexelOffset;
mat3x4 tm = transpose(m43);
highp float dm = determinant(m44);
mat3x3 im = inverse(m33);
mat3x2 op = outerProduct(v2, v3);
gl_Position = m44[2];
gl_PointSize = v2.y;
s.c = v3;
s.f = dm;
#ifdef GL_ES
#error GL_ES is set
#else
#error GL_ES is not set
#endif
}
float badsize[]; // ERROR
float[] badsize2; // ERROR
uniform ub {
int a[]; // ERROR
} ubInst[]; // ERROR
void foo(int a[]); // ERROR
float okayA[] = float[](3.0f, 4.0F); // Okay
out vec3 newV;
void newVFun()
{
newV = v3;
}
invariant newV; // ERROR, variable already used
in vec4 invIn;
invariant invIn; // ERROR, in v300
out S s2;
invariant s2;
invariant out S s3;
flat out int;
uniform ub2 {
float f;
} a;
uniform ub2 { // ERROR redeclaration of block name (same instance name)
float g;
} a;
uniform ub2 { // ERROR redeclaration of block name (different instance name)
float f;
} c;
uniform ub2 { // ERROR redeclaration of block name (no instance name)
float f123;
};
uniform ub3 {
bool b23;
};
uniform ub3 { // ERROR redeclaration of block name (no instance name in first or declared)
bool b234;
};
precision lowp sampler3D;
precision lowp sampler2DShadow;
precision lowp sampler2DArrayShadow;
uniform sampler2D s2D;
uniform sampler3D s3D;
uniform sampler2DShadow s2DS;
uniform sampler2DArrayShadow s2DAS;
in vec2 c2D;
void foo23()
{
ivec2 x1 = textureSize(s2D, 2);
textureSize(s2D); // ERROR, no lod
ivec3 x3 = textureSize(s2DAS, -1);
textureSize(s2DAS); // ERROR, no lod
vec4 x4 = texture(s2D, c2D);
texture(s2D, c2D, 0.2); // ERROR, bias
vec4 x5 = textureProjOffset(s3D, vec4(0.2), ivec3(1));
textureProjOffset(s3D, vec4(0.2), ivec3(1), .03); // ERROR, bias
float x6 = textureProjGradOffset(s2DS, invIn, vec2(4.2), vec2(5.3), ivec2(1));
}
int fgfg(float f, mediump int i);
int fgfg(float f, highp int i); // ERROR, precision qualifier difference
int fgfgh(float f, const in mediump int i);
int fgfgh(float f, in mediump int i); // ERROR, precision qualifier difference
void foo2349()
{
float[] x = float[] (1.0, 2.0, 3.0);
float[] y = x;
float[3] z = x;
float[3] w;
w = y;
}
int[] foo213234(); // ERROR
int foo234234(float[]); // ERROR
int foo234235(vec2[] v); // ERROR
precision highp float[2]; // ERROR
int fffg(float f);
int fffg(float f);
int gggf(float f);
int gggf(float f) { return 2; }
int gggf(float f);
int agggf(float f) { return 2; }
int agggf(float f);
out struct Ssss { float f; } ssss;
uniform Bblock {
int a;
} Binst;
int Bfoo;
layout(std140) Binst; // ERROR
layout(std140) Bblock; // ERROR
layout(std140) Bfoo; // ERROR
layout(std430) uniform B430 { int a; } B430i; // ERROR
struct SNA {
int a[]; // ERROR
};
void fooDeeparray()
{
float[] x = float[] (1.0, 2.0, 3.0),
y = float[] (1.0, 2.0, 3.0, 4.0);
float xp[3], yp[4];
xp = x;
yp = y;
xp = y; // ERROR, wrong size
yp = x; // ERROR, wrong size
}
layout(num_views = 2) in; // ERROR, no extension
void mwErr()
{
gl_ViewID_OVR; // ERROR, no extension
}
#extension GL_OVR_multiview : enable
layout(num_views = 2) uniform float mwUniform; // ERROR, must be global
layout(num_views = 2) in; // OK
void mwOk()
{
gl_ViewID_OVR;
}

View File

@ -0,0 +1,76 @@
#version 300 es
int imax, imin;
uint umax, umin;
vec3 x, y; // ERROR, needs default precision
bvec3 bv;
uint uy;
uvec2 uv2c;
uvec2 uv2y;
uvec2 uv2x;
uvec4 uv4y;
ivec3 iv3a;
ivec3 iv3b;
ivec4 iv4a;
ivec4 iv4b;
float f;
vec2 v2a, v2b;
vec4 v4;
void main()
{
// 1.3 int
vec3 v = mix(x, y, bv);
ivec4 iv10 = abs(iv4a);
ivec4 iv11 = sign(iv4a);
ivec4 iv12 = min(iv4a, iv4b);
ivec4 iv13 = min(iv4a, imin);
uvec2 u = min(uv2x, uv2y);
uvec4 uv = min(uv4y, uy);
ivec3 iv14 = max(iv3a, iv3b);
ivec4 iv15 = max(iv4a, imax);
uvec2 u10 = max(uv2x, uv2y);
uvec2 u11 = max(uv2x, uy);
ivec4 iv16 = clamp(iv4a, iv4a, iv4b);
ivec4 iv17 = clamp(iv4a, imin, imax);
uvec2 u12 = clamp(uv2x, uv2y, uv2c);
uvec4 uv10 = clamp(uv4y, umin, umax);
// 1.3 float
vec3 modfOut;
vec3 v11 = modf(x, modfOut);
float t = trunc(f);
vec2 v12 = round(v2a);
vec2 v13 = roundEven(v2a);
bvec2 b10 = isnan(v2a);
bvec4 b11 = isinf(v4);
// 3.3 float
int i = floatBitsToInt(f);
uvec4 uv11 = floatBitsToUint(v4);
vec4 v14 = intBitsToFloat(iv4a);
vec2 v15 = uintBitsToFloat(uv2c);
// 4.0 pack
uint u19 = packSnorm2x16(v2a);
vec2 v20 = unpackSnorm2x16(uy);
uint u15 = packUnorm2x16(v2a);
vec2 v16 = unpackUnorm2x16(uy);
uint u17 = packHalf2x16(v2b);
vec2 v18 = unpackHalf2x16(uy);
// not present
noise2(v18); // ERROR, not present
float t__; // ERROR, no __ until revision 310
// ERROR, no __ until revision 310
#define __D
}

58
deps/glslang/glslang/Test/300block.frag vendored Normal file
View File

@ -0,0 +1,58 @@
#version 300 es
precision mediump float;
struct S {
vec4 u;
uvec4 v;
lowp isampler3D sampler;
vec3 w;
struct T1 { // ERROR
int a;
} t;
};
uniform S s;
uniform fooBlock {
uvec4 bv;
uniform mat2 bm2;
lowp isampler2D sampler; // ERROR
struct T2 { // ERROR
int a;
} t;
S fbs; // ERROR, contains a sampler
};
uniform barBlock {
uvec4 nbv;
int ni;
} inst;
uniform barBlockArray {
uvec4 nbv;
int ni;
} insts[4];
uniform unreferenced {
float f;
uint u;
};
void main()
{
texture(s.sampler, vec3(inst.ni, bv.y, insts[2].nbv.z));
insts[s.v.x]; // ERROR
fooBlock; // ERROR
mat4(s); // ERROR
int insts;
float barBlock;
mat4(barBlock);
mat4(unreferenced); // ERROR, bad type
++s; // ERROR
inst - 1; // ERROR
++barBlock;
2 * barBlockArray; // ERROR
}
int fooBlock; // ERROR, redef.

View File

@ -0,0 +1,19 @@
#version 300 es
precision mediump float;
in vec4 pos;
layout (location = 2) in vec4 color; // ERROR
layout(location = 1) out vec4 c;
layout(location = 3) out vec4 p;
layout(location = 4) out vec4 q[2];
void main()
{
c = color;
p = pos;
q[1] = pos;
}
layout(location = 40) out float ca[4]; // ERROR, overlap, ERROR too big
layout(location = 41) out float cb[2]; // ERROR, overlap, ERROR too big
layout(location = 39) out float cc[6]; // ERROR, overlap, ERROR too big

View File

@ -0,0 +1,57 @@
#version 300 es
struct s { vec4 v; };
layout(location = 7) in vec3 c;
layout(LocatioN = 3) in vec4 p;
layout(LocatioN = 9) in vec4 q[4]; // ERROR, no array
layout(LocatioN = 10) in s r[4]; // ERROR, no struct, ERROR, location overlap
out vec4 pos;
out vec3 color;
layout(shared, column_major) uniform mat4 badm4; // ERROR
layout(shared, column_major, row_major) uniform; // default is now shared and row_major
layout(std140) uniform Transform { // layout of this block is std140
mat4 M1; // row_major
layout(column_major) mat4 M2; // column major
mat3 N1; // row_major
centroid float badf; // ERROR
in float badg; // ERROR
layout(std140) float bad1;
layout(shared) float bad2;
layout(packed) float bad3;
} tblock;
uniform T2 { // layout of this block is shared
bool b;
mat4 t2m;
};
layout(column_major) uniform T3 { // shared and column_major
mat4 M3; // column_major
layout(row_major) mat4 M4; // row major
mat3 N2; // column_major
int b; // ERROR, redefinition (needs to be last member of block for testing, following members are skipped)
};
out badout { // ERROR
float f;
};
layout (location = 10) out vec4 badoutA; // ERROR
void main()
{
pos = p * (tblock.M1 + tblock.M2 + M4 + M3 + t2m);
color = c * tblock.N1;
}
shared vec4 compute_only; // ERROR
layout(packed) uniform;
layout(packed) uniform float aoeuntaoeu; // ERROR, packed on variable
layout(location = 40) in float cd;
layout(location = 37) in mat4x3 ce; // ERROR, overlap

View File

@ -0,0 +1,8 @@
#version 300 es
precision highp float;
out vec4 color1;
out vec4 color2;
void main() {}

11
deps/glslang/glslang/Test/300link2.frag vendored Normal file
View File

@ -0,0 +1,11 @@
#version 300 es
precision mediump float;
in vec4 pos;
layout(location = 1) out vec4 c;
layout(location = 5) out vec4 p;
layout(location = 9) out vec4 q[2];
void main()
{
}

View File

@ -0,0 +1,7 @@
#version 300 es
precision highp float;
out vec4 color1;
void main() {}

View File

@ -0,0 +1,135 @@
#version 300 es
uniform block {
mediump float f;
} instanceName;
struct S {
int i;
} s;
float a[5];
void main()
{
bool b;
float f;
int i;
uint u;
bvec3 b3;
vec3 v3;
ivec3 iv3;
uvec3 uv3;
vec4 v4;
ivec4 iv4;
uvec4 uv4;
mat2 m2;
mat4 m4;
// These are all errors:
instanceName + instanceName;
s + s;
i + f;
u + f;
u + i;
iv3 *= iv4;
iv4 / uv4;
i - v3;
iv3 + uv3;
a * a;
b / b;
f % f;
i % f;
f % u;
instanceName++;
++s;
a--;
++b3;
iv3 < uv3;
m2 > m2;
m2 != m4;
i >= u;
a <= a;
b > b;
b && b3;
b3 ^^ b3;
b3 || b;
i && i;
u || u;
m2 ^^ m2;
!u;
!i;
!m2;
!v3;
!a;
~f;
~m4;
~v3;
~a;
~instanceName;
i << iv3;
u << uv3;
i >> f;
f >> i;
m4 >> i;
a >> u;
iv3 >> iv4;
i & u;
u &= uv3;
i | uv3;
u & f;
m2 | m2;
s ^ s;
(f = f) = f;
// These are all okay:
f * v4;
u + u;
uv4 / u;
iv3 -= iv3;
i %= 3;
uv3 % 4u;
--m2;
iv4++;
m4 != m4;
m2 == m2;
i <= i;
a == a;
s != s;
b && b;
b || b;
b ^^ b;
!b, uv3;
~i;
~u;
~uv3;
~iv3;
uv3 <<= i;
i >> i;
u << u;
iv3 >> iv3;
i & i;
u | u;
iv3 ^ iv3;
u & uv3;
uv3 | u;
uv3 &= u;
int arr[0x222 & 0xf];
arr[1]; // size 2
int arr2[(uvec2(0, 0x2) | 0x1u).y];
arr2[2]; // size 3
}

View File

@ -0,0 +1,41 @@
#version 300 es
#extension GL_OES_EGL_image_external_essl3 : enable
uniform samplerExternalOES sExt;
precision mediump samplerExternalOES;
uniform samplerExternalOES mediumExt;
uniform highp samplerExternalOES highExt;
void main()
{
texture2D(sExt, vec2(0.2)); // ERROR
texture2D(mediumExt, vec2(0.2)); // ERROR
texture2D(highExt, vec2(0.2)); // ERROR
texture2DProj(sExt, vec3(0.3)); // ERROR
texture2DProj(sExt, vec4(0.3)); // ERROR
int lod = 0;
highp float bias = 0.01;
textureSize(sExt, lod);
texture(sExt, vec2(0.2));
texture(sExt, vec2(0.2), bias);
textureProj(sExt, vec3(0.2));
textureProj(sExt, vec3(0.2), bias);
textureProj(sExt, vec4(0.2));
textureProj(sExt, vec4(0.2), bias);
texelFetch(sExt, ivec2(4), lod);
texture3D(sExt, vec3(0.3)); // ERROR
texture2DProjLod(sExt, vec3(0.3), 0.3); // ERROR
texture(sExt, vec3(0.3)); // ERROR
textureProjLod(sExt, vec3(0.3), 0.3); // ERROR
}
#extension GL_OES_EGL_image_external_essl3 : disable
#extension GL_OES_EGL_image_external : enable
uniform samplerExternalOES badExt; // ERROR
#extension GL_OES_EGL_image_external : disable
uniform samplerExternalOES badExt; // ERROR

74
deps/glslang/glslang/Test/300scope.vert vendored Normal file
View File

@ -0,0 +1,74 @@
#version 300 es
int f(int a, int b, int c)
{
int a = b; // ERROR, redefinition
{
float a = float(a) + 1.0;
}
return a;
}
int f(int a, int b, int c); // okay to redeclare
bool b;
float b(int a); // ERROR: redefinition
float c(int a);
bool c; // ERROR: redefinition
float f; // ERROR: redefinition
float tan; // ERROR: redefines built-in function
float sin(float x); // ERROR: can't redefine built-in functions
float cos(float x) // ERROR: can't redefine built-in functions
{
return 1.0;
}
bool radians(bool x) // ERROR: can't overload built-in functions
{
return true;
}
invariant gl_Position;
void main()
{
int g(); // ERROR: no local function declarations
g();
float sin; // okay
sin;
sin(0.7); // ERROR, use of hidden function
f(1,2,3);
float f; // hides f()
f = 3.0;
gl_Position = vec4(f);
for (int f = 0; f < 10; ++f)
++f;
int x = 1;
{
float x = 2.0, /* 2nd x visible here */ y = x; // y is initialized to 2
int z = z; // ERROR: z not previously defined.
}
{
int x = x; // x is initialized to '1'
}
struct S
{
int x;
};
{
S S = S(0); // 'S' is only visible as a struct and constructor
S.x; // 'S' is now visible as a variable
}
int degrees;
degrees(3.2); // ERROR, use of hidden built-in function
}

256
deps/glslang/glslang/Test/310.comp vendored Normal file
View File

@ -0,0 +1,256 @@
#version 310 es
layout(local_size_x = 2) in;
layout(local_size_x = 16) in; // ERROR, changing
layout(local_size_z = 4096) in; // ERROR, too large
layout(local_size_x = 2) in;
layout(local_size_y = 0) in; // ERROR, 0 not allowed
const int total = gl_MaxComputeWorkGroupCount.y
+ gl_MaxComputeUniformComponents
+ gl_MaxComputeTextureImageUnits
+ gl_MaxComputeImageUniforms
+ gl_MaxComputeAtomicCounters
+ gl_MaxComputeAtomicCounterBuffers;
buffer ShaderStorageBlock
{
int value;
float values[];
};
buffer InvalidShaderStorageBlock
{
float values[]; // ERROR
int value;
} invalid;
void main()
{
barrier();
memoryBarrier();
memoryBarrierAtomicCounter();
memoryBarrierBuffer();
memoryBarrierShared();
memoryBarrierImage();
groupMemoryBarrier();
value = int(values[gl_LocalInvocationIndex]);
}
layout(location = 2) in vec3 v3; // ERROR
in float f; // ERROR
out float fo; // ERROR
shared vec4 s;
layout(location = 2) shared vec4 sl; // ERROR
shared float fs = 4.2; // ERROR
layout(local_size_x = 2, local_size_y = 3, local_size_z = 4) out; // ERROR
int arrX[gl_WorkGroupSize.x];
int arrY[gl_WorkGroupSize.y];
int arrZ[gl_WorkGroupSize.z];
readonly buffer roblock
{
int value;
float values[];
} ro;
void foo()
{
ro.values[2] = 4.7; // ERROR, readonly
ro.values.length();
++s;
}
buffer vec4 v; // ERROR
uniform usampler2D us2dbad; // ERROR, default precision
precision highp usampler2D;
precision highp iimage2DArray;
precision highp iimage2D;
uniform usampler2D us2d;
uniform iimage2DArray ii2dabad; // ERROR, not writeonly
uniform writeonly iimage2DArray ii2da;
layout(r32i) uniform iimage2D iimg2D;
layout(rgba32i) uniform readonly iimage2D iimg2Drgba;
layout(rgba32f) uniform readonly image2D img2Drgba; // ERROR, no default
layout(r32ui) uniform uimage2D uimg2D; // ERROR, no default
void qux()
{
int i = 4;
imageAtomicCompSwap(iimg2D, ivec2(i,i), i, i);// ERROR no longer in 310
imageAtomicAdd(uimg2D, ivec2(i,i), uint(i)); // ERROR no longer in 310
imageAtomicMin(iimg2Drgba, ivec2(i,i), i); // ERROR no longer in 310 // ERROR iimg2Drgba does not have r32i layout
imageAtomicMax(img2Drgba, ivec2(i,i), i); // ERROR no longer in 310 // ERROR img2Drgba is not integer image
ivec4 pos = imageLoad(iimg2D, ivec2(i,i));
imageStore(ii2da, ivec3(i,i,i), ivec4(0));
imageLoad(img2Drgba, ivec2(i,i));
imageLoad(ii2da, ivec3(i,i,i)); // ERROR, drops writeonly
}
volatile float vol; // ERROR, not an image
readonly int vol2; // ERROR, not an image
void passr(coherent readonly iimage2D image)
{
}
layout(r32i) coherent readonly uniform iimage2D qualim1;
layout(r32i) coherent restrict readonly uniform iimage2D qualim2;
void passrc()
{
passr(qualim1);
passr(qualim2); // ERROR, drops restrict
passr(iimg2D);
}
highp layout(rg8i) uniform readonly uimage2D i1bad; // ERROR, type mismatch
highp layout(rgba32i) uniform readonly image2D i2bad; // ERROR, type mismatch
highp layout(rgba32f) uniform readonly uimage2D i3bad; // ERROR, type mismatch
layout(r8_snorm) uniform readonly iimage2D i4bad; // ERROR, type mismatch
layout(rgba32ui) uniform readonly iimage2D i5bad; // ERROR, type mismatch
layout(r8ui) uniform readonly iimage2D i6bad; // ERROR, type mismatch
layout(binding = 0) uniform atomic_uint counter;
uint func(atomic_uint c)
{
return atomicCounterIncrement(c);
}
uint func2(out atomic_uint c) // ERROR, output
{
return counter; // ERROR, type mismatch
return atomicCounter(counter);
}
void mainAC()
{
atomic_uint non_uniform_counter; // ERROR
uint val = atomicCounter(counter);
atomicCounterDecrement(counter);
}
layout(binding = 1) uniform mediump atomic_uint counterBad; // ERROR, not highp
layout(binding = 2, offset = 4) uniform atomic_uint countArr[4];
uniform int i;
void opac()
{
int a[3];
a[counter]; // ERROR, non-integer
countArr[2];
countArr[i];
}
shared int atomi;
shared uint atomu;
void atoms()
{
int origi = atomicAdd(atomi, 3);
uint origu = atomicAnd(atomu, 7u);
origi = atomicExchange(atomi, 4);
origu = atomicCompSwap(atomu, 10u, 8u);
}
precision highp atomic_uint;
precision lowp atomic_uint; // ERROR
precise int pfoo; // ERROR, reserved
dmat2x4 dm; // ERROR
uniform samplerCubeArray sca; // ERROR
uniform iimage2DRect i2dr; // ERROR
highp uniform image2DMS i2dms; // ERROR
uniform uimage2DMSArray u2dmsa; // ERROR
highp layout(r32f) coherent volatile restrict readonly writeonly uniform image2D okay1;
layout(r32i) coherent volatile restrict readonly uniform iimage2D okay2;
highp layout(r32ui) coherent volatile restrict writeonly uniform uimage2D okay3;
highp layout(r32f) coherent volatile restrict uniform image2D okay4;
highp layout(rgba32f) coherent volatile restrict uniform image2D badQ1; // ERROR, bad qualifiers
layout(rgba8i) coherent volatile restrict uniform iimage2D badQ2; // ERROR, bad qualifiers
highp layout(rgba16ui) coherent volatile restrict uniform uimage2D badQ3; // ERROR, bad qualifiers
writeonly buffer woblock
{
int value;
float values[];
} wo;
void foowo()
{
float g;
g = wo.values[2]; // ERROR, writeonly
float f = wo.values[2]; // ERROR, writeonly
++wo.values[2]; // ERROR, writeonly
wo.values[2]--; // ERROR, writeonly
f + wo.values[2]; // ERROR, writeonly
wo.values[2] - f; // ERROR, writeonly
bool b;
b ? f : wo.values[2]; // ERROR, writeonly
b ? wo.values[2] : f; // ERROR, writeonly
if (f == wo.values[2]) // ERROR, writeonly
++f;
if (f >= wo.values[2]) // ERROR, writeonly
++f;
f = vec3(wo.values[2]).x; // ERROR, writeonly
~wo.value; // ERROR, writeonly
wo.values[2] = 3.4;
}
buffer multioblock
{
readonly int value;
writeonly float values[];
} multio;
void foomultio()
{
float g;
g = wo.values[2]; // ERROR, writeonly
~wo.value;
wo.values[2] = 3.4;
wo.value = 2; // ERROR, readonly
}
in inb { // ERROR
int a;
} inbi;
out outb { // ERROR
int a;
} outbi;
float t__; // ERROR, no __ until revision 310
// ERROR, no __ until revision 310
#define __D
shared vec4 arr[2][3][4];
void devi()
{
gl_DeviceIndex; // ERROR, no extension
gl_ViewIndex; // ERROR, never this stage
}
#ifdef GL_EXT_device_group
#extension GL_EXT_device_group : enable
#endif
void devie()
{
gl_DeviceIndex;
gl_ViewIndex; // ERROR, never this stage
}

451
deps/glslang/glslang/Test/310.frag vendored Normal file
View File

@ -0,0 +1,451 @@
#version 310 es
highp float nodef3(float); // ERROR, no default precision
precision mediump float;
precision highp usampler2D;
precision highp sampler2D;
precision highp isampler2DArray;
layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; // ERROR, not supported
layout(location = 2) in vec3 v3;
layout(location = 2) in mat4 yi; // ERROR, locations conflict with xi
uniform sampler2D arrayedSampler[5];
uniform usampler2D usamp2d;
uniform usampler2DRect samp2dr; // ERROR, reserved
uniform isampler2DArray isamp2DA;
in vec2 c2D;
uniform int i;
void main()
{
vec4 v = texture(arrayedSampler[i], c2D); // ERROR
ivec2 offsets[4];
const ivec2 constOffsets[4] = ivec2[4](ivec2(1,2), ivec2(3,4), ivec2(15,16), ivec2(-2,0));
uvec4 uv4 = textureGatherOffsets(samp2dr, c2D, offsets, 2); // ERROR, not supported
vec4 v4 = textureGather(arrayedSampler[0], c2D);
ivec4 iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 3);
iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), i); // ERROR, last argument not const
iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 4); // ERROR, last argument out of range
iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 1+2);
iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(0.5));
iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(i)); // ERROR, offset not constant
}
out vec4 outp;
void foo23()
{
const ivec2[3] offsets = ivec2[3](ivec2(1,2), ivec2(3,4), ivec2(15,16));
textureProjGradOffset(usamp2d, outp, vec2(0.0), vec2(0.0), ivec2(c2D)); // ERROR, offset not constant
textureProjGradOffset(usamp2d, outp, vec2(0.0), vec2(0.0), offsets[1]);
textureProjGradOffset(usamp2d, outp, vec2(0.0), vec2(0.0), offsets[2]); // ERROR, offset out of range
textureProjGradOffset(usamp2d, outp, vec2(0.0), vec2(0.0), ivec2(-10, 20)); // ERROR, offset out of range
if (gl_HelperInvocation)
++outp;
int sum = gl_MaxVertexImageUniforms +
gl_MaxFragmentImageUniforms +
gl_MaxComputeImageUniforms +
gl_MaxCombinedImageUniforms +
gl_MaxCombinedShaderOutputResources;
bool b1, b2, b3, b;
b1 = mix(b2, b3, b);
uvec3 um3 = mix(uvec3(i), uvec3(i), bvec3(b));
ivec4 im4 = mix(ivec4(i), ivec4(i), bvec4(b));
}
layout(binding=3) uniform sampler2D s1;
layout(binding=3) uniform sampler2D s2; // ERROR: overlapping bindings? Don't see that in the 310 spec.
highp layout(binding=2) uniform writeonly image2D i2D;
layout(binding=4) uniform readonly image3D i3D; // ERROR, no default precision
layout(binding=5) uniform imageCube iCube; // ERROR, no default precision
layout(binding=6) uniform image2DArray i2DA; // ERROR, no default precision
layout(binding=6) uniform coherent volatile restrict image2D i2Dqualified; // ERROR, no default precision
layout(binding = 1) uniform bb {
int foo;
layout(binding = 2) float f; // ERROR
} bbi;
in centroid vec4 centroidIn;
layout(location = 200000) uniform vec4 bigl; // ERROR, location too big
layout(early_fragment_tests) in;
layout(location = 40) out vec4 bigout1; // ERROR, too big
layout(location = 40) out vec4 bigout2; // ERROR, overlap
layout(location = -2) out vec4 neg; // ERROR, negative
layout(std430) buffer b430 {
int i;
} b430i;
layout(shared) uniform bshar {
int i;
} bshari;
in smooth vec4 smoothIn;
in flat int flatIn;
uniform sampler2DMS s2dms; // ERROR, no default precision qualifier
void foots()
{
highp ivec2 v2 = textureSize(s1, 2);
highp ivec3 v3 = textureSize(isamp2DA, 3);
v2 = textureSize(s2dms);
v2 = imageSize(i2D);
v3 = imageSize(i3D);
v2 = imageSize(iCube);
v3 = imageSize(i2DA);
v2 = imageSize(i2Dqualified);
}
out bool bout; // ERROR
highp out image2D imageOut; // ERROR
out mat2x3 mout; // ERROR
in bool inb; // ERROR
in sampler2D ino; // ERROR
in float ina[4];
in float inaa[4][2]; // ERROR
struct S { float f; };
in S ins;
in S[4] inasa; // ERROR
in S insa[4]; // ERROR
struct SA { float f[4]; };
in SA inSA; // ERROR
struct SS { float f; S s; };
in SS inSS; // ERROR
#ifndef GL_EXT_shader_io_blocks
#error GL_EXT_shader_io_blocks not defined
#endif
#extension GL_EXT_shader_io_blocks : enable
out outbname { int a; } outbinst; // ERROR, not out block in fragment shader
in inbname {
int a;
vec4 v;
struct { int b; } s; // ERROR, nested struct definition
} inbinst;
in inbname2 {
layout(location = 12) int aAnon;
layout(location = 13) centroid in vec4 vAnon;
};
in layout(location = 13) vec4 aliased; // ERROR, aliased
in inbname2 { // ERROR, reuse of block name
int aAnon;
centroid in vec4 vAnon;
};
in badmember { // ERROR, aAnon already in global scope
int aAnon;
};
int inbname; // ERROR, redefinition of block name
vec4 vAnon; // ERROR, anon in global scope; redefinition
in arrayed {
float f;
} arrayedInst[4];
void fooIO()
{
vec4 v = inbinst.v + vAnon;
v *= arrayedInst[2].f;
v *= arrayedInst[i].f;
}
in vec4 gl_FragCoord;
layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; // ERROR, non-ES
layout(early_fragment_tests) in;
out float gl_FragDepth;
layout(depth_any) out float gl_FragDepth; // ERROR, non-ES
void foo_IO()
{
gl_FragDepth = 0.2; // ERROR, early_fragment_tests declared
gl_Layer; // ERROR, not present
gl_PrimitiveID; // ERROR, not present
bool f = gl_FrontFacing;
}
out float gl_FragDepth;
#extension GL_OES_geometry_shader : enable
void foo_GS()
{
highp int l = gl_Layer;
highp int p = gl_PrimitiveID;
}
in vec2 inf, ing;
uniform ivec2 offsets[4];
uniform sampler2D sArray[4];
uniform int sIndex;
layout(binding = 0) uniform atomic_uint auArray[2];
uniform ubName { int i; } ubInst[4];
buffer bbName { int i; } bbInst[4];
highp uniform writeonly image2D iArray[5];
const ivec2 constOffsets[4] = ivec2[4](ivec2(0.1), ivec2(0.2), ivec2(0.3), ivec2(0.4));
void pfooBad()
{
precise vec2 h; // ERROR reserved
h = fma(inf, ing, h); // ERROR, not available
textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf)); // ERROR, offset not constant
textureGatherOffsets(sArray[0], vec2(0.1), constOffsets); // ERROR, not available
}
#extension GL_OES_gpu_shader5 : enable
void pfoo()
{
precise vec2 h;
h = fma(inf, ing, h);
textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf));
textureGatherOffsets(sArray[0], vec2(0.1), constOffsets);
textureGatherOffsets(sArray[0], vec2(0.1), offsets); // ERROR, offset not constant
}
#extension GL_EXT_texture_cube_map_array : enable
precision highp imageCubeArray ;
precision highp iimageCubeArray ;
precision highp uimageCubeArray ;
precision highp samplerCubeArray ;
precision highp samplerCubeArrayShadow;
precision highp isamplerCubeArray ;
precision highp usamplerCubeArray ;
uniform writeonly imageCubeArray CA1;
uniform writeonly iimageCubeArray CA2;
uniform writeonly uimageCubeArray CA3;
#ifdef GL_EXT_texture_cube_map_array
uniform samplerCubeArray CA4;
uniform samplerCubeArrayShadow CA5;
uniform isamplerCubeArray CA6;
uniform usamplerCubeArray CA7;
#endif
void CAT()
{
highp vec4 b4 = texture(CA4, vec4(0.5), 0.24);
highp ivec4 b6 = texture(CA6, vec4(0.5), 0.26);
highp uvec4 b7 = texture(CA7, vec4(0.5), 0.27);
}
void badSample()
{
lowp int a1 = gl_SampleID; // ERROR, need extension
mediump vec2 a2 = gl_SamplePosition; // ERROR, need extension
highp int a3 = gl_SampleMaskIn[0]; // ERROR, need extension
gl_SampleMask[0] = a3; // ERROR, need extension
mediump int n = gl_NumSamples; // ERROR, need extension
}
#ifdef GL_OES_sample_variables
#extension GL_OES_sample_variables : enable
#endif
void goodSample()
{
lowp int a1 = gl_SampleID;
mediump vec2 a2 = gl_SamplePosition;
highp int a3 = gl_SampleMaskIn[0];
gl_SampleMask[0] = a3;
mediump int n1 = gl_MaxSamples;
mediump int n2 = gl_NumSamples;
}
uniform layout(r32f) highp image2D im2Df;
uniform layout(r32ui) highp uimage2D im2Du;
uniform layout(r32i) highp iimage2D im2Di;
uniform ivec2 P;
void badImageAtom()
{
float datf;
int dati;
uint datu;
imageAtomicAdd( im2Di, P, dati); // ERROR, need extension
imageAtomicAdd( im2Du, P, datu); // ERROR, need extension
imageAtomicMin( im2Di, P, dati); // ERROR, need extension
imageAtomicMin( im2Du, P, datu); // ERROR, need extension
imageAtomicMax( im2Di, P, dati); // ERROR, need extension
imageAtomicMax( im2Du, P, datu); // ERROR, need extension
imageAtomicAnd( im2Di, P, dati); // ERROR, need extension
imageAtomicAnd( im2Du, P, datu); // ERROR, need extension
imageAtomicOr( im2Di, P, dati); // ERROR, need extension
imageAtomicOr( im2Du, P, datu); // ERROR, need extension
imageAtomicXor( im2Di, P, dati); // ERROR, need extension
imageAtomicXor( im2Du, P, datu); // ERROR, need extension
imageAtomicExchange(im2Di, P, dati); // ERROR, need extension
imageAtomicExchange(im2Du, P, datu); // ERROR, need extension
imageAtomicExchange(im2Df, P, datf); // ERROR, need extension
imageAtomicCompSwap(im2Di, P, 3, dati); // ERROR, need extension
imageAtomicCompSwap(im2Du, P, 5u, datu); // ERROR, need extension
}
#ifdef GL_OES_shader_image_atomic
#extension GL_OES_shader_image_atomic : enable
#endif
uniform layout(rgba32f) highp image2D badIm2Df; // ERROR, needs readonly or writeonly
uniform layout(rgba8ui) highp uimage2D badIm2Du; // ERROR, needs readonly or writeonly
uniform layout(rgba16i) highp iimage2D badIm2Di; // ERROR, needs readonly or writeonly
void goodImageAtom()
{
float datf;
int dati;
uint datu;
imageAtomicAdd( im2Di, P, dati);
imageAtomicAdd( im2Du, P, datu);
imageAtomicMin( im2Di, P, dati);
imageAtomicMin( im2Du, P, datu);
imageAtomicMax( im2Di, P, dati);
imageAtomicMax( im2Du, P, datu);
imageAtomicAnd( im2Di, P, dati);
imageAtomicAnd( im2Du, P, datu);
imageAtomicOr( im2Di, P, dati);
imageAtomicOr( im2Du, P, datu);
imageAtomicXor( im2Di, P, dati);
imageAtomicXor( im2Du, P, datu);
imageAtomicExchange(im2Di, P, dati);
imageAtomicExchange(im2Du, P, datu);
imageAtomicExchange(im2Df, P, datf);
imageAtomicCompSwap(im2Di, P, 3, dati);
imageAtomicCompSwap(im2Du, P, 5u, datu);
imageAtomicMax(badIm2Di, P, dati); // ERROR, not an allowed layout() on the image
imageAtomicMax(badIm2Du, P, datu); // ERROR, not an allowed layout() on the image
imageAtomicExchange(badIm2Df, P, datf); // ERROR, not an allowed layout() on the image
}
sample in vec4 colorSampInBad; // ERROR, reserved
centroid out vec4 colorCentroidBad; // ERROR
flat out vec4 colorBadFlat; // ERROR
smooth out vec4 colorBadSmooth; // ERROR
noperspective out vec4 colorBadNo; // ERROR
flat centroid in vec2 colorfc;
in float scalarIn;
void badInterp()
{
interpolateAtCentroid(colorfc); // ERROR, need extension
interpolateAtSample(colorfc, 1); // ERROR, need extension
interpolateAtOffset(colorfc, vec2(0.2)); // ERROR, need extension
}
#if defined GL_OES_shader_multisample_interpolation
#extension GL_OES_shader_multisample_interpolation : enable
#endif
sample in vec4 colorSampIn;
sample out vec4 colorSampleBad; // ERROR
flat sample in vec4 colorfsi;
sample in vec3 sampInArray[4];
void interp()
{
float res;
vec2 res2;
vec3 res3;
vec4 res4;
res2 = interpolateAtCentroid(colorfc);
res4 = interpolateAtCentroid(colorSampIn);
res4 = interpolateAtCentroid(colorfsi);
res = interpolateAtCentroid(scalarIn);
res3 = interpolateAtCentroid(sampInArray); // ERROR
res3 = interpolateAtCentroid(sampInArray[2]);
res2 = interpolateAtCentroid(sampInArray[2].xy); // ERROR
res3 = interpolateAtSample(sampInArray, 1); // ERROR
res3 = interpolateAtSample(sampInArray[i], 0);
res2 = interpolateAtSample(sampInArray[2].xy, 2); // ERROR
res = interpolateAtSample(scalarIn, 1);
res3 = interpolateAtOffset(sampInArray, vec2(0.2)); // ERROR
res3 = interpolateAtOffset(sampInArray[2], vec2(0.2));
res2 = interpolateAtOffset(sampInArray[2].xy, vec2(0.2)); // ERROR, no swizzle
res = interpolateAtOffset(scalarIn + scalarIn, vec2(0.2)); // ERROR, no binary ops other than dereference
res = interpolateAtOffset(scalarIn, vec2(0.2));
float f;
res = interpolateAtCentroid(f); // ERROR, not interpolant
res4 = interpolateAtSample(outp, 0); // ERROR, not interpolant
}
layout(blend_support_softlight) out; // ERROR, need extension
#ifdef GL_KHR_blend_equation_advanced
#extension GL_KHR_blend_equation_advanced : enable
#endif
layout(blend_support_multiply) out;
layout(blend_support_screen) out;
layout(blend_support_overlay) out;
layout(blend_support_darken, blend_support_lighten) out;
layout(blend_support_colordodge) layout(blend_support_colorburn) out;
layout(blend_support_hardlight) out;
layout(blend_support_softlight) out;
layout(blend_support_difference) out;
layout(blend_support_exclusion) out;
layout(blend_support_hsl_hue) out;
layout(blend_support_hsl_saturation) out;
layout(blend_support_hsl_color) out;
layout(blend_support_hsl_luminosity) out;
layout(blend_support_all_equations) out;
layout(blend_support_hsl_luminosity) out; // okay to repeat
layout(blend_support_hsl_luminosity) in; // ERROR, only on "out"
layout(blend_support_hsl_luminosity) out vec4; // ERROR, only on standalone
layout(blend_support_hsl_luminosity) out vec4 badout; // ERROR, only on standalone
layout(blend_support_hsl_luminosity) struct badS {int i;}; // ERROR, only on standalone
layout(blend_support_hsl_luminosity) void blendFoo() { } // ERROR, only on standalone
void blendFoo(layout(blend_support_hsl_luminosity) vec3 v) { } // ERROR, only on standalone
layout(blend_support_flizbit) out; // ERROR, no flizbit
out vec4 outAA[2][2]; // ERROR
void devi()
{
gl_DeviceIndex; // ERROR, no extension
gl_ViewIndex; // ERROR, no extension
}
#ifdef GL_EXT_device_group
#extension GL_EXT_device_group : enable
#endif
#ifdef GL_EXT_device_group
#extension GL_EXT_multiview : enable
#endif
void devie()
{
gl_DeviceIndex;
gl_ViewIndex;
}

152
deps/glslang/glslang/Test/310.geom vendored Normal file
View File

@ -0,0 +1,152 @@
#version 310 es
#ifdef GL_EXT_geometry_shader
#extension GL_EXT_geometry_shader : enable
#else
#error no GL_EXT_geometry_shader
#endif
#ifndef GL_OES_geometry_shader
#error no GL_OES_geometry_shader
#endif
precision mediump float;
in fromVertex {
in vec3 color;
} fromV[];
in vec4 nonBlockUnsized[];
out toFragment {
out vec3 color;
} toF;
out fromVertex { // okay to reuse a block name for another block name
vec3 color;
};
out fooB { // ERROR, cannot reuse block name as block instance
vec2 color;
} fromVertex;
int fromVertex; // ERROR, cannot reuse a block name for something else
out fooC { // ERROR, cannot have same name for block and instance name
vec2 color;
} fooC;
void main()
{
EmitVertex();
EndPrimitive();
EmitStreamVertex(1); // ERROR
EndStreamPrimitive(0); // ERROR
color = fromV[0].color;
gl_ClipDistance[3] = // ERROR, no ClipDistance
gl_in[1].gl_ClipDistance[2]; // ERROR, no ClipDistance
gl_Position = gl_in[0].gl_Position;
gl_PrimitiveID = gl_PrimitiveIDIn;
gl_Layer = 2;
}
layout(stream = 4) out vec4 ov4; // ERROR, no streams
layout(line_strip, points, triangle_strip, points, triangle_strip) out; // just means triangle_strip"
out ooutb { vec4 a; } ouuaa6;
layout(max_vertices = 200) out;
layout(max_vertices = 300) out; // ERROR, too big
void foo(layout(max_vertices = 4) int a) // ERROR
{
ouuaa6.a = vec4(1.0);
}
layout(line_strip, points, triangle_strip, points) out; // ERROR, changing output primitive
layout(line_strip, points) out; // ERROR, changing output primitive
layout(triangle_strip) in; // ERROR, not an input primitive
layout(triangle_strip) uniform; // ERROR
layout(triangle_strip) out vec4 badv4; // ERROR, not on a variable
layout(triangle_strip) in vec4 bad2v4[]; // ERROR, not on a variable or input
layout(invocations = 3) out outbn { int a; }; // 2 ERROR, not on a block, not until 4.0
out outbn2 {
layout(invocations = 3) int a; // 2 ERRORs, not on a block member, not until 4.0
layout(max_vertices = 3) int b; // ERROR, not on a block member
layout(triangle_strip) int c; // ERROR, not on a block member
} outbi;
layout(lines) out; // ERROR, not on output
layout(lines_adjacency) in;
layout(triangles) in; // ERROR, can't change it
layout(triangles_adjacency) in; // ERROR, can't change it
layout(invocations = 4) in;
in sameName {
int a15;
} insn[];
out sameName {
float f15;
};
uniform sameName {
bool b15;
};
const int summ = gl_MaxVertexAttribs +
gl_MaxGeometryInputComponents +
gl_MaxGeometryOutputComponents +
gl_MaxGeometryImageUniforms +
gl_MaxGeometryTextureImageUnits +
gl_MaxGeometryOutputVertices +
gl_MaxGeometryTotalOutputComponents +
gl_MaxGeometryUniformComponents +
gl_MaxGeometryAtomicCounters +
gl_MaxGeometryAtomicCounterBuffers +
gl_MaxVertexTextureImageUnits +
gl_MaxCombinedTextureImageUnits +
gl_MaxTextureImageUnits +
gl_MaxDrawBuffers;
void fooe1()
{
gl_ViewportIndex; // ERROR, not in ES
gl_MaxViewports; // ERROR, not in ES
insn.length(); // 4: lines_adjacency
int inv = gl_InvocationID;
}
in vec4 explArray[4];
in vec4 explArrayBad[5]; // ERROR, wrong size
in vec4 nonArrayed; // ERROR, not an array
flat out vec3 myColor1;
centroid out vec3 myColor2;
centroid in vec3 centr[];
sample out vec4 perSampleColor; // ERROR without sample extensions
layout(max_vertices = 200) out; // matching redecl
layout(location = 7, component = 2) in float comp[]; // ERROR, es has no component
void notHere()
{
gl_MaxGeometryVaryingComponents; // ERROR, not in ES
gl_VerticesIn; // ERROR, not in ES
}
void pointSize1()
{
highp float ps = gl_in[3].gl_PointSize; // ERROR, need point_size extension
gl_PointSize = ps; // ERROR, need point_size extension
}
#extension GL_OES_geometry_point_size : enable
void pointSize2()
{
highp float ps = gl_in[3].gl_PointSize;
gl_PointSize = ps;
}

169
deps/glslang/glslang/Test/310.tesc vendored Normal file
View File

@ -0,0 +1,169 @@
#version 310 es
#extension GL_OES_tessellation_shader : enable
layout(vertices = 4) out;
out int outa[gl_out.length()];
layout(quads) in; // ERROR
layout(ccw) out; // ERROR
layout(fractional_even_spacing) in; // ERROR
patch in vec4 patchIn; // ERROR
patch out vec4 patchOut;
void main()
{
barrier();
int a = gl_MaxTessControlInputComponents +
gl_MaxTessControlOutputComponents +
gl_MaxTessControlTextureImageUnits +
gl_MaxTessControlUniformComponents +
gl_MaxTessControlTotalOutputComponents;
vec4 p = gl_in[1].gl_Position;
float ps = gl_in[1].gl_PointSize; // ERROR, need point_size extension
float cd = gl_in[1].gl_ClipDistance[2]; // ERROR, not in ES
int pvi = gl_PatchVerticesIn;
int pid = gl_PrimitiveID;
int iid = gl_InvocationID;
gl_out[gl_InvocationID].gl_Position = p;
gl_out[gl_InvocationID].gl_PointSize = ps; // ERROR, need point_size extension
gl_out[gl_InvocationID].gl_ClipDistance[1] = cd; // ERROR, not in ES
gl_TessLevelOuter[3] = 3.2;
gl_TessLevelInner[1] = 1.3;
if (a > 10)
barrier(); // ERROR
else
barrier(); // ERROR
barrier();
do {
barrier(); // ERROR
} while (a > 10);
switch (a) {
default:
barrier(); // ERROR
break;
}
a < 12 ? a : (barrier(), a); // ERROR
{
barrier();
}
return;
barrier(); // ERROR
}
layout(vertices = 4) in; // ERROR, not on in
layout(vertices = 5) out; // ERROR, changing #
void foo()
{
gl_out[4].gl_Position; // ERROR, out of range
barrier(); // ERROR, not in main
}
in vec2 ina; // ERROR, not array
in vec2 inb[];
in vec2 inc[18]; // ERROR, wrong size
in vec2 ind[gl_MaxPatchVertices];
patch out float implA[]; // ERROR, not sized
#extension GL_ARB_separate_shader_objects : enable
layout(location = 3) in vec4 ivla[];
layout(location = 4) in vec4 ivlb[];
layout(location = 4) in vec4 ivlc[]; // ERROR, overlapping
layout(location = 3) out vec4 ovla[];
layout(location = 4) out vec4 ovlb[];
layout(location = 4) out vec4 ovlc[]; // ERROR, overlapping
void foop()
{
precise float d; // ERROR without gpu_shader5
d = fma(d, d, d); // ERROR without gpu_shader5
}
patch out pinbn {
int a;
} pinbi;
centroid out vec3 myColor2[];
centroid in vec3 centr[];
sample out vec4 perSampleColor[]; // ERROR without sample extensions
layout(vertices = 4) out float badlay[]; // ERROR, not on a variable
out float misSized[5]; // ERROR, size doesn't match
out float okaySize[4];
#extension GL_OES_tessellation_point_size : enable
void pointSize2()
{
float ps = gl_in[1].gl_PointSize;
gl_out[gl_InvocationID].gl_PointSize = ps;
}
#extension GL_OES_gpu_shader5 : enable
precise vec3 pv3;
void goodfoop()
{
precise float d;
pv3 *= pv3;
pv3 = fma(pv3, pv3, pv3);
d = fma(d, d, d);
}
void bbBad()
{
gl_BoundingBoxOES; // ERROR without GL_OES_primitive_bounding_box
}
#extension GL_OES_primitive_bounding_box : enable
void bb()
{
gl_BoundingBoxOES[0] = vec4(0.0);
gl_BoundingBoxOES[1] = vec4(1.0);
gl_BoundingBoxOES[2] = vec4(2.0); // ERROR, overflow
}
out patch badpatchBName { // ERROR, array size required
float f;
} badpatchIName[];
out patch patchBName {
float f;
} patchIName[4];
void outputtingOutparam(out int a)
{
a = 2;
}
void outputting()
{
outa[gl_InvocationID] = 2;
outa[1] = 2; // ERROR, not gl_InvocationID
gl_out[0].gl_Position = vec4(1.0); // ERROR, not gl_InvocationID
outa[1];
gl_out[0];
outputtingOutparam(outa[0]); // ERROR, not gl_InvocationID
outputtingOutparam(outa[gl_InvocationID]);
patchIName[1].f = 3.14;
outa[(gl_InvocationID)] = 2;
}

128
deps/glslang/glslang/Test/310.tese vendored Normal file
View File

@ -0,0 +1,128 @@
#version 310 es
#extension GL_EXT_tessellation_shader : enable
#extension GL_OES_tessellation_shader : enable
#extension GL_EXT_tessellation_shader : disable
layout(vertices = 4) out; // ERROR
layout(quads, cw) in;
layout(triangles) in; // ERROR
layout(isolines) in; // ERROR
layout(ccw) in; // ERROR
layout(cw) in;
layout(fractional_odd_spacing) in;
layout(equal_spacing) in; // ERROR
layout(fractional_even_spacing) in; // ERROR
layout(point_mode) in;
patch in vec4 patchIn;
patch out vec4 patchOut; // ERROR
void main()
{
barrier(); // ERROR
int a = gl_MaxTessEvaluationInputComponents +
gl_MaxTessEvaluationOutputComponents +
gl_MaxTessEvaluationTextureImageUnits +
gl_MaxTessEvaluationUniformComponents +
gl_MaxTessPatchComponents +
gl_MaxPatchVertices +
gl_MaxTessGenLevel;
vec4 p = gl_in[1].gl_Position;
float ps = gl_in[1].gl_PointSize; // ERROR, need point_size extension
float cd = gl_in[1].gl_ClipDistance[2]; // ERROR, not in ES
int pvi = gl_PatchVerticesIn;
int pid = gl_PrimitiveID;
vec3 tc = gl_TessCoord;
float tlo = gl_TessLevelOuter[3];
float tli = gl_TessLevelInner[1];
gl_Position = p;
gl_PointSize = ps; // ERROR, need point_size extension
gl_ClipDistance[2] = cd; // ERROR, not in ES
}
smooth patch in vec4 badp1; // ERROR
flat patch in vec4 badp2; // ERROR
noperspective patch in vec4 badp3; // ERROR
patch sample in vec3 badp4; // ERROR
#extension GL_ARB_separate_shader_objects : enable
in gl_PerVertex
{
vec4 gl_Position;
} gl_in[];
in gl_PerVertex // ERROR, second redeclaration of gl_in
{
vec4 gl_Position;
} gl_in[];
layout(quads, cw) out; // ERROR
layout(triangles) out; // ERROR
layout(isolines) out; // ERROR
layout(cw) out; // ERROR
layout(fractional_odd_spacing) out; // ERROR
layout(equal_spacing) out; // ERROR
layout(fractional_even_spacing) out; // ERROR
layout(point_mode) out; // ERROR
in vec2 ina; // ERROR, not array
in vec2 inb[];
in vec2 inc[18]; // ERROR, wrong size
in vec2 ind[gl_MaxPatchVertices];
in testbla { // ERROR, not array
int f;
} bla;
in testblb {
int f;
} blb[];
in testblc { // ERROR wrong size
int f;
} blc[18];
in testbld {
int f;
} bld[gl_MaxPatchVertices];
layout(location = 23) in vec4 ivla[];
layout(location = 24) in vec4 ivlb[];
layout(location = 24) in vec4 ivlc[]; // ERROR, overlap
layout(location = 23) out vec4 ovla[2];
layout(location = 24) out vec4 ovlb[2]; // ERROR, overlap
in float gl_TessLevelOuter[4]; // ERROR, can't redeclare
patch in pinbn {
int a;
} pinbi;
centroid out vec3 myColor2;
centroid in vec3 centr[];
sample out vec4 perSampleColor; // ERROR without sample extensions
#extension GL_OES_tessellation_point_size : enable
void pointSize2()
{
float ps = gl_in[1].gl_PointSize; // ERROR, not in the redeclaration, but no error on use of gl_PointSize
gl_PointSize = ps;
}
#extension GL_EXT_primitive_bounding_box : enable
void bbbad()
{
gl_BoundingBoxOES; // ERROR, wrong stage
}

403
deps/glslang/glslang/Test/310.vert vendored Normal file
View File

@ -0,0 +1,403 @@
#version 310 es
shared vec4 s; // ERROR
layout(local_size_x = 2) out; // ERROR
buffer vec4 v; // ERROR
in int ini;
layout(location = 2) uniform mat4 x;
layout(location = 3) uniform mat4 y;
layout(location = 2) out mat4 xi;
layout(location = 3) out mat4 yi; // ERROR, locations conflict with xi
void main()
{
uvec2 u2;
u2 = uaddCarry(u2, u2, u2);
uint u1;
u1 = usubBorrow(u1, u1, u1);
uvec4 u4;
umulExtended(u4, u4, u4, u4);
ivec4 i4;
imulExtended(i4, i4, i4, i4);
int i1;
i1 = bitfieldExtract(i1, 4, 5);
uvec3 u3;
u3 = bitfieldExtract(u3, 4, 5);
ivec3 i3;
i3 = bitfieldInsert(i3, i3, 4, 5);
u1 = bitfieldInsert(u1, u1, 4, 5);
ivec2 i2;
i2 = bitfieldReverse(i2);
u4 = bitfieldReverse(u4);
i1 = bitCount(i1);
i3 = bitCount(u3);
i2 = findLSB(i2);
i4 = findLSB(u4);
i1 = findMSB(i1);
i2 = findMSB(u2);
vec3 v3;
v3 = frexp(v3, i3);
vec2 v2;
v2 = ldexp(v2, i2);
mediump vec4 v4;
u1 = packUnorm4x8(v4);
u1 = packSnorm4x8(v4);
v4 = unpackUnorm4x8(u1);
v4 = unpackSnorm4x8(u1);
}
precision highp sampler2DMS;
precision highp isampler2DMS;
precision highp usampler2DMS;
uniform sampler2DMS s2dms;
uniform isampler2DMS is2dms;
uniform usampler2DMS us2dms;
uniform usampler2DMSArray us2dmsa; // ERROR
void foo()
{
ivec2 v2;
v2 = textureSize(s2dms);
v2 = textureSize(us2dms);
vec4 v4 = texelFetch(s2dms, v2, 2);
ivec4 iv4 = texelFetch(is2dms, v2, 2);
textureSamples(s2dms); // ERROR
float f;
frexp(f, ini); // ERROR, i not writable
}
out bool outb; // ERROR
out sampler2D outo; // ERROR
out float outa[4];
out float outaa[4][2]; // ERROR
struct S { float f; };
out S outs;
out S[4] outasa; // ERROR
out S outsa[4]; // ERROR
struct SA { float f[4]; };
out SA outSA; // ERROR
struct SS { float f; S s; };
out SS outSS; // ERROR
layout(std430) uniform U430 { int a; } U430i; // ERROR
layout(std430) buffer B430 { int a; } B430i;
#ifndef GL_OES_shader_io_blocks
#error GL_OES_shader_io_blocks not defined
#endif
#extension GL_OES_shader_io_blocks : enable
out outbname {
int a;
out vec4 v;
highp sampler2D s; // ERROR, opaque type
} outbinst;
out outbname2 {
layout(location = 12) int aAnon;
layout(location = 13) vec4 vAnon;
};
layout(location = 12) out highp int aliased; // ERROR, aliasing location
in inbname { int a; } inbinst; // ERROR, no in block in vertex shader
out gl_PerVertex { // ERROR, has extra member
highp vec4 gl_Position;
highp vec4 t;
};
void foo_IO()
{
int sum = gl_VertexID +
gl_InstanceID;
gl_Position = vec4(1.0);
gl_PointSize = 2.0; // ERROR, removed by redeclaration
}
out gl_PerVertex { // ERROR, already used and already redeclared
highp vec4 gl_Position;
highp vec4 t;
};
smooth out smo { // ERROR, no smooth on a block
int i;
} smon;
flat out fmo { // ERROR, no flat on a block
int i;
} fmon;
centroid out cmo { // ERROR, no centroid on a block
int i;
} cmon;
invariant out imo { // ERROR, no invariant on a block
int i;
} imon;
in vec2 inf, ing;
uniform ivec2 offsets[4];
uniform sampler2D sArray[4];
uniform int sIndex;
layout(binding = 0) uniform atomic_uint auArray[2];
uniform ubName { int i; } ubInst[4];
buffer bbName { int i; } bbInst[4];
highp uniform writeonly image2D iArray[5];
const ivec2 constOffsets[4] = ivec2[4](ivec2(0.1), ivec2(0.2), ivec2(0.3), ivec2(0.4));
void pfooBad()
{
precise vec2 h; // ERROR reserved
h = fma(inf, ing, h); // ERROR, not available
sArray[sIndex + 1]; // ERRRO, not supported
auArray[sIndex + 1];
ubInst[1];
bbInst[2];
ubInst[sIndex + 1]; // ERROR, not supported
bbInst[sIndex]; // ERROR, not supported
iArray[2];
iArray[sIndex * 2]; // ERROR, not supported
textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf)); // ERROR, offset not constant
textureGatherOffsets(sArray[0], vec2(0.1), constOffsets); // ERROR, not available
}
#extension GL_OES_gpu_shader5 : enable
void pfoo()
{
precise vec2 h;
h = fma(inf, ing, h);
sArray[sIndex + 1];
ubInst[sIndex + 1];
bbInst[sIndex - 2]; // ERROR, still not supported
iArray[2];
iArray[sIndex - 2];
textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf));
textureGatherOffsets(sArray[0], vec2(0.1), constOffsets);
textureGatherOffsets(sArray[0], vec2(0.1), offsets); // ERROR, offset not constant
}
uniform samplerBuffer badSamp1; // ERROR, reserved
uniform isamplerBuffer badSamp2; // ERROR, reserved
uniform usamplerBuffer badSamp3; // ERROR, reserved
uniform writeonly imageBuffer badSamp4; // ERROR, reserved
uniform writeonly iimageBuffer badSamp5; // ERROR, reserved
uniform writeonly uimageBuffer badSamp6; // ERROR, reserved
#extension GL_OES_texture_buffer : enable
#extension GL_EXT_texture_buffer : enable
uniform samplerBuffer noPreSamp1; // ERROR, no default precision
uniform isamplerBuffer noPreSamp2; // ERROR, no default precision
uniform usamplerBuffer noPreSamp3; // ERROR, no default precision
uniform writeonly imageBuffer noPreSamp4; // ERROR, no default precision
uniform writeonly iimageBuffer noPreSamp5; // ERROR, no default precision
uniform writeonly uimageBuffer noPreSamp6; // ERROR, no default precision
precision highp samplerBuffer;
precision highp isamplerBuffer;
precision highp usamplerBuffer;
precision highp imageBuffer;
precision highp iimageBuffer;
precision highp uimageBuffer;
#ifdef GL_OES_texture_buffer
uniform samplerBuffer bufSamp1;
uniform isamplerBuffer bufSamp2;
uniform usamplerBuffer bufSamp3;
#endif
#ifdef GL_EXT_texture_buffer
uniform writeonly imageBuffer bufSamp4;
uniform writeonly iimageBuffer bufSamp5;
uniform writeonly uimageBuffer bufSamp6;
#endif
void bufferT()
{
highp int s1 = textureSize(bufSamp1);
highp int s2 = textureSize(bufSamp2);
highp int s3 = textureSize(bufSamp3);
highp int s4 = imageSize(bufSamp4);
highp int s5 = imageSize(bufSamp5);
highp int s6 = imageSize(bufSamp6);
highp vec4 f1 = texelFetch(bufSamp1, s1);
highp ivec4 f2 = texelFetch(bufSamp2, s2);
highp uvec4 f3 = texelFetch(bufSamp3, s3);
}
uniform writeonly imageCubeArray badCA1; // ERROR, reserved
uniform writeonly iimageCubeArray badCA2; // ERROR, reserved
uniform writeonly uimageCubeArray badCA3; // ERROR, reserved
uniform samplerCubeArray badCA4; // ERROR, reserved
uniform samplerCubeArrayShadow badCA5; // ERROR, reserved
uniform isamplerCubeArray badCA6; // ERROR, reserved
uniform usamplerCubeArray badCA7; // ERROR, reserved
#extension GL_OES_texture_cube_map_array : enable
uniform writeonly imageCubeArray noPreCA1; // ERROR, no default precision
uniform writeonly iimageCubeArray noPreCA2; // ERROR, no default precision
uniform writeonly uimageCubeArray noPreCA3; // ERROR, no default precision
uniform samplerCubeArray noPreCA4; // ERROR, no default precision
uniform samplerCubeArrayShadow noPreCA5; // ERROR, no default precision
uniform isamplerCubeArray noPreCA6; // ERROR, no default precision
uniform usamplerCubeArray noPreCA7; // ERROR, no default precision
precision highp imageCubeArray ;
precision highp iimageCubeArray ;
precision highp uimageCubeArray ;
precision highp samplerCubeArray ;
precision highp samplerCubeArrayShadow;
precision highp isamplerCubeArray ;
precision highp usamplerCubeArray ;
uniform writeonly imageCubeArray CA1;
uniform writeonly iimageCubeArray CA2;
uniform writeonly uimageCubeArray CA3;
layout(rgba16f) uniform readonly imageCubeArray rCA1;
layout(rgba32i) uniform readonly iimageCubeArray rCA2;
layout(r32ui) uniform readonly uimageCubeArray rCA3;
#ifdef GL_OES_texture_cube_map_array
uniform samplerCubeArray CA4;
uniform samplerCubeArrayShadow CA5;
uniform isamplerCubeArray CA6;
uniform usamplerCubeArray CA7;
#endif
void CAT()
{
highp ivec3 s4 = textureSize(CA4, 1);
highp ivec3 s5 = textureSize(CA5, 1);
highp ivec3 s6 = textureSize(CA6, 1);
highp ivec3 s7 = textureSize(CA7, 1);
highp vec4 t4 = texture(CA4, vec4(0.5));
highp float t5 = texture(CA5, vec4(0.5), 3.0);
highp ivec4 t6 = texture(CA6, vec4(0.5));
highp uvec4 t7 = texture(CA7, vec4(0.5));
highp vec4 L4 = textureLod(CA4, vec4(0.5), 0.24);
highp ivec4 L6 = textureLod(CA6, vec4(0.5), 0.26);
highp uvec4 L7 = textureLod(CA7, vec4(0.5), 0.27);
highp vec4 g4 = textureGrad(CA4, vec4(0.5), vec3(0.1), vec3(0.2));
highp ivec4 g6 = textureGrad(CA6, vec4(0.5), vec3(0.1), vec3(0.2));
highp uvec4 g7 = textureGrad(CA7, vec4(0.5), vec3(0.1), vec3(0.2));
highp vec4 gath4 = textureGather(CA4, vec4(0.5));
highp vec4 gathC4 = textureGather(CA4, vec4(0.5), 2);
highp ivec4 gath6 = textureGather(CA6, vec4(0.5));
highp ivec4 gathC6 = textureGather(CA6, vec4(0.5), 1);
highp uvec4 gath7 = textureGather(CA7, vec4(0.5));
highp uvec4 gathC7 = textureGather(CA7, vec4(0.5), 0);
highp vec4 gath5 = textureGather(CA5, vec4(0.5), 2.5);
highp ivec3 s1 = imageSize(CA1);
highp ivec3 s2 = imageSize(CA2);
highp ivec3 s3 = imageSize(CA3);
imageStore(CA1, s3, vec4(1));
imageStore(CA2, s3, ivec4(1));
imageStore(CA3, s3, uvec4(1));
highp vec4 cl1 = imageLoad(rCA1, s3);
highp ivec4 cl2 = imageLoad(rCA2, s3);
highp uvec4 cl3 = imageLoad(rCA3, s3);
}
uniform sampler2DMSArray bad2DMS; // ERROR, reserved
uniform isampler2DMSArray bad2DMSi; // ERROR, reserved
uniform usampler2DMSArray bad2DMSu; // ERROR, reserved
#extension GL_OES_texture_storage_multisample_2d_array : enable
#ifdef GL_OES_texture_storage_multisample_2d_array
uniform sampler2DMSArray noPrec2DMS; // ERROR, no default
uniform isampler2DMSArray noPrec2DMSi; // ERROR, no default
uniform usampler2DMSArray noPrec2DMSu; // ERROR, no default
#endif
precision highp sampler2DMSArray;
precision highp isampler2DMSArray;
precision highp usampler2DMSArray;
uniform sampler2DMSArray samp2DMSA;
uniform isampler2DMSArray samp2DMSAi;
uniform usampler2DMSArray samp2DMSAu;
void MSA()
{
vec4 tf = texelFetch(samp2DMSA, ivec3(5), 2);
ivec4 tfi = texelFetch(samp2DMSAi, ivec3(5), 2);
uvec4 tfu = texelFetch(samp2DMSAu, ivec3(5), 2);
ivec3 tfs = textureSize(samp2DMSA);
ivec3 tfsi = textureSize(samp2DMSAi);
ivec3 tfsb = textureSize(samp2DMSAi, 4); // ERROR, no lod
ivec3 tfsu = textureSize(samp2DMSAu);
}
#ifdef GL_OES_shader_image_atomic
#extension GL_OES_shader_image_atomic : enable
#endif
uniform layout(r32f) highp image2D im2Df;
uniform layout(r32ui) highp uimage2D im2Du;
uniform layout(r32i) highp iimage2D im2Di;
uniform ivec2 P;
void goodImageAtom()
{
float datf;
int dati;
uint datu;
imageAtomicAdd( im2Di, P, dati);
imageAtomicAdd( im2Du, P, datu);
imageAtomicMin( im2Di, P, dati);
imageAtomicMin( im2Du, P, datu);
imageAtomicMax( im2Di, P, dati);
imageAtomicMax( im2Du, P, datu);
imageAtomicAnd( im2Di, P, dati);
imageAtomicAnd( im2Du, P, datu);
imageAtomicOr( im2Di, P, dati);
imageAtomicOr( im2Du, P, datu);
imageAtomicXor( im2Di, P, dati);
imageAtomicXor( im2Du, P, datu);
imageAtomicExchange(im2Di, P, dati);
imageAtomicExchange(im2Du, P, datu);
imageAtomicExchange(im2Df, P, datf);
imageAtomicCompSwap(im2Di, P, 3, dati);
imageAtomicCompSwap(im2Du, P, 5u, datu);
}
sample out vec4 colorSampInBad; // ERROR, reserved
#extension GL_OES_shader_multisample_interpolation : enable
sample out vec4 colorSample;
flat sample out vec4 colorfsi;
sample out vec3 sampInArray[4];
in vec4 inv4;
void badInterp()
{
interpolateAtCentroid(inv4); // ERROR, wrong stage
interpolateAtSample(inv4, 1); // ERROR, need extension
interpolateAtOffset(inv4, vec2(0.2)); // ERROR, need extension
}

121
deps/glslang/glslang/Test/310AofA.vert vendored Normal file
View File

@ -0,0 +1,121 @@
#version 310 es
// Check name mangling of functions with parameters that are multi-dimensional arrays.
#define NX 2
#define NY 3
#define NZ 4
void f(bool a, float b, uint[4] c, int[NY][NX] d) {
}
void main() {
int[NY][NX] d;
f(false, 12.1, uint[NZ](uint(0),uint(1),uint(1),uint(2)), d);
}
buffer b {
float u[]; // ERROR
vec4 v[];
} name[3];
uniform ub {
float u;
vec4 v[]; // ERROR
} uname[3];
buffer b2 {
float u;
vec4 v[][]; // ERROR
} name2[3];
buffer b3 {
float u;
vec4 v[][7];
} name3[3];
// General arrays of arrays
float[4][5][6] many[1][2][3];
float gu[][7]; // ERROR, size required
float g4[4][7];
float g5[5][7];
float[4][7] foo(float a[5][7])
{
float r[7];
r = a[2];
float[](a[0], a[1], r, a[3]); // ERROR, too few dims
float[4][7][4](a[0], a[1], r, a[3]); // ERROR, too many dims
return float[4][7](a[0], a[1], r, a[3]);
return float[][](a[0], a[1], r, a[3]);
return float[][7](a[0], a[1], a[2], a[3]);
}
void bar(float[5][7]) {}
void foo2()
{
{
float gu[3][4][2];
gu[2][4][1] = 4.0; // ERROR, overflow
}
vec4 ca4[3][2] = vec4[][](vec4[2](vec4(0.0), vec4(1.0)),
vec4[2](vec4(0.0), vec4(1.0)),
vec4[2](vec4(0.0), vec4(1.0)));
vec4 caim[][2] = vec4[][](vec4[2](vec4(4.0), vec4(2.0)),
vec4[2](vec4(4.0), vec4(2.0)),
vec4[2](vec4(4.0), vec4(2.0)));
vec4 caim2[][] = vec4[][](vec4[2](vec4(4.0), vec4(2.0)),
vec4[2](vec4(4.0), vec4(2.0)),
vec4[2](vec4(4.0), vec4(2.0)));
vec4 caim3[3][] = vec4[][](vec4[2](vec4(4.0), vec4(2.0)),
vec4[2](vec4(4.0), vec4(2.0)),
vec4[2](vec4(4.0), vec4(2.0)));
g4 = foo(g5);
g5 = g4; // ERROR, wrong types
gu = g4; // ERROR, not yet sized
foo(gu); // ERROR, not yet sized
bar(g5);
if (foo(g5) == g4)
;
if (foo(g5) == g5) // ERROR, different types
;
float u[5][7];
u[5][2] = 5.0; // ERROR
foo(u);
vec4 badAss[3];
name[1].v[-1]; // ERROR
name[1].v[1] = vec4(4.3);
name[1].v = badAss; // ERROR, bad assignemnt
name3[0].v[1].length(); // 7
name3[0].v.length(); // run time
}
struct badS {
int sa[]; // ERROR
int a[][]; // ERROR
int b[][2]; // ERROR
int c[2][]; // ERROR
int d[][4]; // ERROR
};
in float inArray[2][3]; // ERROR
out float outArray[2][3]; // ERROR
uniform ubaa {
int a;
} ubaaname[2][3]; // ERROR
vec3 func(in mat3[2] x[3])
{
mat3 a0 = x[2][1];
return a0[2];
}

View File

@ -0,0 +1,8 @@
#version 310 es
layout (binding=0) uniform Block {
highp int a[];
} uni;
layout (location=0) out highp int o;
void main() {
o = uni.a[2];
}

View File

@ -0,0 +1,18 @@
#version 310 es
precision highp float;
layout(location=0) out float o;
struct S { float f; };
buffer b1 { S s[]; };
buffer b2 { S s[]; } b2name;
buffer b3 { S s[]; } b3name[];
buffer b4 { S s[]; } b4name[4];
void main()
{
o = s[5].f;
o += b2name.s[6].f;
o += b3name[3].s[7].f;
o += b4name[2].s[8].f;
}

5
deps/glslang/glslang/Test/320.comp vendored Normal file
View File

@ -0,0 +1,5 @@
#version 320 es
void main()
{
}

225
deps/glslang/glslang/Test/320.frag vendored Normal file
View File

@ -0,0 +1,225 @@
#version 320 es
out outbname { int a; } outbinst; // ERROR, not out block in fragment shader
in inbname {
int a;
vec4 v;
struct { int b; } s; // ERROR, nested struct definition
} inbinst;
in inbname2 {
layout(location = 12) int aAnon;
layout(location = 13) centroid in vec4 vAnon;
};
in layout(location = 13) vec4 aliased; // ERROR, aliased
in inbname2 { // ERROR, reuse of block name
int aAnon;
centroid in vec4 vAnon;
};
in badmember { // ERROR, aAnon already in global scope
int aAnon;
};
int inbname; // ERROR, redefinition of block name
vec4 vAnon; // ERROR, anon in global scope; redefinition
in arrayed {
float f;
} arrayedInst[4];
uniform int i;
void fooIO()
{
vec4 v = inbinst.v + vAnon;
v *= arrayedInst[2].f;
v *= arrayedInst[i].f;
}
in vec4 gl_FragCoord;
layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; // ERROR, non-ES
layout(early_fragment_tests) in;
out float gl_FragDepth;
layout(depth_any) out float gl_FragDepth; // ERROR, non-ES
void main()
{
gl_FragDepth = 0.2; // ERROR, early_fragment_tests declared
bool f = gl_FrontFacing;
}
out float gl_FragDepth;
void foo_GS()
{
highp int l = gl_Layer;
highp int p = gl_PrimitiveID;
}
in vec2 inf, ing;
uniform ivec2 offsets[4];
uniform sampler2D sArray[4];
uniform int sIndex;
layout(binding = 0) uniform atomic_uint auArray[2];
uniform ubName { int i; } ubInst[4];
buffer bbName { int i; } bbInst[4];
highp uniform writeonly image2D iArray[5];
const ivec2 constOffsets[4] = ivec2[4](ivec2(0.1), ivec2(0.2), ivec2(0.3), ivec2(0.4));
void pfoo()
{
precise vec2 h;
h = fma(inf, ing, h);
textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf));
textureGatherOffsets(sArray[0], vec2(0.1), constOffsets);
textureGatherOffsets(sArray[0], vec2(0.1), offsets); // ERROR, offset not constant
}
precision highp imageCubeArray ;
precision highp iimageCubeArray ;
precision highp uimageCubeArray ;
precision highp samplerCubeArray ;
precision highp samplerCubeArrayShadow;
precision highp isamplerCubeArray ;
precision highp usamplerCubeArray ;
uniform writeonly imageCubeArray CA1;
uniform writeonly iimageCubeArray CA2;
uniform writeonly uimageCubeArray CA3;
#ifdef GL_EXT_texture_cube_map_array
uniform samplerCubeArray CA4;
uniform samplerCubeArrayShadow CA5;
uniform isamplerCubeArray CA6;
uniform usamplerCubeArray CA7;
#endif
void CAT()
{
highp vec4 b4 = texture(CA4, vec4(0.5), 0.24);
highp ivec4 b6 = texture(CA6, vec4(0.5), 0.26);
highp uvec4 b7 = texture(CA7, vec4(0.5), 0.27);
}
void goodSample()
{
lowp int a1 = gl_SampleID;
mediump vec2 a2 = gl_SamplePosition;
highp int a3 = gl_SampleMaskIn[0];
gl_SampleMask[0] = a3;
mediump int n1 = gl_MaxSamples;
mediump int n2 = gl_NumSamples;
}
uniform layout(r32f) highp image2D im2Df;
uniform layout(r32ui) highp uimage2D im2Du;
uniform layout(r32i) highp iimage2D im2Di;
uniform ivec2 P;
uniform layout(rgba32f) highp image2D badIm2Df; // ERROR, needs readonly or writeonly
uniform layout(rgba8ui) highp uimage2D badIm2Du; // ERROR, needs readonly or writeonly
uniform layout(rgba16i) highp iimage2D badIm2Di; // ERROR, needs readonly or writeonly
void goodImageAtom()
{
float datf;
int dati;
uint datu;
imageAtomicAdd( im2Di, P, dati);
imageAtomicAdd( im2Du, P, datu);
imageAtomicMin( im2Di, P, dati);
imageAtomicMin( im2Du, P, datu);
imageAtomicMax( im2Di, P, dati);
imageAtomicMax( im2Du, P, datu);
imageAtomicAnd( im2Di, P, dati);
imageAtomicAnd( im2Du, P, datu);
imageAtomicOr( im2Di, P, dati);
imageAtomicOr( im2Du, P, datu);
imageAtomicXor( im2Di, P, dati);
imageAtomicXor( im2Du, P, datu);
imageAtomicExchange(im2Di, P, dati);
imageAtomicExchange(im2Du, P, datu);
imageAtomicExchange(im2Df, P, datf);
imageAtomicCompSwap(im2Di, P, 3, dati);
imageAtomicCompSwap(im2Du, P, 5u, datu);
imageAtomicMax(badIm2Di, P, dati); // ERROR, not an allowed layout() on the image
imageAtomicMax(badIm2Du, P, datu); // ERROR, not an allowed layout() on the image
imageAtomicExchange(badIm2Df, P, datf); // ERROR, not an allowed layout() on the image
}
centroid out vec4 colorCentroidBad; // ERROR
flat out vec4 colorBadFlat; // ERROR
smooth out vec4 colorBadSmooth; // ERROR
noperspective out vec4 colorBadNo; // ERROR
flat centroid in vec2 colorfc;
in float scalarIn;
sample in vec4 colorSampIn;
sample out vec4 colorSampleBad; // ERROR
flat sample in vec4 colorfsi;
sample in vec3 sampInArray[4];
void interp()
{
float res;
vec2 res2;
vec3 res3;
vec4 res4;
res2 = interpolateAtCentroid(colorfc);
res4 = interpolateAtCentroid(colorSampIn);
res4 = interpolateAtCentroid(colorfsi);
res = interpolateAtCentroid(scalarIn);
res3 = interpolateAtCentroid(sampInArray); // ERROR
res3 = interpolateAtCentroid(sampInArray[2]);
res2 = interpolateAtCentroid(sampInArray[2].xy); // ERROR
res3 = interpolateAtSample(sampInArray, 1); // ERROR
res3 = interpolateAtSample(sampInArray[i], 0);
res2 = interpolateAtSample(sampInArray[2].xy, 2); // ERROR
res = interpolateAtSample(scalarIn, 1);
res3 = interpolateAtOffset(sampInArray, vec2(0.2)); // ERROR
res3 = interpolateAtOffset(sampInArray[2], vec2(0.2));
res2 = interpolateAtOffset(sampInArray[2].xy, vec2(0.2)); // ERROR, no swizzle
res = interpolateAtOffset(scalarIn + scalarIn, vec2(0.2)); // ERROR, no binary ops other than dereference
res = interpolateAtOffset(scalarIn, vec2(0.2));
float f;
res = interpolateAtCentroid(f); // ERROR, not interpolant
res4 = interpolateAtSample(outp, 0); // ERROR, not interpolant
}
layout(blend_support_multiply) out;
layout(blend_support_screen) out;
layout(blend_support_overlay) out;
layout(blend_support_darken, blend_support_lighten) out;
layout(blend_support_colordodge) layout(blend_support_colorburn) out;
layout(blend_support_hardlight) out;
layout(blend_support_softlight) out;
layout(blend_support_difference) out;
layout(blend_support_exclusion) out;
layout(blend_support_hsl_hue) out;
layout(blend_support_hsl_saturation) out;
layout(blend_support_hsl_color) out;
layout(blend_support_hsl_luminosity) out;
layout(blend_support_all_equations) out;
layout(blend_support_hsl_luminosity) out; // okay to repeat
layout(blend_support_hsl_luminosity) in; // ERROR, only on "out"
layout(blend_support_hsl_luminosity) out vec4; // ERROR, only on standalone
layout(blend_support_hsl_luminosity) out vec4 badout; // ERROR, only on standalone
layout(blend_support_hsl_luminosity) struct badS {int i;}; // ERROR, only on standalone
layout(blend_support_hsl_luminosity) void blendFoo() { } // ERROR, only on standalone
void blendFoo(layout(blend_support_hsl_luminosity) vec3 v) { } // ERROR, only on standalone
layout(blend_support_flizbit) out; // ERROR, no flizbit
out vec4 outAA[2][2]; // ERROR

134
deps/glslang/glslang/Test/320.geom vendored Normal file
View File

@ -0,0 +1,134 @@
#version 320 es
precision mediump float;
in fromVertex {
in vec3 color;
} fromV[];
in vec4 nonBlockUnsized[];
out toFragment {
out vec3 color;
} toF;
out fromVertex { // okay to reuse a block name for another block name
vec3 color;
};
out fooB { // ERROR, cannot reuse block name as block instance
vec2 color;
} fromVertex;
int fromVertex; // ERROR, cannot reuse a block name for something else
out fooC { // ERROR, cannot have same name for block and instance name
vec2 color;
} fooC;
void main()
{
EmitVertex();
EndPrimitive();
EmitStreamVertex(1); // ERROR
EndStreamPrimitive(0); // ERROR
color = fromV[0].color;
gl_ClipDistance[3] = // ERROR, no ClipDistance
gl_in[1].gl_ClipDistance[2]; // ERROR, no ClipDistance
gl_Position = gl_in[0].gl_Position;
gl_PrimitiveID = gl_PrimitiveIDIn;
gl_Layer = 2;
}
layout(stream = 4) out vec4 ov4; // ERROR, no streams
layout(line_strip, points, triangle_strip, points, triangle_strip) out; // just means triangle_strip"
out ooutb { vec4 a; } ouuaa6;
layout(max_vertices = 200) out;
layout(max_vertices = 300) out; // ERROR, too big
void foo(layout(max_vertices = 4) int a) // ERROR
{
ouuaa6.a = vec4(1.0);
}
layout(line_strip, points, triangle_strip, points) out; // ERROR, changing output primitive
layout(line_strip, points) out; // ERROR, changing output primitive
layout(triangle_strip) in; // ERROR, not an input primitive
layout(triangle_strip) uniform; // ERROR
layout(triangle_strip) out vec4 badv4; // ERROR, not on a variable
layout(triangle_strip) in vec4 bad2v4[]; // ERROR, not on a variable or input
layout(invocations = 3) out outbn { int a; }; // 2 ERROR, not on a block, not until 4.0
out outbn2 {
layout(invocations = 3) int a; // 2 ERRORs, not on a block member, not until 4.0
layout(max_vertices = 3) int b; // ERROR, not on a block member
layout(triangle_strip) int c; // ERROR, not on a block member
} outbi;
layout(lines) out; // ERROR, not on output
layout(lines_adjacency) in;
layout(triangles) in; // ERROR, can't change it
layout(triangles_adjacency) in; // ERROR, can't change it
layout(invocations = 4) in;
in sameName {
int a15;
} insn[];
out sameName {
float f15;
};
uniform sameName {
bool b15;
};
const int summ = gl_MaxVertexAttribs +
gl_MaxGeometryInputComponents +
gl_MaxGeometryOutputComponents +
gl_MaxGeometryImageUniforms +
gl_MaxGeometryTextureImageUnits +
gl_MaxGeometryOutputVertices +
gl_MaxGeometryTotalOutputComponents +
gl_MaxGeometryUniformComponents +
gl_MaxGeometryAtomicCounters +
gl_MaxGeometryAtomicCounterBuffers +
gl_MaxVertexTextureImageUnits +
gl_MaxCombinedTextureImageUnits +
gl_MaxTextureImageUnits +
gl_MaxDrawBuffers;
void fooe1()
{
gl_ViewportIndex; // ERROR, not in ES
gl_MaxViewports; // ERROR, not in ES
insn.length(); // 4: lines_adjacency
int inv = gl_InvocationID;
}
in vec4 explArray[4];
in vec4 explArrayBad[5]; // ERROR, wrong size
in vec4 nonArrayed; // ERROR, not an array
flat out vec3 myColor1;
centroid out vec3 myColor2;
centroid in vec3 centr[];
sample out vec4 perSampleColor; // ERROR without sample extensions
layout(max_vertices = 200) out; // matching redecl
layout(location = 7, component = 2) in float comp[]; // ERROR, es has no component
void notHere()
{
gl_MaxGeometryVaryingComponents; // ERROR, not in ES
gl_VerticesIn; // ERROR, not in ES
}
void pointSize2()
{
highp float ps = gl_in[3].gl_PointSize; // ERROR, need extension
gl_PointSize = ps; // ERROR, need extension
}

150
deps/glslang/glslang/Test/320.tesc vendored Normal file
View File

@ -0,0 +1,150 @@
#version 320 es
layout(vertices = 4) out;
out int outa[gl_out.length()];
layout(quads) in; // ERROR
layout(ccw) out; // ERROR
layout(fractional_even_spacing) in; // ERROR
patch in vec4 patchIn; // ERROR
patch out vec4 patchOut;
void main()
{
barrier();
int a = gl_MaxTessControlInputComponents +
gl_MaxTessControlOutputComponents +
gl_MaxTessControlTextureImageUnits +
gl_MaxTessControlUniformComponents +
gl_MaxTessControlTotalOutputComponents;
vec4 p = gl_in[1].gl_Position;
float ps = gl_in[1].gl_PointSize; // ERROR, need point_size extension
float cd = gl_in[1].gl_ClipDistance[2]; // ERROR, not in ES
int pvi = gl_PatchVerticesIn;
int pid = gl_PrimitiveID;
int iid = gl_InvocationID;
gl_out[gl_InvocationID].gl_Position = p;
gl_out[gl_InvocationID].gl_PointSize = ps; // ERROR, need point_size extension
gl_out[gl_InvocationID].gl_ClipDistance[1] = cd; // ERROR, not in ES
gl_TessLevelOuter[3] = 3.2;
gl_TessLevelInner[1] = 1.3;
if (a > 10)
barrier(); // ERROR
else
barrier(); // ERROR
barrier();
do {
barrier(); // ERROR
} while (a > 10);
switch (a) {
default:
barrier(); // ERROR
break;
}
a < 12 ? a : (barrier(), a); // ERROR
{
barrier();
}
return;
barrier(); // ERROR
}
layout(vertices = 4) in; // ERROR, not on in
layout(vertices = 5) out; // ERROR, changing #
void foo()
{
gl_out[4].gl_Position; // ERROR, out of range
barrier(); // ERROR, not in main
}
in vec2 ina; // ERROR, not array
in vec2 inb[];
in vec2 inc[18]; // ERROR, wrong size
in vec2 ind[gl_MaxPatchVertices];
patch out float implA[]; // ERROR, not sized
#extension GL_ARB_separate_shader_objects : enable
layout(location = 3) in vec4 ivla[];
layout(location = 4) in vec4 ivlb[];
layout(location = 4) in vec4 ivlc[]; // ERROR, overlapping
layout(location = 3) out vec4 ovla[];
layout(location = 4) out vec4 ovlb[];
layout(location = 4) out vec4 ovlc[]; // ERROR, overlapping
patch out pinbn {
int a;
} pinbi;
centroid out vec3 myColor2[];
centroid in vec3 centr[];
sample out vec4 perSampleColor[];
layout(vertices = 4) out float badlay[]; // ERROR, not on a variable
out float misSized[5]; // ERROR, size doesn't match
out float okaySize[4];
void pointSize2()
{
float ps = gl_in[1].gl_PointSize; // ERROR, need point_size extension
gl_out[gl_InvocationID].gl_PointSize = ps; // ERROR, need point_size extension
}
precise vec3 pv3;
void goodfoop()
{
precise float d;
pv3 *= pv3;
pv3 = fma(pv3, pv3, pv3);
d = fma(d, d, d);
}
void bb()
{
gl_BoundingBoxOES[0] = vec4(0.0);
gl_BoundingBoxOES[1] = vec4(1.0);
gl_BoundingBoxOES[2] = vec4(2.0); // ERROR, overflow
}
out patch badpatchBName { // ERROR, array size required
float f;
} badpatchIName[];
out patch patchBName {
float f;
} patchIName[4];
void outputtingOutparam(out int a)
{
a = 2;
}
void outputting()
{
outa[gl_InvocationID] = 2;
outa[1] = 2; // ERROR, not gl_InvocationID
gl_out[0].gl_Position = vec4(1.0); // ERROR, not gl_InvocationID
outa[1];
gl_out[0];
outputtingOutparam(outa[0]); // ERROR, not gl_InvocationID
outputtingOutparam(outa[gl_InvocationID]);
patchIName[1].f = 3.14;
outa[(gl_InvocationID)] = 2;
}

114
deps/glslang/glslang/Test/320.tese vendored Normal file
View File

@ -0,0 +1,114 @@
#version 320 es
layout(vertices = 4) out; // ERROR
layout(quads, cw) in;
layout(triangles) in; // ERROR
layout(isolines) in; // ERROR
layout(ccw) in; // ERROR
layout(cw) in;
layout(fractional_odd_spacing) in;
layout(equal_spacing) in; // ERROR
layout(fractional_even_spacing) in; // ERROR
layout(point_mode) in;
patch in vec4 patchIn;
patch out vec4 patchOut; // ERROR
void main()
{
barrier(); // ERROR
int a = gl_MaxTessEvaluationInputComponents +
gl_MaxTessEvaluationOutputComponents +
gl_MaxTessEvaluationTextureImageUnits +
gl_MaxTessEvaluationUniformComponents +
gl_MaxTessPatchComponents +
gl_MaxPatchVertices +
gl_MaxTessGenLevel;
vec4 p = gl_in[1].gl_Position;
float ps = gl_in[1].gl_PointSize; // ERROR, need point_size extension
float cd = gl_in[1].gl_ClipDistance[2]; // ERROR, not in ES
int pvi = gl_PatchVerticesIn;
int pid = gl_PrimitiveID;
vec3 tc = gl_TessCoord;
float tlo = gl_TessLevelOuter[3];
float tli = gl_TessLevelInner[1];
gl_Position = p;
gl_PointSize = ps; // ERROR, need point_size extension
gl_ClipDistance[2] = cd; // ERROR, not in ES
}
smooth patch in vec4 badp1; // ERROR
flat patch in vec4 badp2; // ERROR
noperspective patch in vec4 badp3; // ERROR
patch sample in vec3 badp4; // ERROR
#extension GL_ARB_separate_shader_objects : enable
in gl_PerVertex
{
vec4 gl_Position;
} gl_in[];
in gl_PerVertex // ERROR, second redeclaration of gl_in
{
vec4 gl_Position;
} gl_in[];
layout(quads, cw) out; // ERROR
layout(triangles) out; // ERROR
layout(isolines) out; // ERROR
layout(cw) out; // ERROR
layout(fractional_odd_spacing) out; // ERROR
layout(equal_spacing) out; // ERROR
layout(fractional_even_spacing) out; // ERROR
layout(point_mode) out; // ERROR
in vec2 ina; // ERROR, not array
in vec2 inb[];
in vec2 inc[18]; // ERROR, wrong size
in vec2 ind[gl_MaxPatchVertices];
in testbla { // ERROR, not array
int f;
} bla;
in testblb {
int f;
} blb[];
in testblc { // ERROR wrong size
int f;
} blc[18];
in testbld {
int f;
} bld[gl_MaxPatchVertices];
layout(location = 23) in vec4 ivla[];
layout(location = 24) in vec4 ivlb[];
layout(location = 24) in vec4 ivlc[]; // ERROR, overlap
layout(location = 23) out vec4 ovla[2];
layout(location = 24) out vec4 ovlb[2]; // ERROR, overlap
in float gl_TessLevelOuter[4]; // ERROR, can't redeclare
patch in pinbn {
int a;
} pinbi;
centroid out vec3 myColor2;
centroid in vec3 centr[];
sample out vec4 perSampleColor;
void bbbad()
{
gl_BoundingBoxOES; // ERROR, wrong stage
}

255
deps/glslang/glslang/Test/320.vert vendored Normal file
View File

@ -0,0 +1,255 @@
#version 320 es
out outbname {
int a;
out vec4 v;
highp sampler2D s; // ERROR, opaque type
} outbinst;
out outbname2 {
layout(location = 12) int aAnon;
layout(location = 13) vec4 vAnon;
};
layout(location = 12) out highp int aliased; // ERROR, aliasing location
in inbname { int a; } inbinst; // ERROR, no in block in vertex shader
out gl_PerVertex { // ERROR, has extra member
highp vec4 gl_Position;
highp vec4 t;
};
void main()
{
int sum = gl_VertexID +
gl_InstanceID;
gl_Position = vec4(1.0);
gl_PointSize = 2.0; // ERROR, removed by redeclaration
}
out gl_PerVertex { // ERROR, already used and already redeclared
highp vec4 gl_Position;
highp vec4 t;
};
smooth out smo { // ERROR, no smooth on a block
int i;
} smon;
flat out fmo { // ERROR, no flat on a block
int i;
} fmon;
centroid out cmo { // ERROR, no centroid on a block
int i;
} cmon;
invariant out imo { // ERROR, no invariant on a block
int i;
} imon;
in vec2 inf, ing;
uniform ivec2 offsets[4];
uniform sampler2D sArray[4];
uniform int sIndex;
layout(binding = 0) uniform atomic_uint auArray[2];
uniform ubName { int i; } ubInst[4];
buffer bbName { int i; } bbInst[4];
highp uniform writeonly image2D iArray[5];
const ivec2 constOffsets[4] = ivec2[4](ivec2(0.1), ivec2(0.2), ivec2(0.3), ivec2(0.4));
void pfoo()
{
precise vec2 h;
h = fma(inf, ing, h);
sArray[sIndex + 1];
ubInst[sIndex + 1];
bbInst[sIndex - 2]; // ERROR, still not supported
iArray[2];
iArray[sIndex - 2];
textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf));
textureGatherOffsets(sArray[0], vec2(0.1), constOffsets);
textureGatherOffsets(sArray[0], vec2(0.1), offsets); // ERROR, offset not constant
}
uniform samplerBuffer noPreSamp1; // ERROR, no default precision
uniform isamplerBuffer noPreSamp2; // ERROR, no default precision
uniform usamplerBuffer noPreSamp3; // ERROR, no default precision
uniform writeonly imageBuffer noPreSamp4; // ERROR, no default precision
uniform writeonly iimageBuffer noPreSamp5; // ERROR, no default precision
uniform writeonly uimageBuffer noPreSamp6; // ERROR, no default precision
precision highp samplerBuffer;
precision highp isamplerBuffer;
precision highp usamplerBuffer;
precision highp imageBuffer;
precision highp iimageBuffer;
precision highp uimageBuffer;
#ifdef GL_OES_texture_buffer
uniform samplerBuffer bufSamp1;
uniform isamplerBuffer bufSamp2;
uniform usamplerBuffer bufSamp3;
#endif
#ifdef GL_EXT_texture_buffer
uniform writeonly imageBuffer bufSamp4;
uniform writeonly iimageBuffer bufSamp5;
uniform writeonly uimageBuffer bufSamp6;
#endif
void bufferT()
{
highp int s1 = textureSize(bufSamp1);
highp int s2 = textureSize(bufSamp2);
highp int s3 = textureSize(bufSamp3);
highp int s4 = imageSize(bufSamp4);
highp int s5 = imageSize(bufSamp5);
highp int s6 = imageSize(bufSamp6);
highp vec4 f1 = texelFetch(bufSamp1, s1);
highp ivec4 f2 = texelFetch(bufSamp2, s2);
highp uvec4 f3 = texelFetch(bufSamp3, s3);
}
uniform writeonly imageCubeArray noPreCA1; // ERROR, no default precision
uniform writeonly iimageCubeArray noPreCA2; // ERROR, no default precision
uniform writeonly uimageCubeArray noPreCA3; // ERROR, no default precision
uniform samplerCubeArray noPreCA4; // ERROR, no default precision
uniform samplerCubeArrayShadow noPreCA5; // ERROR, no default precision
uniform isamplerCubeArray noPreCA6; // ERROR, no default precision
uniform usamplerCubeArray noPreCA7; // ERROR, no default precision
precision highp imageCubeArray ;
precision highp iimageCubeArray ;
precision highp uimageCubeArray ;
precision highp samplerCubeArray ;
precision highp samplerCubeArrayShadow;
precision highp isamplerCubeArray ;
precision highp usamplerCubeArray ;
uniform writeonly imageCubeArray CA1;
uniform writeonly iimageCubeArray CA2;
uniform writeonly uimageCubeArray CA3;
layout(rgba16f) uniform readonly imageCubeArray rCA1;
layout(rgba32i) uniform readonly iimageCubeArray rCA2;
layout(r32ui) uniform readonly uimageCubeArray rCA3;
#ifdef GL_OES_texture_cube_map_array
uniform samplerCubeArray CA4;
uniform samplerCubeArrayShadow CA5;
uniform isamplerCubeArray CA6;
uniform usamplerCubeArray CA7;
#endif
void CAT()
{
highp ivec3 s4 = textureSize(CA4, 1);
highp ivec3 s5 = textureSize(CA5, 1);
highp ivec3 s6 = textureSize(CA6, 1);
highp ivec3 s7 = textureSize(CA7, 1);
highp vec4 t4 = texture(CA4, vec4(0.5));
highp float t5 = texture(CA5, vec4(0.5), 3.0);
highp ivec4 t6 = texture(CA6, vec4(0.5));
highp uvec4 t7 = texture(CA7, vec4(0.5));
highp vec4 L4 = textureLod(CA4, vec4(0.5), 0.24);
highp ivec4 L6 = textureLod(CA6, vec4(0.5), 0.26);
highp uvec4 L7 = textureLod(CA7, vec4(0.5), 0.27);
highp vec4 g4 = textureGrad(CA4, vec4(0.5), vec3(0.1), vec3(0.2));
highp ivec4 g6 = textureGrad(CA6, vec4(0.5), vec3(0.1), vec3(0.2));
highp uvec4 g7 = textureGrad(CA7, vec4(0.5), vec3(0.1), vec3(0.2));
highp vec4 gath4 = textureGather(CA4, vec4(0.5));
highp vec4 gathC4 = textureGather(CA4, vec4(0.5), 2);
highp ivec4 gath6 = textureGather(CA6, vec4(0.5));
highp ivec4 gathC6 = textureGather(CA6, vec4(0.5), 1);
highp uvec4 gath7 = textureGather(CA7, vec4(0.5));
highp uvec4 gathC7 = textureGather(CA7, vec4(0.5), 0);
highp vec4 gath5 = textureGather(CA5, vec4(0.5), 2.5);
highp ivec3 s1 = imageSize(CA1);
highp ivec3 s2 = imageSize(CA2);
highp ivec3 s3 = imageSize(CA3);
imageStore(CA1, s3, vec4(1));
imageStore(CA2, s3, ivec4(1));
imageStore(CA3, s3, uvec4(1));
highp vec4 cl1 = imageLoad(rCA1, s3);
highp ivec4 cl2 = imageLoad(rCA2, s3);
highp uvec4 cl3 = imageLoad(rCA3, s3);
}
uniform sampler2DMSArray noPrec2DMS; // ERROR, no default
uniform isampler2DMSArray noPrec2DMSi; // ERROR, no default
uniform usampler2DMSArray noPrec2DMSu; // ERROR, no default
precision highp sampler2DMSArray;
precision highp isampler2DMSArray;
precision highp usampler2DMSArray;
uniform sampler2DMSArray samp2DMSA;
uniform isampler2DMSArray samp2DMSAi;
uniform usampler2DMSArray samp2DMSAu;
void MSA()
{
vec4 tf = texelFetch(samp2DMSA, ivec3(5), 2);
ivec4 tfi = texelFetch(samp2DMSAi, ivec3(5), 2);
uvec4 tfu = texelFetch(samp2DMSAu, ivec3(5), 2);
ivec3 tfs = textureSize(samp2DMSA);
ivec3 tfsi = textureSize(samp2DMSAi);
ivec3 tfsb = textureSize(samp2DMSAi, 4); // ERROR, no lod
ivec3 tfsu = textureSize(samp2DMSAu);
}
uniform layout(r32f) highp image2D im2Df;
uniform layout(r32ui) highp uimage2D im2Du;
uniform layout(r32i) highp iimage2D im2Di;
uniform ivec2 P;
void goodImageAtom()
{
float datf;
int dati;
uint datu;
imageAtomicAdd( im2Di, P, dati);
imageAtomicAdd( im2Du, P, datu);
imageAtomicMin( im2Di, P, dati);
imageAtomicMin( im2Du, P, datu);
imageAtomicMax( im2Di, P, dati);
imageAtomicMax( im2Du, P, datu);
imageAtomicAnd( im2Di, P, dati);
imageAtomicAnd( im2Du, P, datu);
imageAtomicOr( im2Di, P, dati);
imageAtomicOr( im2Du, P, datu);
imageAtomicXor( im2Di, P, dati);
imageAtomicXor( im2Du, P, datu);
imageAtomicExchange(im2Di, P, dati);
imageAtomicExchange(im2Du, P, datu);
imageAtomicExchange(im2Df, P, datf);
imageAtomicCompSwap(im2Di, P, 3, dati);
imageAtomicCompSwap(im2Du, P, 5u, datu);
}
sample out vec4 colorSample;
flat sample out vec4 colorfsi;
sample out vec3 sampInArray[4];
in vec4 inv4;
void badInterp()
{
interpolateAtCentroid(inv4); // ERROR, wrong stage
interpolateAtSample(inv4, 1); // ERROR, need extension
interpolateAtOffset(inv4, vec2(0.2)); // ERROR, need extension
}

152
deps/glslang/glslang/Test/330.frag vendored Normal file
View File

@ -0,0 +1,152 @@
#version 330 compatibility
in vec4 inVar;
layout(location=0, index=0) out vec4 outVar;
varying vec4 varyingVar;
void main()
{
gl_FragColor = varyingVar; // link ERROR: user output was used
gl_FragData[1] = inVar; // link ERROR: user output was used
int buffer = 4;
}
#extension GL_ARB_separate_shader_objects : enable
in gl_PerFragment {
vec4 gl_Color;
};
void foo()
{
vec4 c = gl_Color;
outVar = inVar;
}
in gl_block { // ERROR
int gl_i;
} gl_name;
in myBlock {
int gl_i; // ERROR
} gl_name; // ERROR
in gl_PerVertex { // ERROR
vec4 gl_FragCoord;
} gl_in[];
in gl_PerVertex { // ERROR
vec4 gl_FragCoord;
}; // ERROR
const int start = 6;
layout(location = -2) in vec4 v1; // ERROR
layout(location = start + 2) in vec4 v2; // ERROR
layout(location = 4.7e10) in vec4 v20; // ERROR
layout(location = +60) in float v21; // ERROR
layout(location = (2)) in float v22; // ERROR
struct S {
float f1;
layout(location = 3) float f2; // ERROR
};
layout(location = 1) in inblock { // ERROR
float f1;
layout(location = 3) float f2; // ERROR
};
layout(location = 1) uniform ublock { // ERROR
float f1;
layout(location = 3) float f2; // ERROR
} uinst;
#extension GL_ARB_enhanced_layouts : enable
layout(location = start) in vec4 v3;
layout(location = -2) in vec4 v4; // ERROR
layout(location = -start) in vec4 v5; // ERROR
layout(location = start*start - 2 - 4) in vec4 v6;
layout(location = +61) in float v23;
layout(location = (62)) in float v24;
struct S2 {
float f1;
layout(location = 3) float f2; // ERROR
};
layout(location = 28) in inblock2 {
bool b1;
float f1;
layout(location = 25) float f2;
vec4 f3;
layout(location = 21) S2 s2;
vec4 f4;
vec4 f5;
} ininst2;
layout(location = 13) uniform ublock2 { // ERROR
float f1;
layout(location = 3) float f2; // ERROR
} uinst2;
in inblock3 { // ERROR, mix of location internal with no location external
float f1;
layout(location = 40) float f2;
} in3;
in ublock4 {
layout(location = 50) float f1;
layout(location = 51) float f2;
} in4;
layout(location = 33) in struct SS {
vec3 a; // gets location 33
mat2 b; // gets locations 34 and 35
vec4 c[2]; // gets locations 36 and 37
layout (location = 38) vec2 A; // ERROR, can't use on struct member
} s;
layout(location = 44) in block {
vec4 d; // gets location 44
vec4 e; // gets location 45
layout(location = 47) vec4 f; // gets location 47
vec4 g; // gets location 48
layout (location = 41) vec4 h; // gets location 41
vec4 i; // gets location 42
vec4 j; // gets location 43
vec4 k; // ERROR, location 44 already used
};
layout(index=0) out vec4 outVar2; // ERROR: missing explicit location
layout(location=0, index=1) out vec4 outVar3; // no error even though location is overlapping
layout(location=0, index=1) out vec4 outVar4; // ERROR overlapping
layout(location=27, index=0) in vec4 indexIn; // ERROR, not on in
layout(location=0, index=0) in; // ERROR, not just on in
layout(location=0, index=0) out; // ERROR, need a variable
layout(location=26, index=0) out indexBlock { int a; } indexBlockI; // ERROR, not on a block
uniform sampler1D samp1D;
uniform sampler2DShadow samp2Ds;
void qlod()
{
vec2 lod;
float pf;
vec2 pf2;
vec3 pf3;
lod = textureQueryLod(samp1D, pf); // ERROR, not until 400
lod = textureQueryLod(samp2Ds, pf2); // ERROR, not until 400
}
int precise; // okay, not a keyword yet
struct SKeyMem { int precise; } KeyMem; // okay, not a keyword yet
void fooKeyMem()
{
KeyMem.precise;
}
layout(location=28, index=2) out vec4 outIndex2; // ERROR index out of range

12
deps/glslang/glslang/Test/330comp.frag vendored Normal file
View File

@ -0,0 +1,12 @@
#version 330 compatibility
in vec4 inVar;
out vec4 outVar;
varying vec4 varyingVar;
void main()
{
gl_FragColor = varyingVar;
gl_FragData[1] = inVar * gl_ModelViewMatrix;
}

201
deps/glslang/glslang/Test/400.frag vendored Normal file
View File

@ -0,0 +1,201 @@
#version 400 core
in vec2 c2D;
flat in int i;
out vec4 outp;
uniform sampler2D arrayedSampler[5];
uniform usampler2DRect samp2dr;
uniform isampler2DArray isamp2DA;
void main()
{
vec4 v;
v = texture(arrayedSampler[i], c2D);
outp.x = gl_ClipDistance[1];
ivec2 offsets[4];
const ivec2 constOffsets[4] = ivec2[4](ivec2(1,2), ivec2(3,4), ivec2(15,16), ivec2(-2,0));
uvec4 uv4 = textureGatherOffsets(samp2dr, c2D, offsets, 2); // ERROR, offsets not constant
uv4 = textureGatherOffsets(samp2dr, c2D, constOffsets, 2);
vec4 v4 = textureGather(arrayedSampler[0], c2D);
ivec4 iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 3);
iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), i); // ERROR, last argument not const
iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 4); // ERROR, last argument out of range
iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 1+2);
iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(i));
vec4 c = gl_FragCoord;
}
layout(location = 4) in vec4 vl; // ERROR, not supported
#ifdef GL_ARB_separate_shader_objects
#extension GL_ARB_separate_shader_objects : enable
#endif
layout(location = 6) in vec4 vl2;
layout(location = 3) uniform vec3 uv3;
layout(location = 5) in vec4 gl_Color; // ERROR, layout
noperspective in float gl_ClipDistance[4]; // ERROR, can't change qualifier
layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; // ERROR, declared after use
uniform sampler2DRectShadow u2drs;
void foo23()
{
const ivec2[3] offsets = ivec2[3](ivec2(1,2), ivec2(3,4), ivec2(15,16));
textureProjGradOffset(u2drs, outp, vec2(0.0), vec2(0.0), ivec2(c2D)); // ERROR, offset not constant
textureProjGradOffset(u2drs, outp, vec2(0.0), vec2(0.0), offsets[1]);
textureProjGradOffset(u2drs, outp, vec2(0.0), vec2(0.0), offsets[2]); // ERROR, offset out of range
textureProjGradOffset(u2drs, outp, vec2(0.0), vec2(0.0), ivec2(-10, 20)); // ERROR, offset out of range
}
patch in vec4 patchIn; // ERROR
patch out vec4 patchOut; // ERROR
void foo24()
{
dvec3 df, di;
df = modf(dvec3(outp.xyz), di);
}
in float in1;
in vec2 in2;
in vec3 in3;
in vec4 in4;
void foodc1()
{
vec2 v2 = dFdxFine(in2); // ERROR
vec3 v3 = dFdyCoarse(in3); // ERROR
vec4 v4 = fwidthCoarse(in4) + fwidthFine(in4); // ERROR
}
#extension GL_ARB_derivative_control : enable
void foodc2()
{
vec2 v2 = dFdxFine(in2);
vec3 v3 = dFdyCoarse(in3);
vec4 v4 = fwidthCoarse(in4) + fwidthFine(in4);
uint u1;
ivec3 i3;
ivec2 i2;
v2 = frexp(v2, i2);
v3 = ldexp(v3, i3);
u1 = packUnorm4x8(v4);
u1 = packSnorm4x8(v4);
v4 = unpackUnorm4x8(u1);
v4 = unpackSnorm4x8(u1);
double d;
uvec2 u2;
d = packDouble2x32(u2);
u2 = unpackDouble2x32(d);
}
sample in vec4 colorSampIn;
sample out vec4 colorSampleBad; // ERROR
noperspective in vec4 colorfsi;
sample in vec3 sampInArray[4];
smooth in float scalarIn;
flat centroid in vec2 colorfc;
struct S {
float x;
};
in S s1;
sample S s2;
void interp()
{
interpolateAtCentroid(colorfc);
interpolateAtCentroid(colorSampIn);
interpolateAtCentroid(colorfsi);
interpolateAtCentroid(scalarIn);
interpolateAtCentroid(sampInArray); // ERROR
interpolateAtCentroid(sampInArray[2]);
interpolateAtCentroid(sampInArray[2].xy); // ERROR
interpolateAtSample(sampInArray, 1); // ERROR
interpolateAtSample(sampInArray[i], 0);
interpolateAtSample(s1.x, 2);
interpolateAtSample(scalarIn, 1);
interpolateAtOffset(sampInArray, vec2(0.2)); // ERROR
interpolateAtOffset(sampInArray[2], vec2(0.2));
interpolateAtOffset(sampInArray[2].xy, vec2(0.2)); // ERROR, no swizzle
interpolateAtOffset(scalarIn + scalarIn, vec2(0.2)); // ERROR, no binary ops other than dereference
interpolateAtOffset(s2.x, vec2(0.2)); // ERROR
float f;
interpolateAtCentroid(f); // ERROR, not interpolant
interpolateAtSample(outp, 0); // ERROR, not interpolant
}
uniform sampler1D samp1D;
uniform isampler2D isamp2D;
uniform usampler3D usamp3D;
uniform samplerCube sampCube;
uniform isampler1DArray isamp1DA;
uniform usampler2DArray usamp2DA;
uniform isamplerCubeArray isampCubeA;
uniform sampler1DShadow samp1Ds;
uniform sampler2DShadow samp2Ds;
uniform samplerCubeShadow sampCubes;
uniform sampler1DArrayShadow samp1DAs;
uniform sampler2DArrayShadow samp2DAs;
uniform samplerCubeArrayShadow sampCubeAs;
uniform samplerBuffer sampBuf;
uniform sampler2DRect sampRect;
void qlod()
{
vec2 lod;
float pf;
vec2 pf2;
vec3 pf3;
lod = textureQueryLod(samp1D, pf);
lod = textureQueryLod(isamp2D, pf2);
lod = textureQueryLod(usamp3D, pf3);
lod = textureQueryLod(sampCube, pf3);
lod = textureQueryLod(isamp1DA, pf);
lod = textureQueryLod(usamp2DA, pf2);
lod = textureQueryLod(isampCubeA, pf3);
lod = textureQueryLod(samp1Ds, pf);
lod = textureQueryLod(samp2Ds, pf2);
lod = textureQueryLod(sampCubes, pf3);
lod = textureQueryLod(samp1DAs, pf);
lod = textureQueryLod(samp2DAs, pf2);
lod = textureQueryLod(sampCubeAs, pf3);
lod = textureQueryLod(sampBuf, pf); // ERROR
lod = textureQueryLod(sampRect, pf2); // ERROR
}
uniform uint uu;
out uint iout;
void bitwiseConv()
{
iout = uu & i;
iout += uu ^ i;
iout += i | uu;
}
subroutine(subT1, subT2);
subroutine float subT1() { return 1.0; }
subroutine float subT2() { return 1.0; }
struct SKeyMem { int precise; } KeyMem; // ERROR, keyword can't be a member

330
deps/glslang/glslang/Test/400.geom vendored Normal file
View File

@ -0,0 +1,330 @@
#version 400 core
void main()
{
EmitStreamVertex(1);
EndStreamPrimitive(0);
EmitVertex();
EndPrimitive();
int id = gl_InvocationID;
}
layout(invocations = 4) in outbn { int a; } bn[]; // ERROR, not on a block
layout(max_vertices = 127) out;
layout(invocations = 4) in;
#extension GL_ARB_separate_shader_objects : enable
in gl_PerVertex { // testing input arrays with a block redeclaration, see 420.geom for without
vec4 gl_Position;
layout(std140, location = 3) patch float gl_PointSize; // ERRORs...
} gl_in[];
void foo()
{
gl_in.length(); // ERROR
gl_in[1].gl_Position;
}
in vec4 color[];
in vec4 color2[];
in vec4 colorS[3];
in vec4 colorBad[4];
void foo2()
{
color.length(); // ERROR
colorS.length();
}
layout(triangles) in; // give ERROR just for colorBad
in vec4 color[3];
in vec4 color2[3];
in vec4 colorbad2[2]; // ERROR
void foo3()
{
gl_in.length();
color.length();
color2.length();
colorS.length();
}
layout(location = 4) in vec4 cva[3];
layout(location = 5) in vec4 cvb[3];
layout(location = 2) in mat3 cmc[3]; // ERROR, collision
patch in vec4 patchIn[]; // ERROR
patch out vec4 patchOut; // ERROR
in float scalar; // ERROR, no array
layout(max_vertices = 127, invocations = 4) out; // ERROR
layout(invocations = 4, max_vertices = 127) in; // ERROR
layout(max_vertices = 127, invocations = 4) uniform; // 2 ERRORs
in inblockscalar {
int a;
} inbls; // ERROR, not an array
in inblocka {
int a;
} inbla[17]; // ERROR, wrong array size
void bits()
{
uvec2 u2;
u2 = uaddCarry(u2, u2, u2);
uint u1;
u1 = usubBorrow(u1, u1, u1);
uvec4 u4;
umulExtended(u4, u4, u4, u4);
ivec4 i4;
imulExtended(i4, i4, i4, i4);
int i1;
i1 = bitfieldExtract(i1, 4, 5);
uvec3 u3;
u3 = bitfieldExtract(u3, 4, 5);
ivec3 i3;
i3 = bitfieldInsert(i3, i3, 4, 5);
u1 = bitfieldInsert(u1, u1, 4, 5);
ivec2 i2;
i2 = bitfieldReverse(i2);
u4 = bitfieldReverse(u4);
i1 = bitCount(i1);
i3 = bitCount(u3);
i2 = findLSB(i2);
i4 = findLSB(u4);
i1 = findMSB(i1);
i2 = findMSB(u2);
}
layout(location = 7, index = 1) out vec4 indexedOut;
uniform sampler1D samp1D;
uniform sampler2DShadow samp2Ds;
void qlod()
{
vec2 lod;
float pf;
vec2 pf2;
vec3 pf3;
lod = textureQueryLod(samp1D, pf); // ERROR, only in fragment
lod = textureQueryLod(samp2Ds, pf2); // ERROR, only in fragment
}
void doubles()
{
double doublev;
dvec2 dvec2v;
dvec3 dvec3v;
dvec4 dvec4v;
bool boolv;
bvec2 bvec2v;
bvec3 bvec3v;
bvec4 bvec4v;
doublev = sqrt(2.9);
dvec2v = sqrt(dvec2(2.7));
dvec3v = sqrt(dvec3(2.0));
dvec4v = sqrt(dvec4(2.1));
doublev += inversesqrt(doublev);
dvec2v += inversesqrt(dvec2v);
dvec3v += inversesqrt(dvec3v);
dvec4v += inversesqrt(dvec4v);
doublev += abs(doublev);
dvec2v += abs(dvec2v);
dvec3v += abs(dvec3v);
dvec4v += abs(dvec4v);
doublev += sign(doublev);
dvec2v += sign(dvec2v);
dvec3v += sign(dvec3v);
dvec4v += sign(dvec4v);
doublev += floor(doublev);
dvec2v += floor(dvec2v);
dvec3v += floor(dvec3v);
dvec4v += floor(dvec4v);
doublev += trunc(doublev);
dvec2v += trunc(dvec2v);
dvec3v += trunc(dvec3v);
dvec4v += trunc(dvec4v);
doublev += round(doublev);
dvec2v += round(dvec2v);
dvec3v += round(dvec3v);
dvec4v += round(dvec4v);
doublev += roundEven(doublev);
dvec2v += roundEven(dvec2v);
dvec3v += roundEven(dvec3v);
dvec4v += roundEven(dvec4v);
doublev += ceil(doublev);
dvec2v += ceil(dvec2v);
dvec3v += ceil(dvec3v);
dvec4v += ceil(dvec4v);
doublev += fract(doublev);
dvec2v += fract(dvec2v);
dvec3v += fract(dvec3v);
dvec4v += fract(dvec4v);
doublev += mod(doublev, doublev);
dvec2v += mod(dvec2v, doublev);
dvec3v += mod(dvec3v, doublev);
dvec4v += mod(dvec4v, doublev);
dvec2v += mod(dvec2v, dvec2v);
dvec3v += mod(dvec3v, dvec3v);
dvec4v += mod(dvec4v, dvec4v);
doublev += modf(doublev, doublev);
dvec2v += modf(dvec2v, dvec2v);
dvec3v += modf(dvec3v, dvec3v);
dvec4v += modf(dvec4v, dvec4v);
doublev += min(doublev, doublev);
dvec2v += min(dvec2v, doublev);
dvec3v += min(dvec3v, doublev);
dvec4v += min(dvec4v, doublev);
dvec2v += min(dvec2v, dvec2v);
dvec3v += min(dvec3v, dvec3v);
dvec4v += min(dvec4v, dvec4v);
doublev += max(doublev, doublev);
dvec2v += max(dvec2v, doublev);
dvec3v += max(dvec3v, doublev);
dvec4v += max(dvec4v, doublev);
dvec2v += max(dvec2v, dvec2v);
dvec3v += max(dvec3v, dvec3v);
dvec4v += max(dvec4v, dvec4v);
doublev += clamp(doublev, doublev, doublev);
dvec2v += clamp(dvec2v, doublev, doublev);
dvec3v += clamp(dvec3v, doublev, doublev);
dvec4v += clamp(dvec4v, doublev, doublev);
dvec2v += clamp(dvec2v, dvec2v, dvec2v);
dvec3v += clamp(dvec3v, dvec3v, dvec3v);
dvec4v += clamp(dvec4v, dvec4v, dvec4v);
doublev += mix(doublev, doublev, doublev);
dvec2v += mix(dvec2v, dvec2v, doublev);
dvec3v += mix(dvec3v, dvec3v, doublev);
dvec4v += mix(dvec4v, dvec4v, doublev);
dvec2v += mix(dvec2v, dvec2v, dvec2v);
dvec3v += mix(dvec3v, dvec3v, dvec3v);
dvec4v += mix(dvec4v, dvec4v, dvec4v);
doublev += mix(doublev, doublev, boolv);
dvec2v += mix(dvec2v, dvec2v, bvec2v);
dvec3v += mix(dvec3v, dvec3v, bvec3v);
dvec4v += mix(dvec4v, dvec4v, bvec4v);
doublev += step(doublev, doublev);
dvec2v += step(dvec2v, dvec2v);
dvec3v += step(dvec3v, dvec3v);
dvec4v += step(dvec4v, dvec4v);
dvec2v += step(doublev, dvec2v);
dvec3v += step(doublev, dvec3v);
dvec4v += step(doublev, dvec4v);
doublev += smoothstep(doublev, doublev, doublev);
dvec2v += smoothstep(dvec2v, dvec2v, dvec2v);
dvec3v += smoothstep(dvec3v, dvec3v, dvec3v);
dvec4v += smoothstep(dvec4v, dvec4v, dvec4v);
dvec2v += smoothstep(doublev, doublev, dvec2v);
dvec3v += smoothstep(doublev, doublev, dvec3v);
dvec4v += smoothstep(doublev, doublev, dvec4v);
boolv = isnan(doublev);
bvec2v = isnan(dvec2v);
bvec3v = isnan(dvec3v);
bvec4v = isnan(dvec4v);
boolv = boolv ? isinf(doublev) : false;
bvec2v = boolv ? isinf(dvec2v) : bvec2(false);
bvec3v = boolv ? isinf(dvec3v) : bvec3(false);
bvec4v = boolv ? isinf(dvec4v) : bvec4(false);
doublev += length(doublev);
doublev += length(dvec2v);
doublev += length(dvec3v);
doublev += length(dvec4v);
doublev += distance(doublev, doublev);
doublev += distance(dvec2v, dvec2v);
doublev += distance(dvec3v, dvec3v);
doublev += distance(dvec4v, dvec4v);
doublev += dot(doublev, doublev);
doublev += dot(dvec2v, dvec2v);
doublev += dot(dvec3v, dvec3v);
doublev += dot(dvec4v, dvec4v);
dvec3v += cross(dvec3v, dvec3v);
doublev += normalize(doublev);
dvec2v += normalize(dvec2v);
dvec3v += normalize(dvec3v);
dvec4v += normalize(dvec4v);
doublev += faceforward(doublev, doublev, doublev);
dvec2v += faceforward(dvec2v, dvec2v, dvec2v);
dvec3v += faceforward(dvec3v, dvec3v, dvec3v);
dvec4v += faceforward(dvec4v, dvec4v, dvec4v);
doublev += reflect(doublev, doublev);
dvec2v += reflect(dvec2v, dvec2v);
dvec3v += reflect(dvec3v, dvec3v);
dvec4v += reflect(dvec4v, dvec4v);
doublev += refract(doublev, doublev, doublev);
dvec2v += refract(dvec2v, dvec2v, doublev);
dvec3v += refract(dvec3v, dvec3v, doublev);
dvec4v += refract(dvec4v, dvec4v, doublev);
dmat2 dmat2v = outerProduct(dvec2v, dvec2v);
dmat3 dmat3v = outerProduct(dvec3v, dvec3v);
dmat4 dmat4v = outerProduct(dvec4v, dvec4v);
dmat2x3 dmat2x3v = outerProduct(dvec3v, dvec2v);
dmat3x2 dmat3x2v = outerProduct(dvec2v, dvec3v);
dmat2x4 dmat2x4v = outerProduct(dvec4v, dvec2v);
dmat4x2 dmat4x2v = outerProduct(dvec2v, dvec4v);
dmat3x4 dmat3x4v = outerProduct(dvec4v, dvec3v);
dmat4x3 dmat4x3v = outerProduct(dvec3v, dvec4v);
dmat2v *= matrixCompMult(dmat2v, dmat2v);
dmat3v *= matrixCompMult(dmat3v, dmat3v);
dmat4v *= matrixCompMult(dmat4v, dmat4v);
dmat2x3v = matrixCompMult(dmat2x3v, dmat2x3v);
dmat2x4v = matrixCompMult(dmat2x4v, dmat2x4v);
dmat3x2v = matrixCompMult(dmat3x2v, dmat3x2v);
dmat3x4v = matrixCompMult(dmat3x4v, dmat3x4v);
dmat4x2v = matrixCompMult(dmat4x2v, dmat4x2v);
dmat4x3v = matrixCompMult(dmat4x3v, dmat4x3v);
dmat2v *= transpose(dmat2v);
dmat3v *= transpose(dmat3v);
dmat4v *= transpose(dmat4v);
dmat2x3v = transpose(dmat3x2v);
dmat3x2v = transpose(dmat2x3v);
dmat2x4v = transpose(dmat4x2v);
dmat4x2v = transpose(dmat2x4v);
dmat3x4v = transpose(dmat4x3v);
dmat4x3v = transpose(dmat3x4v);
doublev += determinant(dmat2v);
doublev += determinant(dmat3v);
doublev += determinant(dmat4v);
dmat2v *= inverse(dmat2v);
dmat3v *= inverse(dmat3v);
dmat4v *= inverse(dmat4v);
}

125
deps/glslang/glslang/Test/400.tesc vendored Normal file
View File

@ -0,0 +1,125 @@
#version 400 core
layout(vertices = 4) out;
int outa[gl_out.length()];
layout(quads) in; // ERROR
layout(ccw) out; // ERROR
layout(fractional_even_spacing) in; // ERROR
patch in vec4 patchIn; // ERROR
patch out vec4 patchOut;
void main()
{
barrier();
int a = gl_MaxTessControlInputComponents +
gl_MaxTessControlOutputComponents +
gl_MaxTessControlTextureImageUnits +
gl_MaxTessControlUniformComponents +
gl_MaxTessControlTotalOutputComponents;
vec4 p = gl_in[1].gl_Position;
float ps = gl_in[1].gl_PointSize;
float cd = gl_in[1].gl_ClipDistance[2];
int pvi = gl_PatchVerticesIn;
int pid = gl_PrimitiveID;
int iid = gl_InvocationID;
gl_out[gl_InvocationID].gl_Position = p;
gl_out[gl_InvocationID].gl_PointSize = ps;
gl_out[gl_InvocationID].gl_ClipDistance[1] = cd;
gl_TessLevelOuter[3] = 3.2;
gl_TessLevelInner[1] = 1.3;
if (a > 10)
barrier(); // ERROR
else
barrier(); // ERROR
barrier();
do {
barrier(); // ERROR
} while (a > 10);
switch (a) {
default:
barrier(); // ERROR
break;
}
a < 12 ? a : (barrier(), a); // ERROR
{
barrier();
}
return;
barrier(); // ERROR
}
layout(vertices = 4) in; // ERROR
layout(vertices = 5) out; // ERROR
void foo()
{
gl_out[4].gl_PointSize; // ERROR
barrier(); // ERROR
}
in vec2 ina; // ERROR, not array
in vec2 inb[];
in vec2 inc[18]; // ERROR, wrong size
in vec2 ind[gl_MaxPatchVertices];
#extension GL_ARB_separate_shader_objects : enable
layout(location = 3) in vec4 ivla[];
layout(location = 4) in vec4 ivlb[];
layout(location = 4) in vec4 ivlc[]; // ERROR, overlapping
layout(location = 3) out vec4 ovla[];
layout(location = 4) out vec4 ovlb[];
layout(location = 4) out vec4 ovlc[]; // ERROR, overlapping
precise vec3 pv3;
void foop()
{
precise double d;
pv3 *= pv3;
pv3 = fma(pv3, pv3, pv3);
d = fma(d, d, d);
}
patch out pinbn {
int a;
} pinbi;
invariant precise out vec4 badOrder[]; // ERROR, precise must appear first
void badp(out precise float f); // ERROR, precise must appear first
void devi()
{
gl_DeviceIndex; // ERROR, no extension
gl_ViewIndex; // ERROR, no extension
}
#ifdef GL_EXT_device_group
#extension GL_EXT_device_group : enable
#endif
#ifdef GL_EXT_device_group
#extension GL_EXT_multiview : enable
#endif
void devie()
{
gl_DeviceIndex;
gl_ViewIndex;
}

125
deps/glslang/glslang/Test/400.tese vendored Normal file
View File

@ -0,0 +1,125 @@
#version 400 core
layout(vertices = 4) out; // ERROR
layout(quads, cw) in;
layout(triangles) in; // ERROR
layout(isolines) in; // ERROR
layout(ccw) in; // ERROR
layout(cw) in;
layout(fractional_odd_spacing) in;
layout(equal_spacing) in; // ERROR
layout(fractional_even_spacing) in; // ERROR
layout(point_mode) in;
patch in vec4 patchIn;
patch out vec4 patchOut; // ERROR
void main()
{
barrier(); // ERROR
int a = gl_MaxTessEvaluationInputComponents +
gl_MaxTessEvaluationOutputComponents +
gl_MaxTessEvaluationTextureImageUnits +
gl_MaxTessEvaluationUniformComponents +
gl_MaxTessPatchComponents +
gl_MaxPatchVertices +
gl_MaxTessGenLevel;
vec4 p = gl_in[1].gl_Position;
float ps = gl_in[1].gl_PointSize;
float cd = gl_in[1].gl_ClipDistance[2];
int pvi = gl_PatchVerticesIn;
int pid = gl_PrimitiveID;
vec3 tc = gl_TessCoord;
float tlo = gl_TessLevelOuter[3];
float tli = gl_TessLevelInner[1];
gl_Position = p;
gl_PointSize = ps;
gl_ClipDistance[2] = cd;
}
smooth patch in vec4 badp1; // ERROR
flat patch in vec4 badp2; // ERROR
noperspective patch in vec4 badp3; // ERROR
patch sample in vec3 badp4; // ERROR
#extension GL_ARB_separate_shader_objects : enable
in gl_PerVertex
{
float gl_ClipDistance[1];
} gl_in[];
in gl_PerVertex // ERROR, second redeclaration of gl_in
{
float gl_ClipDistance[1];
} gl_in[];
layout(quads, cw) out; // ERROR
layout(triangles) out; // ERROR
layout(isolines) out; // ERROR
layout(cw) out; // ERROR
layout(fractional_odd_spacing) out; // ERROR
layout(equal_spacing) out; // ERROR
layout(fractional_even_spacing) out; // ERROR
layout(point_mode) out; // ERROR
in vec2 ina; // ERROR, not array
in vec2 inb[];
in vec2 inc[18]; // ERROR, wrong size
in vec2 ind[gl_MaxPatchVertices];
in testbla {
int f;
} bla; // ERROR, not array
in testblb {
int f;
} blb[];
in testblc {
int f;
} blc[18]; // ERROR wrong size
in testbld {
int f;
} bld[gl_MaxPatchVertices];
layout(location = 23) in vec4 ivla[];
layout(location = 24) in vec4 ivlb[];
layout(location = 24) in vec4 ivlc[]; // ERROR
layout(location = 23) out vec4 ovla[2];
layout(location = 24) out vec4 ovlb[2]; // ERROR
in float gl_TessLevelOuter[4]; // ERROR, can't redeclare
patch in pinbn {
int a;
} pinbi;
void devi()
{
gl_DeviceIndex; // ERROR, no extension
gl_ViewIndex; // ERROR, no extension
}
#ifdef GL_EXT_device_group
#extension GL_EXT_device_group : enable
#endif
#ifdef GL_EXT_device_group
#extension GL_EXT_multiview : enable
#endif
void devie()
{
gl_DeviceIndex;
gl_ViewIndex;
}

106
deps/glslang/glslang/Test/400.vert vendored Normal file
View File

@ -0,0 +1,106 @@
#version 400 core
in double d; // ERROR, no doubles
in dvec3 d3; // ERROR, no doubles
in dmat4 dm4; // ERROR, no doubles
// function selection under type conversion
void foo1(double a, uint b) {}
void foo1(double a, int b) {}
void foo1(double a, float b) {}
void foo1(double a, double b){}
void foo2(double a, float b) {}
void foo2(double a, double b){}
void foo3(double a, float b) {}
void foo3(float a, double b) {}
void ftd( int, float, double) {}
void ftd( uint, float, double) {}
void ftd(float, double, double) {}
void main()
{
double d;
uint u;
int i;
float f;
foo1(d, d);
foo1(d, u);
foo1(d, i);
foo1(d, f);
foo1(f, d);
foo1(f, u);
foo1(f, i);
foo1(f, f);
foo1(u, d);
foo1(u, u);
foo1(u, i);
foo1(u, f);
foo1(i, d);
foo1(i, u);
foo1(i, i);
foo1(i, f);
foo2(d, d);
foo2(d, u);
foo2(d, i);
foo2(d, f);
foo2(f, d);
foo2(f, u);
foo2(f, i);
foo2(f, f);
foo2(u, d);
foo2(u, u);
foo2(u, i);
foo2(u, f);
foo2(i, d);
foo2(i, u);
foo2(i, i);
foo2(i, f);
foo3(d, d); // ERROR, no match
foo3(d, u);
foo3(d, i);
foo3(d, f);
foo3(f, d);
foo3(f, u); // ERROR, ambiguous
foo3(f, i); // ERROR, ambiguous
foo3(f, f); // ERROR, ambiguous
foo3(u, d);
foo3(u, u); // ERROR, ambiguous
foo3(u, i); // ERROR, ambiguous
foo3(u, f); // ERROR, ambiguous
foo3(i, d);
foo3(i, u); // ERROR, ambiguous
foo3(i, i); // ERROR, ambiguous
foo3(i, f); // ERROR, ambiguous
ftd(i, f, f);
ftd(u, f, f);
}
void itf(int, float, int);
void itf(int, double, int);
void tf()
{
double d;
uint u;
int i;
float f;
itf(i, i, i);
itf(i, u, i);
}

39
deps/glslang/glslang/Test/410.geom vendored Normal file
View File

@ -0,0 +1,39 @@
#version 410 core
void main()
{
gl_ViewportIndex = 7;
}
in gl_PerVertex {
float gl_PointSize;
} myIn[]; // ERROR, can't redeclare a different name
in gl_PerVertex {
float gl_PointSize;
} gl_myIn[]; // ERROR, can't redeclare a different name
in gl_PerVertex {
float gl_PointSize;
} gl_in[];
in gl_PerVertex {
float gl_PointSize;
} gl_in[]; // ERROR, can't do it again
out gl_PerVertex {
float gl_PointSize;
};
void foo()
{
float p = gl_in[1].gl_PointSize; // use of redeclared
gl_PointSize = p; // use of redeclared
vec4 v = gl_in[1].gl_Position; // ERROR, not included in the redeclaration
gl_Position = vec4(1.0); // ERROR, not included in the redeclaration
}
float foo5()
{
return 4; // implicit conversion of return type
}

11
deps/glslang/glslang/Test/410.tesc vendored Normal file
View File

@ -0,0 +1,11 @@
#version 400 core
// no layout(vertices = ...) out;
int outa[gl_out.length()]; // ERROR
patch out vec4 patchOut;
void main()
{
}

9
deps/glslang/glslang/Test/410.vert vendored Normal file
View File

@ -0,0 +1,9 @@
#version 410 core
in double d;
in dvec3 d3;
in dmat4 dm4;
void main()
{
}

30
deps/glslang/glslang/Test/420.comp vendored Normal file
View File

@ -0,0 +1,30 @@
#version 420
layout(local_size_x = 2) in; // ERROR, no compute
#extension GL_ARB_compute_shader : enable
layout(local_size_x = 2, local_size_y = 4, local_size_z = 6) in;
shared vec3 sfoo;
void main()
{
sfoo = vec3(gl_WorkGroupSize.x, gl_WorkGroupSize.y, gl_WorkGroupSize.z);
sfoo += gl_WorkGroupSize + gl_NumWorkGroups + gl_WorkGroupID + gl_LocalInvocationID + gl_GlobalInvocationID;
sfoo *= gl_LocalInvocationIndex;
sfoo += gl_MaxComputeWorkGroupCount + gl_MaxComputeWorkGroupSize;
sfoo *= gl_MaxComputeUniformComponents +
gl_MaxComputeTextureImageUnits +
gl_MaxComputeImageUniforms +
gl_MaxComputeAtomicCounters +
gl_MaxComputeAtomicCounterBuffers;
barrier();
memoryBarrier();
memoryBarrierAtomicCounter();
memoryBarrierBuffer();
memoryBarrierImage();
memoryBarrierShared();
groupMemoryBarrier();
}

14
deps/glslang/glslang/Test/420.frag vendored Normal file
View File

@ -0,0 +1,14 @@
#version 420 core
layout(depth_any) out float gl_FragDepth;
layout(depth_greater) out float gl_FragDepth; // ERROR: redeclaration with different qualifier
void main()
{
gl_FragDepth = 0.3;
}
layout(depth_less) in float depth; // ERROR: depth_less only applies to gl_FragDepth
layout(depth_any) out float gl_FragDepth; // ERROR, done after use
layout(binding=0) uniform atomic_uint a[];

55
deps/glslang/glslang/Test/420.geom vendored Normal file
View File

@ -0,0 +1,55 @@
#version 420 core
// testing input arrays without a gl_in[] block redeclaration, see 400.geom for with
int i;
void foo()
{
gl_in.length(); // ERROR
gl_in[1].gl_Position;
gl_in[i].gl_Position; // ERROR
}
layout(triangles) in;
in vec4 color3[3];
void foo3()
{
gl_in.length();
gl_in[i].gl_Position;
color3.length();
}
uniform sampler2D s2D;
in vec2 coord[];
uniform vec4 v4;
void foo4()
{
const ivec2 offsets[5] =
{
ivec2(0,1),
ivec2(1,-2),
ivec2(0,3),
ivec2(-3,0),
ivec2(2,1)
};
vec4 v = textureGatherOffset(s2D, coord[0], offsets[i].xy);
offsets[i].xy = ivec2(3); // ERROR
v4.x = 3.2; // ERROR
v4.xy; // should have non-uniform type
}
out gl_PerVertex {
float gl_PointSize[1]; // ERROR, adding array
float gl_ClipDistance; // ERROR, removing array
};
float foo5()
{
return i; // implicit conversion of return type
}

43
deps/glslang/glslang/Test/420.tesc vendored Normal file
View File

@ -0,0 +1,43 @@
#version 420 core
#extension GL_ARB_separate_shader_objects : enable
layout(vertices = 4) out;
out gl_PerVertex {
vec4 gl_Position;
} gl_out[3]; // ERROR, wrong size
out int a[gl_out.length()];
out int outb[5]; // ERROR, wrong size
out int outc[];
void main()
{
vec4 p = gl_in[1].gl_Position;
float ps = gl_in[1].gl_PointSize;
float cd = gl_in[1].gl_ClipDistance[2];
int pvi = gl_PatchVerticesIn;
int pid = gl_PrimitiveID;
int iid = gl_InvocationID;
gl_out[gl_InvocationID].gl_Position = p;
gl_out[gl_InvocationID].gl_PointSize = ps; // ERROR
}
out float outf; // ERROR, no array
layout (location = 0) in dmat2x4 vs_tcs_first[];
layout (location = 12) in dmat2x4 vs_tcs_last[];
void foo()
{
if ((dmat2x4(dvec4(-0.625, -0.5, -0.375lf, -0.25), dvec4(-0.375, -0.25, -0.125, 0)) != vs_tcs_first[0]) ||
(dmat2x4(dvec4(0.375, 0.5, 0.625, 0.75), dvec4(0.625, 0.75, 0.875, -0.625)) != vs_tcs_last[0]))
{
;
}
}
layout(vertices = 0) out; // ERROR, can't be 0

90
deps/glslang/glslang/Test/420.tese vendored Normal file
View File

@ -0,0 +1,90 @@
#version 420 core
const mat2x2 a = mat2( vec2( 1.0, 0.0 ), vec2( 0.0, 1.0 ) );
mat2x2 b = { vec2( 1.0, 0.0 ), vec2( 0.0, 1.0 ) };
const mat2x2 c = { { 1.0, 0.0, }, { 0.0, 1.0 } };
float a2[2] = { 3.4, 4.2, 5.0 }; // illegal
vec2 b2 = { 1.0, 2.0, 3.0 }; // illegal
mat3x3 c2 = { vec3(0.0), vec3(1.0), vec3(2.0), vec3(3.0) }; // illegal
mat2x2 d = { 1.0, 0.0, 0.0, 1.0 }; // illegal, can't flatten nesting
struct {
float a;
int b;
} e = { 1.2, 2, };
struct {
float a;
int b;
} e2 = { 1, 3 }; // legal, first initializer is converted
struct {
float a;
int b;
} e3 = { 1.2, 2, 3 }; // illegal
int a3 = true; // illegal
vec4 b3[2] = { vec4(0.0), 1.0 }; // illegal
vec4 b4[2] = vec4[2](vec4(0.0), mat2x2(1.0)); // illegal
mat4x2 c3 = { vec3(0.0), vec3(1.0) }; // illegal
struct S1 {
vec4 a;
vec4 b;
};
struct {
float s;
float t;
} d2[] = { S1(vec4(0.0), vec4(1.1)) }; // illegal
float b5[] = { 3.4, 4.2, 5.0, 5.2, 1.1 };
struct S3 {
float f;
mat2x3 m23;
};
struct S4 {
uvec2 uv2;
S3 s[2];
};
struct Single1 { int f; };
Single1 single1 = { 10 };
struct Single2 { uvec2 v; };
Single2 single2 = { { 1, 2 } };
struct Single3 { Single1 s1; };
Single3 single3 = { { 3 } };
struct Single4 { Single2 s1; };
Single4 single4 = { { { 4u, 5u } } };
const S4 constructed = S4(uvec2(1, 2),
S3[2](S3(3.0, mat2x3(4.0)),
S3(5.0, mat2x3(6.0))));
const S4 curlybad1 = { {1, 2},
{ {3, {4.0, 0, 0.0}, {0.0, 4.0, 0.0 } }, // ERROR, the mat2x3 isn't isolated
{5.0, {6, 0.0, 0.0}, {0.0, 6.0, 0.0 } } } };
const S4 curlyInit = { {1, 2},
{ {3, { {4.0, 0, 0.0}, {0.0, 4.0, 0.0 } } },
{5.0, { {6, 0.0, 0.0}, {0.0, 6.0, 0.0 } } } } };
float vc1, vc2, vc3;
vec3 av3 = vec3(vc1, vc2, vc3);
vec3 bv3 = { vc1, vc2, vc3 };
void main()
{
memoryBarrier();
if (constructed == curlybad1)
;
if (constructed == curlyInit)
;
}

161
deps/glslang/glslang/Test/420.vert vendored Normal file
View File

@ -0,0 +1,161 @@
#version 420 core
#version 420 core
varying vec2 v2; // ERROR, varying reserved
in vec4 bad[10];
highp in vec4 badorder;
out invariant vec4 badorder2;
in centroid vec4 badorder4; // ERROR, no centroid input to vertex stage
out flat vec4 badorder3;
void bar(in const float a);
void bar2(highp in float b);
smooth flat out vec4 rep; // ERROR, replicating interpolation qualification
centroid sample out vec4 rep2; // ERROR, replicating auxiliary qualification
in uniform vec4 rep3; // ERROR, replicating storage qualification
int anonconst;
const int aconst = 5;
const int a = aconst;
const int b = anonconst; // ERROR at global scope
const int foo() // ERROR, no const functions
{
const int a = aconst;
const int b = anonconst;
const int c = a; // still compile-time const
const int d = b; // not a compile-time const
float x[c]; // okay
float y[d]; // ERROR
return b;
}
void main()
{
int i;
if (i == 3)
int j = i;
else
int k = j; // ERROR, j is undeclared
int m = k; // ERROR, k is undeclared
int n = j; // ERROR, j is undeclared
while (true)
int jj;
int kk = jj; // ERROR, jj is undeclared
}
const float cx = 4.20;
const float dx = 4.20;
void bar(in highp volatile vec4 v)
{
int s;
s.x; // okay
s.y; // ERROR
if (bad[0].x == cx.x)
;
if (cx.x == dx.x)
badorder3 = bad[0];
float f;
vec3 smeared = f.xxx;
f.xxxxx; // ERROR
f.xxy; // ERROR
}
layout(binding = 3) uniform; // ERROR
layout(binding = 3) uniform boundblock { int aoeu; } boundInst;
layout(binding = 7) uniform anonblock { int aoeu; } ;
layout(location = 1) in; // ERROR
layout(binding = 1) in inblock { int aoeua; }; // ERROR
layout(binding = 100000) uniform anonblock2 { int aooeu; } ;
layout(binding = 4) uniform sampler2D sampb1;
layout(binding = 5) uniform sampler2D sampb2[10];
layout(binding = 80) uniform sampler2D sampb3; // ERROR, binding too big
layout(binding = 31) uniform sampler2D sampb4;
layout(binding = 79) uniform sampler2D sampb5[2]; // ERROR, binding too big
int fgfg(float f, mediump int i);
int fgfg(float f, highp int i);
out gl_PerVertex {
float gl_ClipDistance[4];
};
patch in vec4 patchIn; // ERROR
patch out vec4 patchOut; // ERROR
void bar23444()
{
mat4x3 m43; \
float a1 = m43[3].y;
vec3 v3;
int a2 = m43.length();
a2 += m43[1].length();
a2 += v3.length();
const float b = 2 * a1;
int a = gl_MinProgramTexelOffset + gl_MaxProgramTexelOffset;
}
const int comma0 = (2, 3); // ERROR
int comma1[(2, 3)]; // ERROR
layout(r32i) uniform iimage2D iimg2D;
layout(rgba32i) uniform iimage2D iimg2Drgba;
layout(rgba32f) uniform image2D img2Drgba;
layout(r32ui) uniform uimage2D uimg2D;
uniform image2DMS img2DMS; // ERROR image variables not declared writeonly must have format layout qualifier
uniform writeonly image2DMS img2DMSWO;
void qux()
{
int i = aoeu;
imageAtomicCompSwap(iimg2D, ivec2(i,i), i, i);
imageAtomicAdd(uimg2D, ivec2(i,i), uint(i));
imageAtomicMin(iimg2Drgba, ivec2(i,i), i); // ERROR iimg2Drgba does not have r32i layout
imageAtomicMax(img2Drgba, ivec2(i,i), i); // ERROR img2Drgba is not integer image
ivec4 pos = imageLoad(iimg2D, ivec2(i,i));
vec4 col = imageLoad(img2DMS, ivec2(i,i), i);
imageStore(img2DMSWO, ivec2(i,i), i, vec4(0));
imageLoad(img2DMSWO, ivec2(i,i), i); // ERROR, drops writeonly
}
volatile float vol; // ERROR, not an image
readonly int vol2; // ERROR, not an image
void passr(coherent readonly iimage2D image)
{
}
layout(r32i) coherent readonly uniform iimage2D qualim1;
layout(r32i) coherent volatile readonly uniform iimage2D qualim2;
void passrc()
{
passr(qualim1);
passr(qualim2); // ERROR, drops volatile
passr(iimg2D);
}
layout(rg8i) uniform uimage2D i1bad; // ERROR, type mismatch
layout(rgba32i) uniform image2D i2bad; // ERROR, type mismatch
layout(rgba32f) uniform uimage2D i3bad; // ERROR, type mismatch
layout(r8_snorm) uniform iimage2D i4bad; // ERROR, type mismatch
layout(rgba32ui) uniform iimage2D i5bad; // ERROR, type mismatch
layout(r8ui) uniform iimage2D i6bad; // ERROR, type mismatch
uniform offcheck {
layout(offset = 16) int foo; // ERROR
} offcheckI;
uniform sampler1D samp1D;
uniform sampler1DShadow samp1Ds;
void qlod()
{
int levels;
levels = textureQueryLevels(samp1D); // ERROR, not until 430
levels = textureQueryLevels(samp1Ds); // ERROR, not until 430
}
layout(binding=0) writeonly uniform image1D badArray[];

View File

@ -0,0 +1,21 @@
#version 420 core
// testing input arrays without a gl_in[] block redeclaration, see 400.geom for with
int i;
layout(triangles) in;
in vec4 colorun[];
in vec4 color3[3];
void foo()
{
gl_in.length();
gl_in[1].gl_Position;
gl_in.length();
gl_in[i].gl_Position; // should be sized to 3 by 'triangles'
}
in gl_PerVertex { // ERROR, already used
vec4 gl_Position;
} gl_in[];

87
deps/glslang/glslang/Test/430.comp vendored Normal file
View File

@ -0,0 +1,87 @@
#version 430 core
layout(local_size_x = 2) in;
layout(local_size_x = 16) in; // ERROR, changing
layout(local_size_z = 4096) in; // ERROR, too large
layout(local_size_x = 2) in;
const int total = gl_MaxComputeWorkGroupCount.y
+ gl_MaxComputeUniformComponents
+ gl_MaxComputeTextureImageUnits
+ gl_MaxComputeImageUniforms
+ gl_MaxComputeAtomicCounters
+ gl_MaxComputeAtomicCounterBuffers;
buffer ShaderStorageBlock
{
int value;
float values[];
};
buffer InvalidShaderStorageBlock
{
float values[];
int value;
} invalid;
void main()
{
barrier();
memoryBarrier();
memoryBarrierAtomicCounter();
memoryBarrierBuffer();
memoryBarrierShared();
memoryBarrierImage();
groupMemoryBarrier();
value = int(values[gl_LocalInvocationIndex]);
int a;
if (a > 10)
barrier();
}
layout(location = 2) in vec3 v3; // ERROR
in float f; // ERROR
out float fo; // ERROR
shared vec4 s;
layout(location = 2) shared vec4 sl; // ERROR
shared float fs = 4.2; // ERROR
layout(local_size_x = 2, local_size_y = 3, local_size_z = 4) out; // ERROR
int arrX[gl_WorkGroupSize.x];
int arrY[gl_WorkGroupSize.y];
int arrZ[gl_WorkGroupSize.z];
readonly buffer roblock
{
int value;
float values[];
} ro;
void foo()
{
ro.values[2] = 4.7; // ERROR, readonly
ro.values.length();
barrier();
}
uniform double roll;
uniform writeonly image2D destTex;
void fooaoeu() {
ivec2 storePos = ivec2(gl_GlobalInvocationID.xy);
double localCoef = length(vec2(ivec2(gl_LocalInvocationID.xy)-8)/8.0);
dvec4 aa = dvec4(0.4, 0.2, 0.3, 0.4);
double globalCoef = 1.0;
int i = globalCoef; // ERROR, can't convert from double to int
double di = i;
}
in inb { // ERROR
int a;
} inbi;
out outb { // ERROR
int a;
} outbi;

223
deps/glslang/glslang/Test/430.vert vendored Normal file
View File

@ -0,0 +1,223 @@
#version 430 core
layout(location = 3) vec4 v4; // ERROR
layout(location = 4) uniform vec4 uv4;
layout(location = 2) in inb1 { vec4 v; } b1; // ERROR
layout(location = 2) out outb1 { vec4 v; } b2; // ERROR
out gl_PerVertex {
float gl_ClipDistance[];
};
void foo()
{
gl_ClipDistance[2] = 3.7;
}
struct sp {
highp float f;
in float g; // ERROR
uniform float h; // ERROR
invariant float i; // ERROR
volatile float j; // ERROR
layout(row_major) mat3 m3; // ERROR
};
void foo3(invariant vec4 v4, // ERROR
volatile vec3 v3,
layout(location = 3) vec2 v2, // ERROR
centroid vec3 cv3) // ERROR
{
}
struct S {
mat3x2 m[7]; // needs 7*3 locations
float f; // needs 1 location
}; // needs 22 locations
layout(location = 10) out S cs[2]; // 10 through 10 + 2 * 22 - 1 = 53
layout(location = 54) out float cf;
layout(location = 53) out float cg; // ERROR, collision at 31
layout(location = 10) in vec4 alias1;
layout(location = 10) in vec4 alias2; // okay for vertex input on desktop
out float gl_ClipDistance[17]; // ERROR, size too big
// enhanced_layouts (most tests are in 440.*)
layout(location = start*start - 2 - 4) in vec4 v6e; // ERROR
layout(location = 28) in inblock2e {
layout(location = 25) float f2; // ERROR
} ininst2e;
in ublock4e {
layout(location = 50) float f1; // ERROR
layout(location = 51) float f2; // ERROR
} in4e;
layout(align=16, std140) uniform ubl4e { int a; } inst4e;// ERROR
layout(align=32) uniform ubl9e { // ERROR
layout(offset=12, align=4) float f; // ERROR
layout(offset=20) float g; // ERROR
} inst9e;
layout(std140) uniform blocke {
vec4 a;
layout(offset = 32) vec3 b; // ERROR
} spinste;
int aconste[gl_MaxTransformFeedbackBuffers]; // ERROR
int bconste[gl_MaxTransformFeedbackInterleavedComponents]; // ERROR
out bblck2 {
layout(xfb_offset=64) vec4 bbv; // ERROR
} bbinst2;
layout(xfb_buffer = 3, xfb_stride = 64) out; // ERROR
layout(xfb_buffer=2, xfb_offset=48, xfb_stride=80) out vec4 bge; // ERROR
layout( xfb_offset=32, xfb_stride=64) out vec4 bhe; // ERROR
layout(xfb_stride=80, xfb_buffer=2, xfb_offset=16) out bblck4e { // ERROR
vec4 bbv1;
vec4 bbv2;
} bbinst4e;
out bblck5e {
layout(xfb_offset=0) vec4 bbv1; // ERROR
layout(xfb_stride=64, xfb_buffer=3, xfb_offset=48) vec4 bbv2; // ERROR
} bbinst5e;
#extension GL_ARB_enhanced_layouts : enable
layout(align=16, std140) uniform ubl4 { int a; } inst4;
layout(std430) uniform;
layout(align=32) uniform ubl9 {
layout(offset=12, align=4) float f;
layout(offset=20) float g;
} inst9;
layout(std140) uniform block {
vec4 a; // a takes offsets 0-15
layout(offset = 32) vec3 b; // b takes offsets 32-43
} spinst;
int aconst[gl_MaxTransformFeedbackBuffers];
int bconst[gl_MaxTransformFeedbackInterleavedComponents];
const int start2 = 5;
layout(location = start2 * start2 - 2 - 4) in vec4 v6;
layout(location = 28) in inblock2 { // ERROR, input block in vertex shader, other errors are valid checks still...
bool b1;
float f1;
layout(location = 25) float f2;
} ininst2;
in ublock4 { // ERROR, input block in vertex shader, other errors are valid checks still...
layout(location = 50) float f1;
layout(location = 51) float f2;
} in4;
out bblck2g {
layout(xfb_offset=64) vec4 bbv;
} bbinst2g;
layout(xfb_buffer = 1, xfb_stride = 80) out; // default buffer is 3
layout(xfb_buffer=1, xfb_offset=48, xfb_stride=80) out vec4 bg;
layout( xfb_offset=32, xfb_stride=80) out vec4 bh;
layout(xfb_stride=80, xfb_buffer=1, xfb_offset=16) out bblck4 {
vec4 bbv1;
} bbinst4;
out bblck5 {
layout(xfb_offset=0) vec4 bbv1;
layout(xfb_stride=80, xfb_buffer=1, xfb_offset=64) vec4 bbv2;
} bbinst5;
shared vec4 sharedv; // ERROR
void fooBarrier()
{
barrier(); // ERROR
memoryBarrier();
memoryBarrierAtomicCounter();
memoryBarrierBuffer();
memoryBarrierShared(); // ERROR
memoryBarrierImage();
groupMemoryBarrier(); // ERROR
}
buffer vec4 v; // ERROR
uniform sampler2DMS s2dms;
uniform usampler2DMSArray us2dmsa;
layout(rgba32i) uniform iimage2DMS ii2dms;
layout(rgba32f) uniform image2DMSArray i2dmsa;
void fooq()
{
int s = textureSamples(s2dms); // ERROR
s += textureSamples(us2dmsa); // ERROR
s += imageSamples(ii2dms); // ERROR
s += imageSamples(i2dmsa); // ERROR
}
#extension GL_ARB_shader_texture_image_samples : enable
void fooq2()
{
int s = textureSamples(s2dms);
s += textureSamples(us2dmsa);
s += imageSamples(ii2dms);
s += imageSamples(i2dmsa);
}
uniform sampler1D samp1D;
uniform usampler2D usamp2D;
uniform isampler3D isamp3D;
uniform isamplerCube isampCube;
uniform isampler1DArray isamp1DA;
uniform sampler2DArray samp2DA;
uniform usamplerCubeArray usampCubeA;
uniform sampler1DShadow samp1Ds;
uniform sampler2DShadow samp2Ds;
uniform samplerCubeShadow sampCubes;
uniform sampler1DArrayShadow samp1DAs;
uniform sampler2DArrayShadow samp2DAs;
uniform samplerCubeArrayShadow sampCubeAs;
uniform samplerBuffer sampBuf;
uniform sampler2DRect sampRect;
void qlod()
{
int levels;
levels = textureQueryLevels(samp1D);
levels = textureQueryLevels(usamp2D);
levels = textureQueryLevels(isamp3D);
levels = textureQueryLevels(isampCube);
levels = textureQueryLevels(isamp1DA);
levels = textureQueryLevels(samp2DA);
levels = textureQueryLevels(usampCubeA);
levels = textureQueryLevels(samp1Ds);
levels = textureQueryLevels(samp2Ds);
levels = textureQueryLevels(sampCubes);
levels = textureQueryLevels(samp1DAs);
levels = textureQueryLevels(samp2DAs);
levels = textureQueryLevels(sampCubeAs);
levels = textureQueryLevels(sampBuf); // ERROR
levels = textureQueryLevels(sampRect); // ERROR
}

108
deps/glslang/glslang/Test/430AofA.frag vendored Normal file
View File

@ -0,0 +1,108 @@
#version 430
float[4][5][6] many[1][2][3];
float gu[][7];
float gimp[][]; // ERROR, implicit inner
float g4[4][7];
float g5[5][7];
float[4][7] foo(float a[5][7])
{
float r[7];
r = a[2];
float[](a[0], a[1], r, a[3]); // ERROR, too few dims
float[4][7][4](a[0], a[1], r, a[3]); // ERROR, too many dims
return float[4][7](a[0], a[1], r, a[3]);
return float[][](a[0], a[1], r, a[3]);
return float[][7](a[0], a[1], a[2], a[3]);
}
void bar(float[5][7]) {}
void main()
{
{
float gu[3][4][2];
gu[2][4][1] = 4.0; // ERROR, overflow
}
vec4 ca4[3][2] = vec4[][](vec4[2](vec4(0.0), vec4(1.0)),
vec4[2](vec4(0.0), vec4(1.0)),
vec4[2](vec4(0.0), vec4(1.0)));
vec4 caim[][2] = vec4[][](vec4[2](vec4(4.0), vec4(2.0)),
vec4[2](vec4(4.0), vec4(2.0)),
vec4[2](vec4(4.0), vec4(2.0)));
vec4 caim2[][] = vec4[][](vec4[2](vec4(4.0), vec4(2.0)),
vec4[2](vec4(4.0), vec4(2.0)),
vec4[2](vec4(4.0), vec4(2.0)));
vec4 caim3[3][] = vec4[][](vec4[2](vec4(4.0), vec4(2.0)),
vec4[2](vec4(4.0), vec4(2.0)),
vec4[2](vec4(4.0), vec4(2.0)));
vec4 a4[3][2] = {vec4[](vec4(0.0), vec4(1.0)),
vec4[2](vec4(0.0), vec4(1.0)),
vec4[2](vec4(0.0), vec4(1.0)) };
vec4 aim[][2] = {vec4[2](vec4(4.0), vec4(2.0)),
vec4[](vec4(4.0), vec4(2.0)),
vec4[2](vec4(4.0), vec4(2.0)) };
vec4 aim2[][] = {vec4[2](vec4(4.0), vec4(2.0)),
vec4[2](vec4(4.0), vec4(2.0)),
vec4[](vec4(4.0), vec4(2.0)) };
vec4 aim3[3][] = {vec4[2](vec4(4.0), vec4(2.0)),
vec4[2](vec4(4.0), vec4(2.0)),
vec4[2](vec4(4.0), vec4(2.0)) };
vec4 bad2[3][] = {vec4[2](vec4(4.0), vec4(2.0)), // ERROR
vec4[3](vec4(4.0), vec4(2.0), vec4(5.0)),
vec4[2](vec4(4.0), vec4(2.0)) };
vec4 bad3[3][] = {vec4[3](vec4(4.0), vec4(2.0), vec4(5.0)), // ERROR
vec4[2](vec4(4.0), vec4(2.0)),
vec4[2](vec4(4.0), vec4(2.0)) };
vec4 bad4[4][] = {vec4[2](vec4(4.0), vec4(2.0)), // ERROR
vec4[2](vec4(4.0), vec4(2.0)),
vec4[2](vec4(4.0), vec4(2.0)) };
g4 = foo(g5);
g5 = g4; // ERROR, wrong types
gu = g4; // ERROR, not yet sized
foo(gu); // ERROR, not yet sized
bar(g5);
if (foo(g5) == g4)
;
if (foo(g5) == g5) // ERROR, different types
;
float u[][7];
u[2][2] = 3.0;
float u[5][7];
u[5][2] = 5.0; // ERROR
foo(u);
}
void foo3()
{
float resize1[][5][7];
resize1.length(); // ERROR
resize1[1][4][5] = 2.0;
resize1.length(); // ERROR
float resize1[3][5][7];
resize1.length(); // 3 in AST
resize1[1].length(); // 5 in AST
resize1[1][1].length(); // 7 in AST
resize1[1][1][1].length(); // ERROR
float resize2[][5][7];
float resize2[3][4][7]; // ERROR, inner dim change
float resize3[][5][7];
float resize3[3][5][9]; // ERROR, inner dim changed
float resize4[][5][7];
int resize4[3][5][7]; // ERROR, element type
}

74
deps/glslang/glslang/Test/430scope.vert vendored Normal file
View File

@ -0,0 +1,74 @@
#version 430 core
int f(int a, int b, int c)
{
int a = b; // ERROR, redefinition
{
float a = float(a) + 1.0; // okay
}
return a;
}
int f(int a, int b, int c); // okay to redeclare
bool b;
float b(int a); // ERROR: redefinition
float c(int a);
bool c; // ERROR: redefinition
float f; // ERROR: redefinition
float tan; // okay, hides built-in function
float sin(float x); // okay, can redefine built-in functions
float cos(float x) // okay, can redefine built-in functions
{
return 1.0;
}
bool radians(bool x) // okay, can overload built-in functions
{
return true;
}
invariant gl_Position;
void main()
{
int g(); // okay
g();
float sin; // okay
sin;
sin(0.7); // ERROR, use of hidden function
f(1,2,3);
float f; // hides f()
f = 3.0;
gl_Position = vec4(f);
for (int f = 0; f < 10; ++f)
++f;
int x = 1;
{
float x = 2.0, /* 2nd x visible here */ y = x; // y is initialized to 2
int z = z; // ERROR: z not previously defined.
}
{
int x = x; // x is initialized to '1'
}
struct S
{
int x;
};
{
S S = S(0); // 'S' is only visible as a struct and constructor
S.x; // 'S' is now visible as a variable
}
int degrees;
degrees(3.2); // ERROR, use of hidden built-in function
}

2
deps/glslang/glslang/Test/435.vert vendored Normal file
View File

@ -0,0 +1,2 @@
#version 435
void main() {}

153
deps/glslang/glslang/Test/440.frag vendored Normal file
View File

@ -0,0 +1,153 @@
#version 440
// Note 'location'-only tests for enhanced layouts are in 330.frag
// Generic 'component' tests are in 440.vert
// a consumes components 2 and 3 of location 4
layout(location = 4, component = 2) in vec2 a;
// b consumes component 1 of location 4
layout(location = 4, component = 1) in float b;
layout(location = 4, component = 2) in vec2 h; // ERROR, component overlap not okay for fragment in
layout(location = 3, component = 2) in vec3 c; // ERROR: c overflows components 2 and 3
// e consumes beginning (components 0, 1 and 2) of each of 6 slots
layout(location = 20, component = 0) in vec3 e[6];
// f consumes last component of the same 6 slots
layout(location = 20, component = 3) in float f[6];
layout(location = 30, component = 3) out int be;
layout(location = 30, component = 0) out vec3 bf; // ERROR, not the same basic type
writeonly uniform; // ERROR
readonly in; // ERROR
flat out; // ERROR
mediump uniform;
layout(offset=12) uniform; // ERROR
layout(offset=12) in; // ERROR
layout(offset=12) out; // ERROR
layout(align=16) uniform; // ERROR
layout(align=16) in; // ERROR
layout(align=16) out; // ERROR
layout(offset=12) uniform ubl1 { int a; } inst1; // ERROR
layout(offset=12) in inbl2 { int a; } inst2; // ERROR
layout(offset=12) out inbl3 { int a; } inst3; // ERROR
layout(align=16, std140) uniform ubl4 { int a; } inst4;
layout(align=16) uniform ubl8 { int a; } inst8; // ERROR, no packing
layout(align=16) in inbl5 { int a; } inst5; // ERROR
layout(align=16) out inbl6 { int a; } inst6; // ERROR
layout(offset=12) uniform vec4 v1; // ERROR
layout(offset=12) in vec4 v2; // ERROR
layout(offset=12) out vec4 v3; // ERROR
layout(align=16) uniform vec4 v4; // ERROR
layout(align=16) in vec4 v5; // ERROR
layout(align=16) out vec4 v6; // ERROR
layout(std140) in; // ERROR
layout(std140) uniform vec4 v7; // ERROR
layout(align=48) uniform ubl7 { // ERROR, not power of 2
layout(offset=12, align=4) float f; // ERROR, no packing
} inst7;
in ibl10 {
layout(offset=12) float f; // ERROR
layout(align=4) float g; // ERROR
} inst10;
layout(std430) uniform;
layout(align=32) uniform ubl9 {
float e;
layout(offset=12, align=4) float f;
layout(offset=20) float g;
float h;
} inst9;
uniform ubl11 {
layout(offset=12, align=4) float f;
float g;
} inst11;
layout(std140) uniform block {
vec4 a; // a takes offsets 0-15
layout(offset = 32) vec3 b; // b takes offsets 32-43
layout(offset = 40) vec2 c; // ERROR, lies within previous member
layout(align = 6) double g; // ERROR, 6 is not a power of 2
layout(offset=68) double h; // ERROR, offset not aligned
} specExampleErrors;
layout(std140) uniform block2 {
vec4 a; // a takes offsets 0-15
layout(offset = 32) vec3 b; // b takes offsets 32-43
layout(offset = 48) vec2 d; // d takes offsets 48-55
layout(align = 16) float e; // e takes offsets 64-67
layout(align = 2) double f; // f takes offsets 72-79
layout(offset = 80) float h; // h takes offsets 80-83
layout(align = 64) dvec3 i; // i takes offsets 128-151
layout(offset = 164, align = 8) float j; // j takes offsets 168-171
} specExample;
layout(std430) buffer block430 {
vec4 a; // a takes offsets 0-15
layout(offset = 32) vec3 b; // b takes offsets 32-43
layout(offset = 40) vec2 c; // ERROR, lies within previous member
layout(align = 6) double g; // ERROR, 6 is not a power of 2
layout(offset=68) double h; // ERROR, offset not aligned
layout(align = 0) double i; // ERROR, 0 not a power of 2
} specExampleErrors430;
layout(std430) buffer block2430 {
vec4 a; // a takes offsets 0-15
layout(offset = 32) vec3 b; // b takes offsets 32-43
layout(offset = 48) vec2 d; // d takes offsets 48-55
layout(align = 16) float e; // e takes offsets 64-67
layout(align = 2) double f; // f takes offsets 72-79
layout(offset = 80) float h; // h takes offsets 80-83
layout(align = 64) dvec3 i; // i takes offsets 128-151
layout(offset = 164, align = 8) float j; // j takes offsets 168-171
} specExample430;
layout(std430, align = 128) buffer block24300 {
vec4 a;
vec3 b;
vec2 d;
float e;
double f;
float h;
dvec3 i;
} specExample4300;
layout(std430, align = 128) buffer block24301 {
vec4 a;
vec3 b;
vec2 d;
layout(offset=388) float e;
layout(align=8) double f;
float h;
dvec3 i;
} specExample4301;
int aconst[gl_MaxTransformFeedbackBuffers];
int bconst[gl_MaxTransformFeedbackInterleavedComponents];
sample in vec3 sampInArray[4];
void interp()
{
interpolateAtCentroid(sampInArray[2].xy);
interpolateAtSample(sampInArray[2].x.x, 2);
}
int layer()
{
return gl_Layer;
}

197
deps/glslang/glslang/Test/440.vert vendored Normal file
View File

@ -0,0 +1,197 @@
#version 440
// Note 'location' tests for enhanced layouts are in 330.frag
layout(location = 2, component = 2) in vec2 a;
layout(location = 2, component = 1) in float b;
layout(location = 3, component = 2) in vec3 c; // ERROR: c overflows components 2 and 3
layout(location = 0, component = 3) in float d[4];
layout(location = 4, component = 0) in vec3 e[5];
layout(location = 4, component = 3) in float f[5];
layout(location = 9, component = 4) in float g[6]; // ERROR, component too big
layout(location = 4, component = 2) in vec2 h; // component overlap okay for vertex in
layout(location = 3, component = 2) out vec2 i;
layout(location = 3, component = 0) out vec2 j;
layout(location = 4, component = 2) out vec2 k;
layout(location = 4, component = 2) out vec2 m; // ERROR, component overlap
layout(location = 2, component = 2) out vec2 n;
layout(location = 2, component = 0) out vec3 p; // ERROR, component overlap
layout(location = 10, component = 3) out float q[6];
layout(location = 10, component = 0) out vec3 r[6];
layout(location = 15, component = 3) out float s; // ERROR, overlap
layout(location = 10, component = 1) out float t; // ERROR, overlap
layout(location = 20, component = 2) out float u;
layout(location = 20, component = 0) out float v;
layout(location = 20, component = 3) out float w;
layout(location = 20, component = 1) out vec2 x; // ERROR, overlap
layout(location = 30, component = 3) out vec2 y; // ERROR, goes to component 4
layout(location = 31, component = 1) out vec4 z; // ERROR, goes to component 4
layout(location = 32, component = 1) out mat4 ba; // ERROR
layout(location = 33, component = 1) out struct S {int a;} Ss; // ERROR
layout(location = 34, component = 1) out bn { int a;} bb; // ERROR
layout(component = 1) out float bc; // ERROR, no location
out blockname {
layout(location = 40, component = 2) out float u;
layout(location = 40, component = 0) out float v;
layout(location = 40, component = 3) out float w;
layout(location = 40, component = 1) out vec2 x; // ERROR, overlap
layout(location = 41, component = 3) out vec2 y; // ERROR, goes to component 4
layout(location = 42, component = 1) out vec4 z; // ERROR, goes to component 4
layout(location = 42, component = 1) out mat4 ba; // ERROR
layout(location = 43, component = 1) out S Ss; // ERROR
} bd;
layout(location = 1, component = 1) out; // ERROR, no global setting
layout(location = 50, component = 3) out int be;
layout(location = 50, component = 0) out vec3 bf;
layout(location = 51, component = 1) out double dfo; // ERROR, odd component
layout(location = 52, component = 2) out dvec2 dvo; // ERROR, overflow
layout(location = 53) out double dfo2;
layout(location = 53, component = 2) out vec2 ffv2; // okay, fits
layout(location = 54) out dvec4 dvec4out; // uses up location 55 too
layout(location = 55) out float overf; // ERROR, collides with previous dvec4
layout(location = 56, component = 1) out vec2 df2o;
layout(location = 56, component = 3) out float sf2o;
layout(location = 57, component = 2) out vec2 dv3o;
layout(location = 57, component = 3) out float sf4o; // ERROR, overlapping component
layout(location=58) out flat dvec3 dv3o2; // uses part of location 59
layout(location=59, component=2) out flat double dfo3; // okay, fits
layout(location=59, component=0) out flat double dfo4; // ERROR, overlaps the dvec3 in starting in 58
out bblck1 {
vec4 bbv;
} bbinst1;
out bblck2 {
layout(xfb_offset=64) vec4 bbv;
} bbinst2;
layout(xfb_buffer = 3, xfb_stride = 64) out; // default buffer is 3
out bblck3 {
layout(xfb_offset=16) vec4 bbv; // in xfb_buffer 3
} bbinst3;
uniform ubblck3 {
layout(xfb_offset=16) vec4 bbv; // ERROR, not in a uniform
} ubbinst3;
layout(xfb_buffer=2, xfb_offset=48, xfb_stride=80) out vec4 bg;
layout( xfb_offset=32, xfb_stride=64) out vec4 bh;
layout(xfb_offset=48) out; // ERROR
layout(xfb_stride=80, xfb_buffer=2, xfb_offset=16) out bblck4 {
vec4 bbv1;
vec4 bbv2;
} bbinst4;
out bblck5 {
layout(xfb_offset=0) vec4 bbv1;
layout(xfb_stride=64, xfb_buffer=3, xfb_offset=48) vec4 bbv2;
layout(xfb_buffer=2) vec4 bbv3; // ERROR, wrong buffer
} bbinst5;
out layout(xfb_buffer=2) bblck6 {
layout(xfb_offset=0) vec4 bbv1;
layout(xfb_stride=64, xfb_buffer=3, xfb_offset=32) vec4 bbv2; // ERROR, overlap 32 from bh, and buffer contradiction
layout(xfb_buffer=2, xfb_offset=0) vec4 bbv3; // ERROR, overlap 0 from bbinst5
layout(xfb_buffer=2) vec4 bbv5;
layout(xfb_offset=24) float bbf6; // ERROR, overlap 24 from bbv1 in bbinst4
} bbinst6;
layout(xfb_stride=48) out; // ERROR, stride of buffer 3
layout(xfb_buffer=1) out; // default buffer is 1
layout(xfb_offset=4) out float bj;
layout(xfb_offset=0) out ivec2 bk; // ERROR, overlap 4
layout(xfb_buffer=3, xfb_stride=48) out; // ERROR, stride of buffer 3 (default is now 3)
layout(xfb_stride=48) out float bl; // ERROR, stride of buffer 3
layout(xfb_stride=48) out bblck7 { // ERROR, stride of buffer 3
layout(xfb_stride=64) vec4 bbv1;
layout(xfb_stride=32) vec4 bbv2; // ERROR, stride of buffer 3
} bbinst7;
struct S5 {
int i; // 4 bytes plus 4 byte hole
double d; // 8 bytes
float f; // 4 bytes
}; // total size = 20
struct T {
bool b; // 4 plus 4 byte hole
S5 s; // 20
vec2 v2; // 8
}; // total size = 36
out layout(xfb_buffer=0, xfb_offset=0, xfb_stride=92) bblck8 { // ERROR, stride not multiple of 8
bool b; // offset 0
T t; // offset 8, size 40
int i; // offset 40 + 4 = 48
mat3x3 m3; // offset 52
float f; // offset 52 + 9*4 = 88
float g; // ERROR, overflow stride
} bbinst8;
out layout(xfb_buffer=4) bblck9 {
layout(xfb_offset=1) bool b; // ERROR
layout(xfb_offset=12) T t; // ERROR
layout(xfb_offset=52) mat3x3 m3; // non-multiple of 8 okay
layout(xfb_offset=90) int i; // ERROR
layout(xfb_offset=98) double d; // ERROR
layout(xfb_offset=108) S s; // non-multiple of 8 okay
} bbinst9;
layout(xfb_buffer=5, xfb_stride=6) out; // link ERROR, stride not multiple of 4
layout(xfb_offset=0) out float bm;
layout(xfb_buffer=6, xfb_stride=2000) out; // ERROR, stride too big
out layout(xfb_buffer=7, xfb_offset=0) bblck10 { // link ERROR, implicit stride too big
dmat4x4 m1;
dmat4x4 m2;
float f;
} bbinst10;
layout(xfb_buffer = 3) out;
layout(xfb_offset = 32) out gl_PerVertex {
layout(xfb_buffer = 2) float gl_PointSize; // ERROR, change in xfb_buffer
vec4 gl_Position;
};
int drawParamsBad()
{
return gl_BaseVertexARB + gl_BaseInstanceARB + gl_DrawIDARB; // ERROR, extension not requested
}
#extension GL_ARB_shader_draw_parameters: enable
int drawParams()
{
return gl_BaseVertexARB + gl_BaseInstanceARB + gl_DrawIDARB;
gl_BaseVertexARB = 3; // ERROR, can't write to shader 'in'
gl_BaseInstanceARB = 3; // ERROR, can't write to shader 'in'
gl_DrawIDARB = 3; // ERROR, can't write to shader 'in'
glBaseInstanceARB; // ERROR, not defined
}

6
deps/glslang/glslang/Test/450.comp vendored Normal file
View File

@ -0,0 +1,6 @@
#version 450 core
layout(local_size_x = 0) in; // ERROR, 0 not allowed
void main()
{
shared float f; // ERROR shared must be global
}

68
deps/glslang/glslang/Test/450.frag vendored Normal file
View File

@ -0,0 +1,68 @@
#version 450 core
in float in1;
in vec2 in2;
in vec3 in3;
in vec4 in4;
void main()
{
vec2 v2 = dFdxFine(in2);
vec3 v3 = dFdyCoarse(in3);
vec4 v4 = fwidth(in4);
v4 = dFdyFine(in4);
v3 = dFdyFine(in3);
float f = dFdx(in1) + dFdxFine(in1) + dFdxCoarse(in1);
v4 = fwidthCoarse(in4) + fwidthFine(in4);
float cull = gl_CullDistance[2];
float consts = gl_MaxCullDistances + gl_MaxCombinedClipAndCullDistances + gl_MaxSamples;
if (gl_HelperInvocation)
++v4;
int sum = gl_MaxVertexImageUniforms +
gl_MaxFragmentImageUniforms +
gl_MaxComputeImageUniforms +
gl_MaxCombinedImageUniforms +
gl_MaxCombinedShaderOutputResources;
bool b1, b3, b;
uint uin;
bvec2 b2 = mix(bvec2(b1), bvec2(b3), bvec2(b));
uint um = mix(uin, uin, b);
ivec3 im3 = mix(ivec3(uin), ivec3(uin), bvec3(b));
}
uniform sampler2DMS s2dms;
uniform usampler2DMSArray us2dmsa;
layout(rgba32i) uniform iimage2DMS ii2dms;
layout(rgba32f) uniform image2DMSArray i2dmsa;
void foo()
{
int s = textureSamples(s2dms);
s += textureSamples(us2dmsa);
s += imageSamples(ii2dms);
s += imageSamples(i2dmsa);
float f = imageAtomicExchange(i2dmsa, ivec3(in3), 2, 4.5);
}
in float gl_CullDistance[6];
float cull(int i)
{
return (i >= 6) ? gl_CullDistance[5] : gl_CullDistance[i];
}
layout(location = 6) in bName1 {
float f;
layout(location = 7) float g;
mat4 m;
} bInst1;
layout(location = 12) in bName2 {
float f;
layout(location = 13) float g; // ERROR, location on array
} bInst2[3];
layout(early_fragment_tests) in float f; // ERROR, must be standalone

19
deps/glslang/glslang/Test/450.geom vendored Normal file
View File

@ -0,0 +1,19 @@
#version 450 core
in gl_PerVertex {
float gl_CullDistance[3];
} gl_in[];
out gl_PerVertex {
float gl_CullDistance[3];
};
layout(triangles) in;
void main()
{
gl_in[3].gl_Position; // ERROR, out of range
gl_CullDistance[2] = gl_in[1].gl_CullDistance[2];
}
layout(points) in float f[3]; // ERROR, must be standalone

23
deps/glslang/glslang/Test/450.tesc vendored Normal file
View File

@ -0,0 +1,23 @@
#version 450 core
in gl_PerVertex {
float gl_CullDistance[3];
} gl_in[gl_MaxPatchVertices];
out gl_PerVertex {
float gl_CullDistance[3];
} gl_out[4];
void main()
{
gl_out[gl_InvocationID].gl_CullDistance[2] = gl_in[1].gl_CullDistance[2];
}
layout(location = 4) out bName1 {
float f;
layout(location = 5) float g;
} bInst1[2];
layout(location = 6) out bName2 {
float f;
layout(location = 7) float g; // ERROR, location on array
} bInst2[2][3];

21
deps/glslang/glslang/Test/450.tese vendored Normal file
View File

@ -0,0 +1,21 @@
#version 450 core
in gl_PerVertex {
float gl_CullDistance[3];
} gl_in[gl_MaxPatchVertices];
out gl_PerVertex {
float gl_CullDistance[3];
};
void main()
{
gl_CullDistance[2] = gl_in[1].gl_CullDistance[2];
}
layout(equal_spacing) in float f1[]; // ERROR, must be standalone
layout(fractional_even_spacing) in float f2[]; // ERROR, must be standalone
layout(fractional_odd_spacing) in float f3[]; // ERROR, must be standalone
layout(cw) in float f4[]; // ERROR, must be standalone
layout(ccw) in float f5[]; // ERROR, must be standalone
layout(point_mode) in float f6[]; // ERROR, must be standalone

56
deps/glslang/glslang/Test/450.vert vendored Normal file
View File

@ -0,0 +1,56 @@
#version 450 core
out gl_PerVertex {
float gl_CullDistance[3];
};
void main()
{
gl_CullDistance[2] = 4.5;
}
out bool outb; // ERROR
out sampler2D outo; // ERROR
out float outa[4];
out float outaa[4][2];
struct S { float f; };
out S outs;
out S[4] outasa;
out S outsa[4];
struct SA { float f[4]; };
out SA outSA;
struct SS { float f; S s; };
out SS outSS;
layout(binding = 0) uniform atomic_uint aui;
uint ui;
void foo()
{
SS::f;
atomicCounterAdd(aui, ui); // ERROR, need 4.6
atomicCounterSubtract(aui, ui); // ERROR, need 4.6
atomicCounterMin(aui, ui); // ERROR, need 4.6
atomicCounterMax(aui, ui); // ERROR, need 4.6
atomicCounterAnd(aui, ui); // ERROR, need 4.6
atomicCounterOr(aui, ui); // ERROR, need 4.6
atomicCounterXor(aui, ui); // ERROR, need 4.6
atomicCounterExchange(aui, ui); // ERROR, need 4.6
atomicCounterCompSwap(aui, ui, ui); // ERROR, need 4.6
int a = gl_BaseVertex + gl_BaseInstance + gl_DrawID; // ERROR, need 4.6
bool b1;
anyInvocation(b1); // ERROR, need 4.6
allInvocations(b1); // ERROR, need 4.6
allInvocationsEqual(b1); // ERROR, need 4.6
}
; // ERROR: no extraneous semicolons
layout(location = 0) uniform locBlock { // ERROR, no location uniform block
int a;
};
layout(location = 0) buffer locBuffBlock { // ERROR, no location on buffer block
int b;
};

32
deps/glslang/glslang/Test/460.frag vendored Normal file
View File

@ -0,0 +1,32 @@
#version 460 core
struct S {
float f;
vec4 v;
};
in S s;
void main()
{
interpolateAtCentroid(s.v);
bool b1;
b1 = anyInvocation(b1);
b1 = allInvocations(b1);
b1 = allInvocationsEqual(b1);
}
void attExtBad()
{
// ERRORs, not enabled
[[dependency_length(1+3)]] for (int i = 0; i < 8; ++i) { }
[[flatten]] if (true) { } else { }
}
#extension GL_EXT_control_flow_attributes : enable
void attExt()
{
[[dependency_length(-3)]] do { } while(true); // ERROR, not positive
[[dependency_length(0)]] do { } while(true); // ERROR, not positive
}

15
deps/glslang/glslang/Test/460.vert vendored Normal file
View File

@ -0,0 +1,15 @@
#version 460 core
int i;
; // extraneous semicolon okay
float f;;;
void main()
{
bool b1;
b1 = anyInvocation(b1);
b1 = allInvocations(b1);
b1 = allInvocationsEqual(b1);
}
;
;

View File

@ -0,0 +1,166 @@
#version 130
uniform ivec4 uiv4;
uniform vec4 uv4;
uniform bool ub;
uniform bvec4 ub41, ub42;
uniform float uf;
uniform int ui;
uniform uvec4 uuv4;
uniform uint uui;
void main()
{
vec4 v;
float f;
bool b;
bvec4 bv4;
int i;
uint u;
// floating point
v = radians(uv4);
v += degrees(v);
v += (i = ui*ui, sin(v));
v += cos(v);
v += tan(v);
v += asin(v);
v += acos(v);
v += atan(v);
v += sinh(v);
v += cosh(v);
v += tanh(v);
v += asinh(v);
v += acosh(v);
v += atanh(v);
v += pow(v, v);
v += exp(v);
v += log(v);
v += exp2(v);
v += log2(v);
v += sqrt(v);
v += inversesqrt(v);
v += abs(v);
v += sign(v);
v += floor(v);
v += trunc(v);
v += round(v);
v += roundEven(v);
v += ceil(v);
v += fract(v);
v += mod(v, v);
v += mod(v, v.x);
v += modf(v, v);
v += min(v, uv4);
v += max(v, uv4);
v += clamp(v, uv4, uv4);
v += mix(v,v,v);
v += mix(v,v,bv4);
v += intBitsToFloat(ivec4(i));
v += uintBitsToFloat(uv4);
v += fma(v,v,v);
v += frexp(v);
v += ldexp(v);
v += unpackUnorm2x16(v);
v += unpackUnorm4x8(v);
v += unpackSnorm4x8(v);
v += step(v,v);
v += smoothstep(v,v,v);
v += step(uf,v);
v += smoothstep(uf,uf,v);
v += normalize(v);
v += faceforward(v, v, v);
v += reflect(v, v);
v += refract(v, v, uf);
v += dFdx(v);
v += dFdy(v);
v += fwidth(v);
//noise*(v);
// signed integer
i += abs(ui);
i += sign(i);
i += min(i, ui);
i += max(i, ui);
i += clamp(i, ui, ui);
floatsBitsToInt(v);
packUnorm2x16(v);
packUnorm4x8(v);
packSnorm4x8(v);
// unsigned integer
u = abs(uui);
u += sign(u);
u += min(u, uui);
u += max(u, uui);
u += clamp(u, uui, uui);
u += floatsBitToInt(v);
u += packUnorm2x16(v);
u += packUnorm4x8(v);
i += uui & i; // ERRORs, no int/uint conversions before 400
i += uui ^ i;
i += i | uui;
// bool
b = isnan(uf);
b = isinf(v.y);
b = any(lessThan(v, uv4));
b = (b && any(lessThanEqual(v, uv4)));
b = (b && any(greaterThan(v, uv4)));
b = (b && any(greaterThanEqual(v, uv4)));
b = (b && any(equal(ub41, ub42)));
b = (b && any(notEqual(ub41, ub42)));
b = (b && any(ub41));
b = (b && all(ub41));
b = (b && any(not(ub41)));
i = ((i + ui) * i - ui) / i;
i = i % ui;
if (i == ui || i != ui && i == ui ^^ i != 2)
++i;
f = ((uf + uf) * uf - uf) / uf;
f += length(v);
f += distance(v, v);
f += dot(v, v);
f += dot(f, uf);
f += cross(v.xyz, v.xyz).x;
if (f == uf || f != uf && f != 2.0)
++f;
i &= ui;
i |= 0x42;
i ^= ui;
i %= 17;
i >>= 2;
i <<= ui;
i = ~i;
b = !b;
gl_FragColor = b ? vec4(i) + vec4(f) + v : v;
}

51
deps/glslang/glslang/Test/aggOps.frag vendored Normal file
View File

@ -0,0 +1,51 @@
#version 130
uniform sampler2D sampler;
varying mediump vec2 coord;
varying vec4 u, w;
struct s1 {
int i;
float f;
};
struct s2 {
int i;
float f;
s1 s1_1;
};
uniform s1 foo1;
uniform s2 foo2a;
uniform s2 foo2b;
void main()
{
vec4 v;
s1 a[3], b[3];
a = s1[3](s1(int(u.x), u.y), s1(int(u.z), u.w), s1(14, 14.0));
b = s1[3](s1(17, 17.0), s1(int(w.x), w.y), s1(int(w.z), w.w));
if (foo2a == foo2b)
v = texture2D(sampler, coord);
else
v = texture2D(sampler, 2.0*coord);
if (u == v)
v *= 3.0;
if (u != v)
v *= 4.0;
if (coord == v.yw)
v *= 5.0;
if (a == b)
v *= 6.0;
if (a != b)
v *= 7.0;
gl_FragColor = v;
}

View File

@ -0,0 +1,36 @@
#version 110
varying vec2 tex_coord;
void main (void)
{
vec4 white = vec4(1.0);
vec4 black = vec4(0.2);
vec4 color = white;
// First, cut out our circle
float x = tex_coord.x*2.0 - 1.0;
float y = tex_coord.y*2.0 - 1.0;
float radius = sqrt(x*x + y*y);
if (radius > 1.0) {
if (radius > 1.1) {
++color;
}
gl_FragColor = color;
if (radius > 1.2) {
++color;
}
}
discard;
// If we're near an edge, darken us a tiny bit
if (radius >= 0.75)
color -= abs(pow(radius, 16.0)/2.0);
gl_FragColor = color;
}

View File

@ -0,0 +1,19 @@
#version 110
varying vec2 tex_coord;
void main (void)
{
vec4 white = vec4(1.0);
vec4 black = vec4(0.2);
vec4 color = white;
// First, cut out our circle
float x = tex_coord.x*2.0 - 1.0;
float y = tex_coord.y*2.0 - 1.0;
discard;
gl_FragColor = color;
}

113
deps/glslang/glslang/Test/array.frag vendored Normal file
View File

@ -0,0 +1,113 @@
#version 130
float gu[];
float g4[4];
float g5[5];
uniform int a;
float[4] foo(float a[5])
{
return float[](a[0], a[1], a[2], a[3]);
}
void bar(float[5]) {}
void main()
{
{
float gu[2]; // okay, new scope
gu[2] = 4.0; // ERROR, overflow
}
gu[2] = 4.0; // okay
gu[3] = 3.0;
gu[a] = 5.0; // ERROR
g4 = foo(g5);
g5 = g4; // ERROR
gu = g4; // ERROR
foo(gu); // ERROR
bar(g5);
if (float[4](1.0, 2.0, 3.0, 4.0) == g4)
gu[0] = 2.0;
float u[];
u[2] = 3.0; // okay
float u[5];
u[5] = 5.0; // ERROR
foo(u); // okay
gl_FragData[1000] = vec4(1.0); // ERROR
gl_FragData[-1] = vec4(1.0); // ERROR
gl_FragData[3] = vec4(1.0);
const int ca[] = int[](3, 2);
int sum = ca[0];
sum += ca[1];
sum += ca[2]; // ERROR
const int ca3[3] = int[](3, 2); // ERROR
int ica[] = int[](3, 2);
int ica3[3] = int[](3, 2); // ERROR
ica[3.1] = 3; // ERROR
ica[u[1]] = 4; // ERROR
}
int[] foo213234(); // ERROR
int foo234234(float[]); // ERROR
int foo234235(vec2[] v); // ERROR
vec3 guns[];
float f = guns[7];
void foo()
{
int uns[];
uns[3] = 40;
uns[1] = 30;
guns[2] = vec3(2.4);
float unsf[];
bar(unsf); // ERROR
}
float[] foo2() // ERROR
{
float f[];
return f;
float g[9];
return g; // ERROR
}
float gUnusedUnsized[];
void foo3()
{
float resize1[];
resize1[2] = 4.0;
resize1.length(); // ERROR
float resize1[3];
resize1.length();
float resize2[];
resize2[5] = 4.0;
float resize2[5]; // should be ERROR, but is not
resize2.length();
resize2[5] = 4.0; // ERROR
}
int[] i = int[](); // ERROR, need constructor arguments
float emptyA[];
float b = vec4(emptyA); // ERROR, array can't be a constructor argument
uniform sampler2D s2d[];
void foo4()
{
s2d[a]; // ERROR, can't variably index unsized array
float local[] = gUnusedUnsized; // ERROR, can initialize with runtime-sized array
}

70
deps/glslang/glslang/Test/array100.frag vendored Normal file
View File

@ -0,0 +1,70 @@
#version 100
float gu[]; // ERROR
float g4[4];
float g5[5];
uniform int a;
float[4] foo(float[5] a) // ERROR // ERROR
{
return float[](a[0], a[1], a[2], a[3]); // ERROR
}
void bar(float[5]) {}
void main()
{
{
float gu[2]; // okay, new scope
gu[2] = 4.0; // ERROR, overflow
}
g4 = foo(g5); // ERROR
g5 = g4; // ERROR
gu = g4; // ERROR
foo(gu); // ERROR
bar(g5);
if (float[4](1.0, 2.0, 3.0, 4.0) == g4) // ERROR
gu[0] = 2.0;
float u[5];
u[5] = 5.0; // ERROR
foo(u); // okay
gl_FragData[1000] = vec4(1.0); // ERROR
gl_FragData[-1] = vec4(1.0); // ERROR
gl_FragData[3] = vec4(1.0);
}
struct SA {
vec3 v3;
vec2 v2[4];
};
struct SB {
vec4 v4;
SA sa;
};
SB bar9()
{
SB s;
return s; // ERROR
}
void bar10(SB s) // okay
{
}
void bar11()
{
SB s1, s2;
s1 = s2; // ERROR
bar10(s1);
s2 = bar9(); // ERROR
SB initSb = s1; // ERROR
}

View File

@ -0,0 +1,48 @@
#version 420 core
layout(binding = 0) uniform atomic_uint counter;
uint func(atomic_uint c)
{
return atomicCounterIncrement(c);
}
uint func2(out atomic_uint c) // ERROR
{
return counter; // ERROR, type mismatch
return atomicCounter(counter);
}
void main()
{
atomic_uint non_uniform_counter; // ERROR
uint val = atomicCounter(counter);
atomicCounterDecrement(counter);
}
layout(binding = 1, offset = 3) uniform atomic_uint countArr[4];
uniform int i;
void opac()
{
counter + counter; // ERROR
-counter; // ERROR
int a[3];
a[counter]; // ERROR
countArr[2];
countArr[i];
counter = 4; // ERROR
}
in atomic_uint acin; // ERROR
atomic_uint acg; // ERROR
uniform atomic_uint;
uniform atomic_uint aNoBind; // ERROR, no binding
layout(binding=0, offset=32) uniform atomic_uint aOffset;
layout(binding=0, offset=4) uniform atomic_uint;
layout(binding=0) uniform atomic_uint bar3; // offset is 4
layout(binding=0) uniform atomic_uint ac[3]; // offset = 8
layout(binding=0) uniform atomic_uint ad; // offset = 20
layout(offset=8) uniform atomic_uint bar4; // ERROR, no binding
layout(binding = 0, offset = 12) uniform atomic_uint overlap; // ERROR, overlapping offsets
layout(binding = 20) uniform atomic_uint bigBind; // ERROR, binding too big

View File

@ -0,0 +1,7 @@
#ifţ
#endif
#error A˙B
#if
#endif
int a˙
#define A "˙

View File

@ -0,0 +1,4 @@
#version 400
#define m(a) a
m()

1
deps/glslang/glslang/Test/bar.h vendored Normal file
View File

@ -0,0 +1 @@
float4 i1;

View File

@ -0,0 +1,46 @@
hlsl.aliasOpaque.frag
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 87
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 62
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "main"
Name 47 "gss"
Name 51 "gtex"
Name 62 "@entryPointOutput"
Decorate 47(gss) DescriptorSet 0
Decorate 51(gtex) DescriptorSet 0
Decorate 62(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeSampler
7: TypeFloat 32
8: TypeImage 7(float) 2D sampled format:Unknown
11: TypeVector 7(float) 4
32: TypeSampledImage 8
34: TypeVector 7(float) 2
35: 7(float) Constant 1045220557
36: 7(float) Constant 1050253722
37: 34(fvec2) ConstantComposite 35 36
43: TypePointer UniformConstant 6
47(gss): 43(ptr) Variable UniformConstant
50: TypePointer UniformConstant 8
51(gtex): 50(ptr) Variable UniformConstant
54: 7(float) Constant 1077936128
61: TypePointer Output 11(fvec4)
62(@entryPointOutput): 61(ptr) Variable Output
4(main): 2 Function None 3
5: Label
70: 6 Load 47(gss)
72: 8 Load 51(gtex)
84: 32 SampledImage 72 70
85: 11(fvec4) ImageSampleImplicitLod 84 37
86: 11(fvec4) VectorTimesScalar 85 54
Store 62(@entryPointOutput) 86
Return
FunctionEnd

View File

@ -0,0 +1,65 @@
hlsl.flattenOpaque.frag
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 185
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 120
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "main"
Name 38 "tex"
Name 82 "s.s2D"
Name 97 "s2.s2D"
Name 100 "s2.tex"
Name 120 "@entryPointOutput"
Decorate 38(tex) DescriptorSet 0
Decorate 82(s.s2D) DescriptorSet 0
Decorate 97(s2.s2D) DescriptorSet 0
Decorate 100(s2.tex) DescriptorSet 0
Decorate 120(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeSampler
9: TypeFloat 32
10: TypeVector 9(float) 4
15: TypeVector 9(float) 2
22: TypeImage 9(float) 2D sampled format:Unknown
37: TypePointer UniformConstant 22
38(tex): 37(ptr) Variable UniformConstant
45: TypeSampledImage 22
47: 9(float) Constant 1045220557
48: 9(float) Constant 1050253722
49: 15(fvec2) ConstantComposite 47 48
81: TypePointer UniformConstant 6
82(s.s2D): 81(ptr) Variable UniformConstant
97(s2.s2D): 81(ptr) Variable UniformConstant
100(s2.tex): 37(ptr) Variable UniformConstant
119: TypePointer Output 10(fvec4)
120(@entryPointOutput): 119(ptr) Variable Output
4(main): 2 Function None 3
5: Label
134: 6 Load 82(s.s2D)
158: 22 Load 38(tex)
161: 45 SampledImage 158 134
162: 10(fvec4) ImageSampleImplicitLod 161 49
138: 6 Load 82(s.s2D)
164: 22 Load 38(tex)
167: 45 SampledImage 164 138
169: 10(fvec4) ImageSampleImplicitLod 167 49
142: 10(fvec4) FAdd 162 169
143: 6 Load 97(s2.s2D)
145: 22 Load 100(s2.tex)
175: 45 SampledImage 145 143
176: 10(fvec4) ImageSampleImplicitLod 175 49
149: 10(fvec4) FAdd 142 176
150: 6 Load 97(s2.s2D)
152: 22 Load 100(s2.tex)
182: 45 SampledImage 152 150
184: 10(fvec4) ImageSampleImplicitLod 182 49
156: 10(fvec4) FAdd 149 184
Store 120(@entryPointOutput) 156
Return
FunctionEnd

View File

@ -0,0 +1,52 @@
hlsl.flattenOpaqueInit.vert
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 134
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 80
Source HLSL 500
Name 4 "main"
Name 43 "g_tInputTexture_sampler"
Name 47 "g_tInputTexture"
Name 80 "@entryPointOutput"
Decorate 43(g_tInputTexture_sampler) DescriptorSet 0
Decorate 47(g_tInputTexture) DescriptorSet 0
Decorate 80(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeSampler
7: TypeFloat 32
8: TypeImage 7(float) 2D sampled format:Unknown
11: TypeVector 7(float) 4
31: TypeSampledImage 8
33: TypeVector 7(float) 2
34: 7(float) Constant 1050253722
35: 7(float) Constant 1053609165
36: 33(fvec2) ConstantComposite 34 35
37: 7(float) Constant 0
42: TypePointer UniformConstant 6
43(g_tInputTexture_sampler): 42(ptr) Variable UniformConstant
46: TypePointer UniformConstant 8
47(g_tInputTexture): 46(ptr) Variable UniformConstant
79: TypePointer Output 11(fvec4)
80(@entryPointOutput): 79(ptr) Variable Output
4(main): 2 Function None 3
5: Label
90: 6 Load 43(g_tInputTexture_sampler)
91: 8 Load 47(g_tInputTexture)
111: 31 SampledImage 91 90
112: 11(fvec4) ImageSampleExplicitLod 111 36 Lod 37
115: 6 Load 43(g_tInputTexture_sampler)
117: 8 Load 47(g_tInputTexture)
125: 31 SampledImage 117 115
126: 11(fvec4) ImageSampleExplicitLod 125 36 Lod 37
99: 11(fvec4) FAdd 112 126
132: 31 SampledImage 91 90
133: 11(fvec4) ImageSampleExplicitLod 132 36 Lod 37
104: 11(fvec4) FAdd 99 133
Store 80(@entryPointOutput) 104
Return
FunctionEnd

View File

@ -0,0 +1,43 @@
hlsl.flattenOpaqueInitMix.vert
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 97
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 57
Source HLSL 500
Name 4 "main"
Name 44 "g_tInputTexture_sampler"
Name 47 "g_tInputTexture"
Name 57 "@entryPointOutput"
Decorate 44(g_tInputTexture_sampler) DescriptorSet 0
Decorate 47(g_tInputTexture) DescriptorSet 0
Decorate 57(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeSampler
7: TypeFloat 32
8: TypeImage 7(float) 2D sampled format:Unknown
11: TypeVector 7(float) 4
28: TypeSampledImage 8
36: TypeVector 7(float) 2
38: 7(float) Constant 0
43: TypePointer UniformConstant 6
44(g_tInputTexture_sampler): 43(ptr) Variable UniformConstant
46: TypePointer UniformConstant 8
47(g_tInputTexture): 46(ptr) Variable UniformConstant
49: 7(float) Constant 1056964608
56: TypePointer Output 11(fvec4)
57(@entryPointOutput): 56(ptr) Variable Output
96: 36(fvec2) ConstantComposite 49 49
4(main): 2 Function None 3
5: Label
63: 6 Load 44(g_tInputTexture_sampler)
64: 8 Load 47(g_tInputTexture)
73: 28 SampledImage 64 63
79: 11(fvec4) ImageSampleExplicitLod 73 96 Lod 38
Store 57(@entryPointOutput) 79
Return
FunctionEnd

View File

@ -0,0 +1,47 @@
hlsl.flattenSubset.frag
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 66
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 47 50
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "main"
Name 21 "samp"
Name 33 "tex"
Name 47 "vpos"
Name 50 "@entryPointOutput"
Decorate 21(samp) DescriptorSet 0
Decorate 33(tex) DescriptorSet 0
Decorate 47(vpos) Location 0
Decorate 50(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
13: TypeSampler
20: TypePointer UniformConstant 13
21(samp): 20(ptr) Variable UniformConstant
31: TypeImage 6(float) 2D sampled format:Unknown
32: TypePointer UniformConstant 31
33(tex): 32(ptr) Variable UniformConstant
37: TypeSampledImage 31
39: TypeVector 6(float) 2
40: 6(float) Constant 1056964608
41: 39(fvec2) ConstantComposite 40 40
46: TypePointer Input 7(fvec4)
47(vpos): 46(ptr) Variable Input
49: TypePointer Output 7(fvec4)
50(@entryPointOutput): 49(ptr) Variable Output
4(main): 2 Function None 3
5: Label
57: 13 Load 21(samp)
61: 31 Load 33(tex)
64: 37 SampledImage 61 57
65: 7(fvec4) ImageSampleImplicitLod 64 41
Store 50(@entryPointOutput) 65
Return
FunctionEnd

View File

@ -0,0 +1,31 @@
hlsl.flattenSubset2.frag
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 53
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 49 52
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "main"
Name 49 "vpos"
Name 52 "@entryPointOutput"
Decorate 49(vpos) Location 0
Decorate 52(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
43: 6(float) Constant 0
44: 7(fvec4) ConstantComposite 43 43 43 43
48: TypePointer Input 7(fvec4)
49(vpos): 48(ptr) Variable Input
51: TypePointer Output 7(fvec4)
52(@entryPointOutput): 51(ptr) Variable Output
4(main): 2 Function None 3
5: Label
Store 52(@entryPointOutput) 44
Return
FunctionEnd

Some files were not shown because too many files have changed in this diff Show More