Commit 0df0cdee by John Kessenich

glslangValidator: Add straightforward SPIR-V support (non-optimizing, ~3.x functionality).

parent 1899e833
#pragma once
#ifndef Bil_H
#define Bil_H
#endif // Bil_H
//
//Copyright (C) 2014 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 <assert.h>
#include <stdio.h>
#include "BilBuilder.h"
#ifndef _WIN32
#include <cstdio>
#endif
namespace glbil {
Builder::Builder()
{
}
Builder::~Builder()
{
}
void MissingFunctionality(const char* fun)
{
printf("Missing functionality: %s\n", fun);
}
}; // end glbil namespace
//
//Copyright (C) 2014 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.
#pragma once
#ifndef BilBuilder_H
#define BilBuilder_H
#include "Bil.h"
#include "Bir.h"
#include <stack>
namespace glbil {
class Builder {
public:
Builder();
virtual ~Builder();
};
void MissingFunctionality(const char*);
}; // end glbil namespace
#endif // BilBuilder_H
//
//Copyright (C) 2014 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.
#pragma once
#ifndef Bir_H
#define Bir_H
#include "Bil.h"
#include <vector>
#include <iostream>
namespace glbil {
}; // end glbil namespace
#endif // Bir_H
namespace GLSL_STD_450 {
enum Entrypoints {
Round,
Count
};
extern const char* Names[Count];
inline void Initialize()
{
}
}; // end namespace GLSL_STD_450
//
//Copyright (C) 2014 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 "Bil.h"
#include "GlslangToBil.h"
#include "BilBuilder.h"
// Glslang includes
#include "glslang/MachineIndependent/localintermediate.h"
#include "glslang/MachineIndependent/SymbolTable.h"
namespace glslang {
void GlslangToBil(const glslang::TIntermediate& intermediate, std::vector<unsigned int> bil)
{
}
void OutputBil(const std::vector<unsigned int>& bil, const char* baseName)
{
}
}; // end namespace glslang
...@@ -16,4 +16,4 @@ endif(WIN32) ...@@ -16,4 +16,4 @@ endif(WIN32)
add_subdirectory(glslang) add_subdirectory(glslang)
add_subdirectory(OGLCompilersDLL) add_subdirectory(OGLCompilersDLL)
add_subdirectory(StandAlone) add_subdirectory(StandAlone)
add_subdirectory(BIL) add_subdirectory(SPIRV)
...@@ -3,20 +3,20 @@ cmake_minimum_required(VERSION 2.8) ...@@ -3,20 +3,20 @@ cmake_minimum_required(VERSION 2.8)
include_directories(.. ${CMAKE_CURRENT_BINARY_DIR}) include_directories(.. ${CMAKE_CURRENT_BINARY_DIR})
set(SOURCES set(SOURCES
GlslangToBil.cpp GlslangToSpv.cpp
BilBuilder.cpp) SpvBuilder.cpp)
set(HEADERS set(HEADERS
Bil.h spirv.h
GlslangToBil.h GlslangToSpv.h
BilBuilder.h SpvBuilder.h
Bir.h) SpvIR.h)
add_library(BIL STATIC ${SOURCES} ${HEADERS}) add_library(SPIRV STATIC ${SOURCES} ${HEADERS})
if(WIN32) if(WIN32)
source_group("Source" FILES ${SOURCES} ${HEADERS}) source_group("Source" FILES ${SOURCES} ${HEADERS})
endif(WIN32) endif(WIN32)
install(TARGETS BIL install(TARGETS SPIRV
ARCHIVE DESTINATION lib) ARCHIVE DESTINATION lib)
/*
** Copyright (c) 2014-2015 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Materials.
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
//
// Author: John Kessenich, LunarG
//
namespace GLSL_STD_450 {
enum Entrypoints {
Round,
RoundEven,
Trunc,
Abs,
Sign,
Floor,
Ceil,
Fract,
Radians,
Degrees,
Sin,
Cos,
Tan,
Asin,
Acos,
Atan,
Sinh,
Cosh,
Tanh,
Asinh,
Acosh,
Atanh,
Atan2,
Pow,
Exp,
Log,
Exp2,
Log2,
Sqrt,
InverseSqrt,
Determinant,
MatrixInverse,
Modf, // second argument needs the OpVariable, not an OpLoad
Min,
Max,
Clamp,
Mix,
Step,
SmoothStep,
FloatBitsToInt,
FloatBitsToUint,
IntBitsToFloat,
UintBitsToFloat,
Fma,
Frexp,
Ldexp,
PackSnorm4x8,
PackUnorm4x8,
PackSnorm2x16,
PackUnorm2x16,
PackHalf2x16,
PackDouble2x32,
UnpackSnorm2x16,
UnpackUnorm2x16,
UnpackHalf2x16,
UnpackSnorm4x8,
UnpackUnorm4x8,
UnpackDouble2x32,
Length,
Distance,
Cross,
Normalize,
Ftransform,
FaceForward,
Reflect,
Refract,
UaddCarry,
UsubBorrow,
UmulExtended,
ImulExtended,
BitfieldExtract,
BitfieldInsert,
BitfieldReverse,
BitCount,
FindLSB,
FindMSB,
InterpolateAtCentroid,
InterpolateAtSample,
InterpolateAtOffset,
Count
};
inline void GetDebugNames(const char** names)
{
for (int i = 0; i < Count; ++i)
names[i] = "unknown";
names[Round] = "round";
names[RoundEven] = "roundEven";
names[Trunc] = "trunc";
names[Abs] = "abs";
names[Sign] = "sign";
names[Floor] = "floor";
names[Ceil] = "ceil";
names[Fract] = "fract";
names[Radians] = "radians";
names[Degrees] = "degrees";
names[Sin] = "sin";
names[Cos] = "cos";
names[Tan] = "tan";
names[Asin] = "asin";
names[Acos] = "acos";
names[Atan] = "atan";
names[Sinh] = "sinh";
names[Cosh] = "cosh";
names[Tanh] = "tanh";
names[Asinh] = "asinh";
names[Acosh] = "acosh";
names[Atanh] = "atanh";
names[Atan2] = "atan2";
names[Pow] = "pow";
names[Exp] = "exp";
names[Log] = "log";
names[Exp2] = "exp2";
names[Log2] = "log2";
names[Sqrt] = "sqrt";
names[InverseSqrt] = "inverseSqrt";
names[Determinant] = "determinant";
names[MatrixInverse] = "matrixInverse";
names[Modf] = "modf";
names[Min] = "min";
names[Max] = "max";
names[Clamp] = "clamp";
names[Mix] = "mix";
names[Step] = "step";
names[SmoothStep] = "smoothStep";
names[FloatBitsToInt] = "floatBitsToInt";
names[FloatBitsToUint] = "floatBitsToUint";
names[IntBitsToFloat] = "intBitsToFloat";
names[UintBitsToFloat] = "uintBitsToFloat";
names[Fma] = "fma";
names[Frexp] = "frexp";
names[Ldexp] = "ldexp";
names[PackSnorm4x8] = "packSnorm4x8";
names[PackUnorm4x8] = "packUnorm4x8";
names[PackSnorm2x16] = "packSnorm2x16";
names[PackUnorm2x16] = "packUnorm2x16";
names[PackHalf2x16] = "packHalf2x16";
names[PackDouble2x32] = "packDouble2x32";
names[PackHalf2x16] = "packHalf2x16";
names[UnpackSnorm2x16] = "unpackSnorm2x16";
names[UnpackUnorm2x16] = "unpackUnorm2x16";
names[UnpackHalf2x16] = "unpackHalf2x16";
names[UnpackSnorm4x8] = "unpackSnorm4x8";
names[UnpackUnorm4x8] = "unpackUnorm4x8";
names[UnpackDouble2x32] = "unpackDouble2x32";
names[UnpackHalf2x16] = "unpackHalf2x16";
names[Length] = "length";
names[Distance] = "distance";
names[Cross] = "cross";
names[Normalize] = "normalize";
names[Ftransform] = "ftransform";
names[FaceForward] = "faceForward";
names[Reflect] = "reflect";
names[Refract] = "refract";
names[UaddCarry] = "uaddCarry";
names[UsubBorrow] = "usubBorrow";
names[UmulExtended] = "umulExtended";
names[ImulExtended] = "imulExtended";
names[BitfieldExtract] = "bitfieldExtract";
names[BitfieldInsert] = "bitfieldInsert";
names[BitfieldReverse] = "bitfieldReverse";
names[BitCount] = "bitCount";
names[FindLSB] = "findLSB";
names[FindMSB] = "findMSB";
names[InterpolateAtCentroid] = "interpolateAtCentroid";
names[InterpolateAtSample] = "interpolateAtSample";
names[InterpolateAtOffset] = "interpolateAtOffset";
}
}; // end namespace GLSL_STD_450
...@@ -36,8 +36,7 @@ ...@@ -36,8 +36,7 @@
namespace glslang { namespace glslang {
void GlslangToBil(const glslang::TIntermediate& intermediate, std::vector<unsigned int> bil); void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv);
void OutputSpv(const std::vector<unsigned int>& spirv, const char* baseName);
void OutputBil(const std::vector<unsigned int>& bil, const char* baseName);
}; };
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
...@@ -17,7 +17,7 @@ set(LIBRARIES ...@@ -17,7 +17,7 @@ set(LIBRARIES
glslang glslang
OGLCompiler OGLCompiler
OSDependent OSDependent
BIL) SPIRV)
if(WIN32) if(WIN32)
set(LIBRARIES ${LIBRARIES} psapi) set(LIBRARIES ${LIBRARIES} psapi)
......
...@@ -40,8 +40,8 @@ ...@@ -40,8 +40,8 @@
#include "Worklist.h" #include "Worklist.h"
#include "./../glslang/Include/ShHandle.h" #include "./../glslang/Include/ShHandle.h"
#include "./../glslang/Public/ShaderLang.h" #include "./../glslang/Public/ShaderLang.h"
#include "../BIL/GlslangToBil.h" #include "../SPIRV/GlslangToSpv.h"
#include "../BIL/GLSL450Lib.h" #include "../SPIRV/GLSL450Lib.h"
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
...@@ -66,7 +66,7 @@ enum TOptions { ...@@ -66,7 +66,7 @@ enum TOptions {
EOptionDumpReflection = 0x100, EOptionDumpReflection = 0x100,
EOptionSuppressWarnings = 0x200, EOptionSuppressWarnings = 0x200,
EOptionDumpVersions = 0x400, EOptionDumpVersions = 0x400,
EOptionBil = 0x800, EOptionSpv = 0x800,
EOptionDefaultDesktop = 0x1000, EOptionDefaultDesktop = 0x1000,
}; };
...@@ -479,8 +479,8 @@ bool ProcessArguments(int argc, char* argv[]) ...@@ -479,8 +479,8 @@ bool ProcessArguments(int argc, char* argv[])
Work[argc] = 0; Work[argc] = 0;
if (argv[0][0] == '-') { if (argv[0][0] == '-') {
switch (argv[0][1]) { switch (argv[0][1]) {
case 'b': case 'V':
Options |= EOptionBil; Options |= EOptionSpv;
Options |= EOptionLinkProgram; Options |= EOptionLinkProgram;
break; break;
case 'c': case 'c':
...@@ -634,14 +634,14 @@ void CompileAndLinkShaders() ...@@ -634,14 +634,14 @@ void CompileAndLinkShaders()
program.dumpReflection(); program.dumpReflection();
} }
if (Options & EOptionBil) { if (Options & EOptionSpv) {
if (CompileFailed || LinkFailed) if (CompileFailed || LinkFailed)
printf("Bil is not generated for failed compile or link\n"); printf("SPIRV is not generated for failed compile or link\n");
else { else {
for (int stage = 0; stage < EShLangCount; ++stage) { for (int stage = 0; stage < EShLangCount; ++stage) {
if (program.getIntermediate((EShLanguage)stage)) { if (program.getIntermediate((EShLanguage)stage)) {
std::vector<unsigned int> bil; std::vector<unsigned int> spirv;
glslang::GlslangToBil(*program.getIntermediate((EShLanguage)stage), bil); glslang::GlslangToSpv(*program.getIntermediate((EShLanguage)stage), spirv);
const char* name; const char* name;
switch (stage) { switch (stage) {
case EShLangVertex: name = "vert"; break; case EShLangVertex: name = "vert"; break;
...@@ -652,7 +652,7 @@ void CompileAndLinkShaders() ...@@ -652,7 +652,7 @@ void CompileAndLinkShaders()
case EShLangCompute: name = "comp"; break; case EShLangCompute: name = "comp"; break;
default: name = "unknown"; break; default: name = "unknown"; break;
} }
glslang::OutputBil(bil, name); glslang::OutputSpv(spirv, name);
} }
} }
} }
...@@ -839,7 +839,7 @@ void usage() ...@@ -839,7 +839,7 @@ void usage()
{ {
printf("Usage: glslangValidator [option]... [file]...\n" printf("Usage: glslangValidator [option]... [file]...\n"
"\n" "\n"
"Where: each 'file' ends in\n" "Where: each 'file' ends in .<stage>, where <stage> is one of\n"
" .conf to provide an optional config file that replaces the default configuration\n" " .conf to provide an optional config file that replaces the default configuration\n"
" (see -c option below for generating a template)\n" " (see -c option below for generating a template)\n"
" .vert for a vertex shader\n" " .vert for a vertex shader\n"
...@@ -853,7 +853,7 @@ void usage() ...@@ -853,7 +853,7 @@ void usage()
"\n" "\n"
"To get other information, use one of the following options:\n" "To get other information, use one of the following options:\n"
"(Each option must be specified separately, but can go anywhere in the command line.)\n" "(Each option must be specified separately, but can go anywhere in the command line.)\n"
" -b create BIL in file <stage>.bil\n" " -V create SPIR-V in file <stage>.spv\n"
" -c configuration dump; use to create default configuration file (redirect to a .conf file)\n" " -c configuration dump; use to create default configuration file (redirect to a .conf file)\n"
" -d default to desktop (#version 110) when there is no version in the shader (default is ES version 100)\n" " -d default to desktop (#version 110) when there is no version in the shader (default is ES version 100)\n"
" -i intermediate tree (glslang AST) is printed out\n" " -i intermediate tree (glslang AST) is printed out\n"
......
...@@ -482,6 +482,7 @@ public: ...@@ -482,6 +482,7 @@ public:
layoutLocation = layoutLocationEnd; layoutLocation = layoutLocationEnd;
layoutComponent = layoutComponentEnd; layoutComponent = layoutComponentEnd;
layoutSet = layoutSetEnd;
layoutBinding = layoutBindingEnd; layoutBinding = layoutBindingEnd;
layoutIndex = layoutIndexEnd; layoutIndex = layoutIndexEnd;
...@@ -513,6 +514,9 @@ public: ...@@ -513,6 +514,9 @@ public:
unsigned int layoutComponent : 3; unsigned int layoutComponent : 3;
static const unsigned int layoutComponentEnd = 4; static const unsigned int layoutComponentEnd = 4;
unsigned int layoutSet : 7;
static const unsigned int layoutSetEnd = 0x3F;
unsigned int layoutBinding : 8; unsigned int layoutBinding : 8;
static const unsigned int layoutBindingEnd = 0xFF; static const unsigned int layoutBindingEnd = 0xFF;
...@@ -575,6 +579,10 @@ public: ...@@ -575,6 +579,10 @@ public:
{ {
return layoutIndex != layoutIndexEnd; return layoutIndex != layoutIndexEnd;
} }
bool hasSet() const
{
return layoutSet != layoutSetEnd;
}
bool hasBinding() const bool hasBinding() const
{ {
return layoutBinding != layoutBindingEnd; return layoutBinding != layoutBindingEnd;
...@@ -1201,6 +1209,8 @@ public: ...@@ -1201,6 +1209,8 @@ public:
if (qualifier.hasIndex()) if (qualifier.hasIndex())
p += snprintf(p, end - p, "index=%d ", qualifier.layoutIndex); p += snprintf(p, end - p, "index=%d ", qualifier.layoutIndex);
} }
if (qualifier.hasSet())
p += snprintf(p, end - p, "set=%d ", qualifier.layoutSet);
if (qualifier.hasBinding()) if (qualifier.hasBinding())
p += snprintf(p, end - p, "binding=%d ", qualifier.layoutBinding); p += snprintf(p, end - p, "binding=%d ", qualifier.layoutBinding);
if (qualifier.hasStream()) if (qualifier.hasStream())
......
...@@ -3312,6 +3312,12 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType, ...@@ -3312,6 +3312,12 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType,
else else
publicType.qualifier.layoutLocation = value; publicType.qualifier.layoutLocation = value;
return; return;
} else if (id == "set") {
if ((unsigned int)value >= TQualifier::layoutSetEnd)
error(loc, "set is too large", id.c_str(), "");
else
publicType.qualifier.layoutSet = value;
return;
} else if (id == "binding") { } else if (id == "binding") {
profileRequires(loc, ~EEsProfile, 420, GL_ARB_shading_language_420pack, "binding"); profileRequires(loc, ~EEsProfile, 420, GL_ARB_shading_language_420pack, "binding");
profileRequires(loc, EEsProfile, 310, 0, "binding"); profileRequires(loc, EEsProfile, 310, 0, "binding");
...@@ -3476,6 +3482,8 @@ void TParseContext::mergeObjectLayoutQualifiers(TSourceLoc loc, TQualifier& dst, ...@@ -3476,6 +3482,8 @@ void TParseContext::mergeObjectLayoutQualifiers(TSourceLoc loc, TQualifier& dst,
if (src.hasOffset()) if (src.hasOffset())
dst.layoutOffset = src.layoutOffset; dst.layoutOffset = src.layoutOffset;
if (src.hasSet())
dst.layoutSet = src.layoutSet;
if (src.layoutBinding != TQualifier::layoutBindingEnd) if (src.layoutBinding != TQualifier::layoutBindingEnd)
dst.layoutBinding = src.layoutBinding; dst.layoutBinding = src.layoutBinding;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment