deps: Update glslang to version 8.13.3743

This commit is contained in:
scribam 2020-04-28 13:45:08 +02:00
parent a04b7f88fa
commit 0ddcce4854
736 changed files with 51058 additions and 39275 deletions

View File

@ -0,0 +1,108 @@
# Windows Build Configuration for AppVeyor
# http://www.appveyor.com/docs/appveyor-yml
# build version format
version: "{build}"
os: Visual Studio 2013
platform:
- x64
configuration:
- Debug
- Release
branches:
only:
- master
# changes to these files don't need to trigger testing
skip_commits:
files:
- README.md
- README-spirv-remap.txt
- LICENSE.txt
- CODE_OF_CONDUCT.md
- BUILD.*
- WORKSPACE
- kokoro/*
- make-revision
- Android.mk
- _config.yml
# Travis advances the master-tot tag to current top of the tree after
# each push into the master branch, because it relies on that tag to
# upload build artifacts to the master-tot release. This will cause
# double testing for each push on Appveyor: one for the push, one for
# the tag advance. Disable testing tags.
skip_tags: true
clone_depth: 5
matrix:
fast_finish: true # Show final status immediately if a test fails.
# scripts that run after cloning repository
install:
- C:/Python27/python.exe update_glslang_sources.py
- set PATH=C:\ninja;C:\Python36;%PATH%
- git clone https://github.com/google/googletest.git External/googletest
- cd External/googletest
- git checkout 440527a61e1c91188195f7de212c63c77e8f0a45
- cd ../..
build:
parallel: true # enable MSBuild parallel builds
verbosity: minimal
build_script:
- mkdir build && cd build
- cmake -G "Visual Studio 12 2013 Win64" -DCMAKE_INSTALL_PREFIX=install ..
- cmake --build . --config %CONFIGURATION% --target install
test_script:
- ctest -C %CONFIGURATION% --output-on-failure
- cd ../Test && bash runtests
- cd ../build
after_test:
# For debug build, the generated dll has a postfix "d" in its name.
- ps: >-
If ($env:configuration -Match "Debug") {
$env:SUFFIX="d"
} Else {
$env:SUFFIX=""
}
- cd install
# Zip all glslang artifacts for uploading and deploying
- 7z a glslang-master-windows-"%PLATFORM%"-"%CONFIGURATION%".zip
bin\glslangValidator.exe
bin\spirv-remap.exe
include\glslang\*
lib\glslang%SUFFIX%.lib
lib\HLSL%SUFFIX%.lib
lib\OGLCompiler%SUFFIX%.lib
lib\OSDependent%SUFFIX%.lib
lib\SPIRV%SUFFIX%.lib
lib\SPVRemapper%SUFFIX%.lib
lib\SPIRV-Tools%SUFFIX%.lib
lib\SPIRV-Tools-opt%SUFFIX%.lib
artifacts:
- path: build\install\*.zip
name: artifacts-zip
deploy:
- provider: GitHub
auth_token:
secure: YglcSYdl0TylEa59H4K6lylBEDr586NAt2EMgZquSo+iuPrwgZQuJLPCoihSm9y6
release: master-tot
description: "Continuous build of the latest master branch by Appveyor and Travis CI"
artifact: artifacts-zip
draft: false
prerelease: false
force_update: true
on:
branch: master
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013

17
core/deps/glslang/.gitattributes vendored Executable file
View File

@ -0,0 +1,17 @@
# test files have a mix of lf/crlf, and that's a good thing, for testing, don't mess with it
# bash scripts need lines ending with lf, and that's correct for Windows too, e.g., under Cygwin
# (scripts often don't have a suffix)
* -text
*.sh text eof=lf
# txt files should be native and normalized
*.txt text
# source code can be native and normalized, but simpler if lf everywhere; will try that way
*.h text eol=lf
*.c text eol=lf
*.cpp text eol=lf
*.y text eol=lf
*.out text eol=lf
*.conf text eol=lf
*.err text eol=lf

10
core/deps/glslang/.gitignore vendored Normal file
View File

@ -0,0 +1,10 @@
*.o
*.a
*.so
*.exe
tags
TAGS
build/
Test/localResults/
External/googletest
External/spirv-tools

View File

@ -0,0 +1,128 @@
# Linux and Mac Build Configuration for Travis
language: cpp
os:
- linux
- osx
# Use Ubuntu 14.04 LTS (Trusty) as the Linux testing environment.
sudo: false
dist: trusty
env:
global:
- secure: aGFrgzyKp+84hKrGkxVWg8cHV61uqrKEHT38gfSQK6+WS4GfLOyH83p7WnsEBb7AMhzU7LMNFdvOFr6+NaMpVnqRvc40CEG1Q+lNg9Pq9mhIZLowvDrfqTL9kQ+8Nbw5Q6/dg6CTvY7fvRfpfCEmKIUZBRkoKUuHeuM1uy3IupFcdNuL5bSYn3Beo+apSJginh9DI4BLDXFUgBzTRSLLyCX5g3cpaeGGOCr8quJlYx75W6HRck5g9SZuLtUoH9GFEV3l+ZEWB8noErW+J56L03bwNwFuuAh321evw++oQk5KFa8rlDvar3SJ3b1RHB8u/eq5DBYMyaK/fS8+Q7QbGr8diF/wDe68bKO7U9IhpNfExXmczCpExjHomW5TQv4rYdGhygPMfW97aIsPRYyNKcl4fkmb7NDrM8w0Jscdq2g5c2Kz0ItyZoBri/NXLwFQQjaVCs7Pf97TjuMA7mK0GJmDTRzi6SrDYlWMt5BQL3y0CCojyfLIRcTh0CQjQI29s97bLfQrYAxt9GNNFR+HTXRLLrkaAlJkPGEPwUywlSfEThnvHLesNxYqemolAYpQT4ithoL4GehGIHmaxsW295aKVhuRf8K9eBODNqrfblvM42UHhjntT+92ZnQ/Gkq80GqaMxnxi4PO5FyPIxt0r981b54YBkWi8YA4P7w5pNI=
matrix:
- GLSLANG_BUILD_TYPE=Release
- GLSLANG_BUILD_TYPE=Debug
compiler:
- clang
- gcc
matrix:
fast_finish: true # Show final status immediately if a test fails.
exclude:
# Skip GCC builds on Mac OS X.
- os: osx
compiler: gcc
include:
# Additional build using Android NDK.
- env: BUILD_NDK=ON
cache:
apt: true
branches:
only:
- master
addons:
apt:
packages:
- clang-3.6
install:
# Make sure that clang-3.6 is selected on Linux.
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$CC" == "clang" ]]; then
export CC=clang-3.6 CXX=clang++-3.6;
fi
# Download a recent Android NDK and use its android.toolchain.cmake file.
- if [[ "$BUILD_NDK" == "ON" ]]; then
export ANDROID_NDK=$HOME/android-ndk;
git init $ANDROID_NDK;
pushd $ANDROID_NDK;
git remote add dneto0 https://github.com/dneto0/android-ndk.git;
git fetch --depth=1 dneto0 r17b-strip;
git checkout FETCH_HEAD;
popd;
export TOOLCHAIN_PATH=$ANDROID_NDK/build/cmake/android.toolchain.cmake;
fi
before_script:
- git clone --depth=1 https://github.com/google/googletest.git External/googletest
- ./update_glslang_sources.py
script:
- mkdir build && cd build
# For Android, do release building using NDK without testing.
# Use android-14, the oldest native API level supporeted by NDK r17b.
# We can use newer API levels if we want.
# For Linux and macOS, do debug/release building with testing.
- if [[ "$BUILD_NDK" == "ON" ]]; then
cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_PATH}
-DANDROID_NATIVE_API_LEVEL=android-14
-DCMAKE_BUILD_TYPE=Release
-DANDROID_ABI="armeabi-v7a with NEON"
-DBUILD_TESTING=OFF ..;
make -j4;
else
cmake -DCMAKE_BUILD_TYPE=${GLSLANG_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX=`pwd`/install ..;
make -j4 install;
ctest --output-on-failure &&
cd ../Test && ./runtests;
fi
after_success:
# For debug build, the generated dll has a postfix "d" in its name.
- if [[ "${GLSLANG_BUILD_TYPE}" == "Debug" ]]; then
export SUFFIX="d";
else
export SUFFIX="";
fi
# Create tarball for deployment
- if [[ ${CC} == clang* && "${BUILD_NDK}" != "ON" ]]; then
cd ../build/install;
export TARBALL=glslang-master-${TRAVIS_OS_NAME}-${GLSLANG_BUILD_TYPE}.zip;
zip ${TARBALL}
bin/glslangValidator
include/glslang/*
lib/libglslang${SUFFIX}.a
lib/libHLSL${SUFFIX}.a
lib/libOGLCompiler${SUFFIX}.a
lib/libOSDependent${SUFFIX}.a
lib/libSPIRV${SUFFIX}.a
lib/libSPVRemapper${SUFFIX}.a
lib/libSPIRV-Tools${SUFFIX}.a
lib/libSPIRV-Tools-opt${SUFFIX}.a;
fi
before_deploy:
# Tag the current top of the tree as "master-tot".
# Travis CI replies on the tag name to properly push to GitHub Releases.
- git config --global user.name "Travis CI"
- git config --global user.email "builds@travis-ci.org"
- git tag -f master-tot
- git push -q -f https://${glslangtoken}@github.com/KhronosGroup/glslang --tags
deploy:
provider: releases
api_key: ${glslangtoken}
on:
branch: master
condition: ${CC} == clang* && ${BUILD_NDK} != ON
file: ${TARBALL}
skip_cleanup: true
overwrite: true

View File

@ -85,6 +85,7 @@ genrule(
"SPIRV/GLSL.ext.KHR.h",
"SPIRV/GLSL.ext.NV.h",
"SPIRV/GLSL.std.450.h",
"SPIRV/NonSemanticDebugPrintf.h",
"SPIRV/spirv.hpp",
],
outs = [
@ -93,6 +94,7 @@ genrule(
"include/SPIRV/GLSL.ext.KHR.h",
"include/SPIRV/GLSL.ext.NV.h",
"include/SPIRV/GLSL.std.450.h",
"include/SPIRV/NonSemanticDebugPrintf.h",
"include/SPIRV/spirv.hpp",
],
cmd = "mkdir -p $(@D)/include/SPIRV && cp $(SRCS) $(@D)/include/SPIRV/",

View File

@ -70,6 +70,7 @@ source_set("glslang_sources") {
"SPIRV/InReadableOrder.cpp",
"SPIRV/Logger.cpp",
"SPIRV/Logger.h",
"SPIRV/NonSemanticDebugPrintf.h",
"SPIRV/SPVRemapper.cpp",
"SPIRV/SPVRemapper.h",
"SPIRV/SpvBuilder.cpp",

View File

@ -32,13 +32,31 @@ option(ENABLE_SPVREMAPPER "Enables building of SPVRemapper" ON)
option(ENABLE_GLSLANG_BINARIES "Builds glslangValidator and spirv-remap" ON)
option(ENABLE_GLSLANG_WEB "Reduces glslang to minimum needed for web use" OFF)
option(ENABLE_GLSLANG_WEB_DEVEL "For ENABLE_GLSLANG_WEB builds, enables compilation error messages" OFF)
option(ENABLE_EMSCRIPTEN_SINGLE_FILE "If using Emscripten, enables SINGLE_FILE build" OFF)
option(ENABLE_EMSCRIPTEN_ENVIRONMENT_NODE "If using Emscripten, builds to run on Node instead of Web" OFF)
option(ENABLE_GLSLANG_JS
"If using Emscripten, build glslang.js. Otherwise, builds a sample executable for binary-size testing." OFF)
CMAKE_DEPENDENT_OPTION(ENABLE_GLSLANG_WEBMIN
"Reduces glslang to minimum needed for web use"
OFF "ENABLE_GLSLANG_JS"
OFF)
CMAKE_DEPENDENT_OPTION(ENABLE_GLSLANG_WEBMIN_DEVEL
"For ENABLE_GLSLANG_WEBMIN builds, enables compilation error messages"
OFF "ENABLE_GLSLANG_WEBMIN"
OFF)
CMAKE_DEPENDENT_OPTION(ENABLE_EMSCRIPTEN_SINGLE_FILE
"If using Emscripten, enables SINGLE_FILE build"
OFF "ENABLE_GLSLANG_JS AND EMSCRIPTEN"
OFF)
CMAKE_DEPENDENT_OPTION(ENABLE_EMSCRIPTEN_ENVIRONMENT_NODE
"If using Emscripten, builds to run on Node instead of Web"
OFF "ENABLE_GLSLANG_JS AND EMSCRIPTEN"
OFF)
CMAKE_DEPENDENT_OPTION(ENABLE_HLSL "Enables HLSL input support" ON "NOT ENABLE_GLSLANG_WEB" OFF)
CMAKE_DEPENDENT_OPTION(ENABLE_HLSL
"Enables HLSL input support"
ON "NOT ENABLE_GLSLANG_WEBMIN"
OFF)
option(ENABLE_RTTI "Enables RTTI" OFF)
option(ENABLE_OPT "Enables spirv-opt capability if present" ON)
option(ENABLE_PCH "Enables Precompiled header" ON)
option(ENABLE_CTEST "Enables testing" ON)
@ -57,7 +75,7 @@ endif()
# Precompiled header macro. Parameters are source file list and filename for pch cpp file.
macro(glslang_pch SRCS PCHCPP)
if(MSVC AND CMAKE_GENERATOR MATCHES "^Visual Studio" AND ENABLE_PCH)
if(MSVC AND CMAKE_GENERATOR MATCHES "^Visual Studio" AND NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND ENABLE_PCH)
set(PCH_NAME "$(IntDir)\\pch.pch")
# make source files use/depend on PCH_NAME
set_source_files_properties(${${SRCS}} PROPERTIES COMPILE_FLAGS "/Yupch.h /FIpch.h /Fp${PCH_NAME} /Zm300" OBJECT_DEPENDS "${PCH_NAME}")
@ -77,12 +95,12 @@ if(ENABLE_HLSL)
add_definitions(-DENABLE_HLSL)
endif(ENABLE_HLSL)
if(ENABLE_GLSLANG_WEB)
if(ENABLE_GLSLANG_WEBMIN)
add_definitions(-DGLSLANG_WEB)
if(ENABLE_GLSLANG_WEB_DEVEL)
if(ENABLE_GLSLANG_WEBMIN_DEVEL)
add_definitions(-DGLSLANG_WEB_DEVEL)
endif(ENABLE_GLSLANG_WEB_DEVEL)
endif(ENABLE_GLSLANG_WEB)
endif(ENABLE_GLSLANG_WEBMIN_DEVEL)
endif(ENABLE_GLSLANG_WEBMIN)
if(WIN32)
set(CMAKE_DEBUG_POSTFIX "d")
@ -100,45 +118,42 @@ if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
add_compile_options(-Wall -Wmaybe-uninitialized -Wuninitialized -Wunused -Wunused-local-typedefs
-Wunused-parameter -Wunused-value -Wunused-variable -Wunused-but-set-parameter -Wunused-but-set-variable -fno-exceptions)
add_compile_options(-Wno-reorder) # disable this from -Wall, since it happens all over.
add_compile_options(-fno-rtti)
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
if(NOT ENABLE_RTTI)
add_compile_options(-fno-rtti)
endif()
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0.0")
add_compile_options(-Werror=deprecated-copy)
endif()
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND NOT MSVC)
add_compile_options(-Wall -Wuninitialized -Wunused -Wunused-local-typedefs
-Wunused-parameter -Wunused-value -Wunused-variable)
add_compile_options(-Wno-reorder) # disable this from -Wall, since it happens all over.
add_compile_options(-fno-rtti)
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "MSVC")
add_compile_options(/GR-) # Disable RTTI
if(NOT ENABLE_RTTI)
add_compile_options(-fno-rtti)
endif()
elseif(MSVC)
if(NOT ENABLE_RTTI)
add_compile_options(/GR-) # Disable RTTI
endif()
endif()
if(EMSCRIPTEN)
add_compile_options(-Os -fno-exceptions)
add_compile_options("SHELL: -s WASM=1")
add_compile_options("SHELL: -s WASM_OBJECT_FILES=0")
add_link_options(-Os)
add_link_options("SHELL: -s FILESYSTEM=0")
add_link_options("SHELL: --llvm-lto 1")
add_link_options("SHELL: --closure 1")
add_link_options("SHELL: -s ALLOW_MEMORY_GROWTH=1")
if(ENABLE_EMSCRIPTEN_SINGLE_FILE)
add_link_options("SHELL: -s SINGLE_FILE=1")
endif(ENABLE_EMSCRIPTEN_SINGLE_FILE)
else()
if(ENABLE_GLSLANG_WEB)
if(MSVC)
add_compile_options(/Os /GR-)
else()
add_compile_options(-Os -fno-exceptions)
add_link_options(-Os)
if(ENABLE_GLSLANG_JS)
if(MSVC)
add_compile_options(/Os /GR-)
else()
add_compile_options(-Os -fno-exceptions)
if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND NOT MSVC)
add_compile_options(-Wno-unused-parameter)
add_compile_options(-Wno-unused-variable -Wno-unused-const-variable)
endif()
endif(ENABLE_GLSLANG_WEB)
endif(EMSCRIPTEN)
endif()
endif(ENABLE_GLSLANG_JS)
# Request C++11
if(${CMAKE_VERSION} VERSION_LESS 3.1)
# CMake versions before 3.1 do not understand CMAKE_CXX_STANDARD
# remove this block once CMake >=3.1 has fixated in the ecosystem
add_compile_options(-std=c++11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
else()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

View File

@ -1,44 +1,70 @@
Also see the Khronos landing page for glslang as a reference front end:
https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
The above page includes where to get binaries, and is kept up to date
regarding the feature level of glslang.
glslang
=======
# News
[![Build Status](https://travis-ci.org/KhronosGroup/glslang.svg?branch=master)](https://travis-ci.org/KhronosGroup/glslang)
[![Build status](https://ci.appveyor.com/api/projects/status/q6fi9cb0qnhkla68/branch/master?svg=true)](https://ci.appveyor.com/project/Khronoswebmaster/glslang/branch/master)
An OpenGL and OpenGL ES shader front end and validator.
## Planned Deprecations/Removals
1. **SPIRV Folder, 1-May, 2020.** Glslang, when installed through CMake,
will install a `SPIRV` folder into `${CMAKE_INSTALL_INCLUDEDIR}`.
This `SPIRV` folder is being moved to `glslang/SPIRV`.
During the transition the `SPIRV` folder will be installed into both locations.
The old install of `SPIRV/` will be removed as a CMake install target no sooner than May 1, 2020.
See issue #1964.
2. **Visual Studio 2013, 20-July, 2020.** Keeping code compiling for MS Visual Studio 2013 will no longer be
a goal as of July 20, 2020, the fifth anniversary of the release of Visual Studio 2015.
# Glslang Components and Status
There are several components:
1. A GLSL/ESSL front-end for reference validation and translation of GLSL/ESSL into an AST.
### Reference Validator and GLSL/ESSL -> AST Front End
2. An HLSL front-end for translation of a broad generic HLL into the AST. See [issue 362](https://github.com/KhronosGroup/glslang/issues/362) and [issue 701](https://github.com/KhronosGroup/glslang/issues/701) for current status.
An OpenGL GLSL and OpenGL|ES GLSL (ESSL) front-end for reference validation and translation of GLSL/ESSL into an internal abstract syntax tree (AST).
3. A SPIR-V back end for translating the AST to SPIR-V.
**Status**: Virtually complete, with results carrying similar weight as the specifications.
4. A standalone wrapper, `glslangValidator`, that can be used as a command-line tool for the above.
### HLSL -> AST Front End
How to add a feature protected by a version/extension/stage/profile: See the
comment in `glslang/MachineIndependent/Versions.cpp`.
An HLSL front-end for translation of an approximation of HLSL to glslang's AST form.
**Status**: Partially complete. Semantics are not reference quality and input is not validated.
This is in contrast to the [DXC project](https://github.com/Microsoft/DirectXShaderCompiler), which receives a much larger investment and attempts to have definitive/reference-level semantics.
See [issue 362](https://github.com/KhronosGroup/glslang/issues/362) and [issue 701](https://github.com/KhronosGroup/glslang/issues/701) for current status.
### AST -> SPIR-V Back End
Translates glslang's AST to the Khronos-specified SPIR-V intermediate language.
**Status**: Virtually complete.
### Reflector
An API for getting reflection information from the AST, reflection types/variables/etc. from the HLL source (not the SPIR-V).
**Status**: There is a large amount of functionality present, but no specification/goal to measure completeness against. It is accurate for the input HLL and AST, but only approximate for what would later be emitted for SPIR-V.
### Standalone Wrapper
`glslangValidator` is command-line tool for accessing the functionality above.
Status: Complete.
Tasks waiting to be done are documented as GitHub issues.
Deprecations
------------
## Other References
1. GLSLang, when installed through CMake, will install a `SPIRV` folder into
`${CMAKE_INSTALL_INCLUDEDIR}`. This `SPIRV` folder is being moved to
`glslang/SPIRV`. During the transition the `SPIRV` folder will be installed into
both locations. The old install of `SPIRV/` will be removed as a CMake install
target no sooner then May 1, 2020. See issue #1964.
Also see the Khronos landing page for glslang as a reference front end:
Execution of Standalone Wrapper
-------------------------------
https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
The above page, while not kept up to date, includes additional information regarding glslang as a reference validator.
# How to Use Glslang
## Execution of Standalone Wrapper
To use the standalone binary form, execute `glslangValidator`, and it will print
a usage statement. Basic operation is to give it a file containing a shader,
@ -55,8 +81,7 @@ The applied stage-specific rules are based on the file extension:
There is also a non-shader extension
* `.conf` for a configuration file of limits, see usage statement for example
Building
--------
## Building
Instead of building manually, you can also download the binaries for your
platform directly from the [master-tot release][master-tot-release] on GitHub.
@ -79,7 +104,7 @@ branch.
The following steps assume a Bash shell. On Windows, that could be the Git Bash
shell or some other shell of your choosing.
#### 1) Check-Out this project
#### 1) Check-Out this project
```bash
cd <parent of where you want glslang to be>
@ -127,6 +152,14 @@ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$(pwd)/install" $SOURCE
# "Release" (for CMAKE_BUILD_TYPE) could also be "Debug" or "RelWithDebInfo"
```
For building on Android:
```bash
cmake $SOURCE_DIR -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DANDROID_ABI=arm64-v8a -DCMAKE_BUILD_TYPE=Release -DANDROID_STL=c++_static -DANDROID_PLATFORM=android-24 -DCMAKE_SYSTEM_NAME=Android -DANDROID_TOOLCHAIN=clang -DANDROID_ARM_MODE=arm -DCMAKE_MAKE_PROGRAM=$ANDROID_NDK_ROOT/prebuilt/linux-x86_64/bin/make -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake
# If on Windows will be -DCMAKE_MAKE_PROGRAM=%ANDROID_NDK_ROOT%\prebuilt\windows-x86_64\bin\make.exe
# -G is needed for building on Windows
# -DANDROID_ABI can also be armeabi-v7a for 32 bit
```
For building on Windows:
```bash
@ -176,31 +209,45 @@ With no arguments it builds the full grammar, and with a "web" argument,
the web grammar subset (see more about the web subset in the next section).
### Building to WASM for the Web and Node
### Building a standalone JS/WASM library for the Web and Node
Use the steps in [Build Steps](#build-steps), with the following notes/exceptions:
* For building the web subset of core glslang:
* `emsdk` needs to be present in your executable search path, *PATH* for
Bash-like environments:
+ [Instructions located here](https://emscripten.org/docs/getting_started/downloads.html#sdk-download-and-install)
* Wrap cmake call: `emcmake cmake`
* Set `-DBUILD_TESTING=OFF -DENABLE_OPT=OFF -DINSTALL_GTEST=OFF`.
* Set `-DENABLE_HLSL=OFF` if HLSL is not needed.
* For a standalone JS/WASM library, turn on `-DENABLE_GLSLANG_JS=ON`.
* For building a minimum-size web subset of core glslang:
+ turn on `-DENABLE_GLSLANG_WEBMIN=ON` (disables HLSL)
+ execute `updateGrammar web` from the glslang subdirectory
(or if using your own scripts, `m4` needs a `-DGLSLANG_WEB` argument)
+ set `-DENABLE_HLSL=OFF -DBUILD_TESTING=OFF -DENABLE_OPT=OFF -DINSTALL_GTEST=OFF`
+ turn on `-DENABLE_GLSLANG_WEB=ON`
+ optionally, for GLSL compilation error messages, turn on `-DENABLE_GLSLANG_WEB_DEVEL=ON`
* `emsdk` needs to be present in your executable search path, *PATH* for
Bash-like enivironments
+ [Instructions located
here](https://emscripten.org/docs/getting_started/downloads.html#sdk-download-and-install)
* Wrap cmake call: `emcmake cmake`
+ optionally, for GLSL compilation error messages, turn on
`-DENABLE_GLSLANG_WEBMIN_DEVEL=ON`
* To get a fully minimized build, make sure to use `brotli` to compress the .js
and .wasm files
Example:
```sh
emcmake cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_GLSLANG_WEB=ON \
emcmake cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_GLSLANG_JS=ON \
-DENABLE_HLSL=OFF -DBUILD_TESTING=OFF -DENABLE_OPT=OFF -DINSTALL_GTEST=OFF ..
```
Testing
-------
## Building glslang - Using vcpkg
You can download and install glslang using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg install glslang
The glslang port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
## Testing
Right now, there are two test harnesses existing in glslang: one is [Google
Test](gtests/), one is the [`runtests` script](Test/runtests). The former
@ -272,8 +319,7 @@ You can add your own private list of tests, not tracked publicly, by using
`localtestlist` to list non-tracked tests. This is automatically read
by `runtests` and included in the `diff` and `bump` process.
Programmatic Interfaces
-----------------------
## Programmatic Interfaces
Another piece of software can programmatically translate shaders to an AST
using one of two different interfaces:
@ -309,7 +355,7 @@ class TProgram
Reflection queries
```
For just validating (not generating code), subsitute these calls:
For just validating (not generating code), substitute these calls:
```cxx
setEnvInput(EShSourceHlsl or EShSourceGlsl, stage, EShClientNone, 0);
@ -327,7 +373,7 @@ This interface is in roughly the first 2/3 of `ShaderLang.h`, and referred to
as the `Sh*()` interface, as all the entry points start `Sh`.
The `Sh*()` interface takes a "compiler" call-back object, which it calls after
building call back that is passed the AST and can then execute a backend on it.
building call back that is passed the AST and can then execute a back end on it.
The following is a simplified resulting run-time call stack:
@ -338,8 +384,7 @@ ShCompile(shader, compiler) -> compiler(AST) -> <back end>
In practice, `ShCompile()` takes shader strings, default version, and
warning/error and other options for controlling compilation.
Basic Internal Operation
------------------------
## Basic Internal Operation
* Initial lexical analysis is done by the preprocessor in
`MachineIndependent/Preprocessor`, and then refined by a GLSL scanner
@ -354,7 +399,7 @@ Basic Internal Operation
* The intermediate representation is very high-level, and represented
as an in-memory tree. This serves to lose no information from the
original program, and to have efficient transfer of the result from
parsing to the back-end. In the AST, constants are propogated and
parsing to the back-end. In the AST, constants are propagated and
folded, and a very small amount of dead code is eliminated.
To aid linking and reflection, the last top-level branch in the AST
@ -386,6 +431,8 @@ Basic Internal Operation
- the object does not come from the pool, and you have to do normal
C++ memory management of what you `new`
* Features can be protected by version/extension/stage/profile:
See the comment in `glslang/MachineIndependent/Versions.cpp`.
[cmake]: https://cmake.org/
[python]: https://www.python.org/

3
core/deps/glslang/SPIRV/CMakeLists.txt Executable file → Normal file
View File

@ -27,7 +27,8 @@ set(HEADERS
SpvTools.h
disassemble.h
GLSL.ext.AMD.h
GLSL.ext.NV.h)
GLSL.ext.NV.h
NonSemanticDebugPrintf.h)
set(SPVREMAP_HEADERS
SPVRemapper.h

View File

@ -1,5 +1,6 @@
/*
** Copyright (c) 2014-2016 The Khronos Group Inc.
** Copyright (c) 2014-2020 The Khronos Group Inc.
** Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
**
** Permission is hereby granted, free of charge, to any person obtaining a copy
** of this software and/or associated documentation files (the "Materials"),
@ -44,5 +45,7 @@ static const char* const E_SPV_EXT_physical_storage_buffer = "SPV_EXT_physi
static const char* const E_SPV_KHR_physical_storage_buffer = "SPV_KHR_physical_storage_buffer";
static const char* const E_SPV_EXT_fragment_shader_interlock = "SPV_EXT_fragment_shader_interlock";
static const char* const E_SPV_KHR_shader_clock = "SPV_KHR_shader_clock";
static const char* const E_SPV_KHR_non_semantic_info = "SPV_KHR_non_semantic_info";
static const char* const E_SPV_KHR_ray_tracing = "SPV_KHR_ray_tracing";
static const char* const E_SPV_KHR_ray_query = "SPV_KHR_ray_query";
#endif // #ifndef GLSLextKHR_H

854
core/deps/glslang/SPIRV/GlslangToSpv.cpp Executable file → Normal file

File diff suppressed because it is too large Load Diff

View File

@ -69,4 +69,4 @@ std::string SpvBuildLogger::getAllMessages() const {
} // end spv namespace
#endif
#endif

View File

@ -0,0 +1,50 @@
// Copyright (c) 2020 The Khronos Group Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and/or associated documentation files (the
// "Materials"), to deal in the Materials without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Materials, and to
// permit persons to whom the Materials are furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Materials.
//
// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
// KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
// SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
// https://www.khronos.org/registry/
//
// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
//
#ifndef SPIRV_UNIFIED1_NonSemanticDebugPrintf_H_
#define SPIRV_UNIFIED1_NonSemanticDebugPrintf_H_
#ifdef __cplusplus
extern "C" {
#endif
enum {
NonSemanticDebugPrintfRevision = 1,
NonSemanticDebugPrintfRevision_BitWidthPadding = 0x7fffffff
};
enum NonSemanticDebugPrintfInstructions {
NonSemanticDebugPrintfDebugPrintf = 1,
NonSemanticDebugPrintfInstructionsMax = 0x7fffffff
};
#ifdef __cplusplus
}
#endif
#endif // SPIRV_UNIFIED1_NonSemanticDebugPrintf_H_

View File

@ -1,6 +1,7 @@
//
// Copyright (C) 2014-2015 LunarG, Inc.
// Copyright (C) 2015-2018 Google, Inc.
// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
//
// All rights reserved.
//
@ -496,7 +497,8 @@ Id Builder::makeFunctionType(Id returnType, const std::vector<Id>& paramTypes)
return type->getResultId();
}
Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, bool ms, unsigned sampled, ImageFormat format)
Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, bool ms, unsigned sampled,
ImageFormat format)
{
assert(sampled == 1 || sampled == 2);
@ -601,16 +603,31 @@ Id Builder::makeSampledImageType(Id imageType)
}
#ifndef GLSLANG_WEB
Id Builder::makeAccelerationStructureNVType()
Id Builder::makeAccelerationStructureType()
{
Instruction *type;
if (groupedTypes[OpTypeAccelerationStructureNV].size() == 0) {
type = new Instruction(getUniqueId(), NoType, OpTypeAccelerationStructureNV);
groupedTypes[OpTypeAccelerationStructureNV].push_back(type);
if (groupedTypes[OpTypeAccelerationStructureKHR].size() == 0) {
type = new Instruction(getUniqueId(), NoType, OpTypeAccelerationStructureKHR);
groupedTypes[OpTypeAccelerationStructureKHR].push_back(type);
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type);
} else {
type = groupedTypes[OpTypeAccelerationStructureNV].back();
type = groupedTypes[OpTypeAccelerationStructureKHR].back();
}
return type->getResultId();
}
Id Builder::makeRayQueryType()
{
Instruction *type;
if (groupedTypes[OpTypeRayQueryProvisionalKHR].size() == 0) {
type = new Instruction(getUniqueId(), NoType, OpTypeRayQueryProvisionalKHR);
groupedTypes[OpTypeRayQueryProvisionalKHR].push_back(type);
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
module.mapInstruction(type);
} else {
type = groupedTypes[OpTypeRayQueryProvisionalKHR].back();
}
return type->getResultId();
@ -1270,7 +1287,8 @@ Function* Builder::makeEntryPoint(const char* entryPoint)
// Comments in header
Function* Builder::makeFunctionEntry(Decoration precision, Id returnType, const char* name,
const std::vector<Id>& paramTypes, const std::vector<std::vector<Decoration>>& decorations, Block **entry)
const std::vector<Id>& paramTypes,
const std::vector<std::vector<Decoration>>& decorations, Block **entry)
{
// Make the function and initial instructions in it
Id typeId = makeFunctionType(returnType, paramTypes);
@ -1373,7 +1391,8 @@ Id Builder::createUndefined(Id type)
}
// av/vis/nonprivate are unnecessary and illegal for some storage classes.
spv::MemoryAccessMask Builder::sanitizeMemoryAccessForStorageClass(spv::MemoryAccessMask memoryAccess, StorageClass sc) const
spv::MemoryAccessMask Builder::sanitizeMemoryAccessForStorageClass(spv::MemoryAccessMask memoryAccess, StorageClass sc)
const
{
switch (sc) {
case spv::StorageClassUniform:
@ -1392,7 +1411,8 @@ spv::MemoryAccessMask Builder::sanitizeMemoryAccessForStorageClass(spv::MemoryAc
}
// Comments in header
void Builder::createStore(Id rValue, Id lValue, spv::MemoryAccessMask memoryAccess, spv::Scope scope, unsigned int alignment)
void Builder::createStore(Id rValue, Id lValue, spv::MemoryAccessMask memoryAccess, spv::Scope scope,
unsigned int alignment)
{
Instruction* store = new Instruction(OpStore);
store->addIdOperand(lValue);
@ -1495,7 +1515,8 @@ Id Builder::createCompositeExtract(Id composite, Id typeId, unsigned index)
// Generate code for spec constants if in spec constant operation
// generation mode.
if (generatingOpCodeForSpecConst) {
return createSpecConstantOp(OpCompositeExtract, typeId, std::vector<Id>(1, composite), std::vector<Id>(1, index));
return createSpecConstantOp(OpCompositeExtract, typeId, std::vector<Id>(1, composite),
std::vector<Id>(1, index));
}
Instruction* extract = new Instruction(getUniqueId(), typeId, OpCompositeExtract);
extract->addIdOperand(composite);
@ -1697,7 +1718,8 @@ Id Builder::createOp(Op opCode, Id typeId, const std::vector<IdImmediate>& opera
return op->getResultId();
}
Id Builder::createSpecConstantOp(Op opCode, Id typeId, const std::vector<Id>& operands, const std::vector<unsigned>& literals)
Id Builder::createSpecConstantOp(Op opCode, Id typeId, const std::vector<Id>& operands,
const std::vector<unsigned>& literals)
{
Instruction* op = new Instruction(getUniqueId(), typeId, OpSpecConstantOp);
op->addImmediateOperand((unsigned) opCode);
@ -2187,7 +2209,8 @@ Id Builder::createCompositeCompare(Decoration precision, Id value1, Id value2, b
if (constituent == 0)
resultId = subResultId;
else
resultId = setPrecision(createBinOp(equal ? OpLogicalAnd : OpLogicalOr, boolType, resultId, subResultId), precision);
resultId = setPrecision(createBinOp(equal ? OpLogicalAnd : OpLogicalOr, boolType, resultId, subResultId),
precision);
}
return resultId;
@ -2196,7 +2219,8 @@ Id Builder::createCompositeCompare(Decoration precision, Id value1, Id value2, b
// OpCompositeConstruct
Id Builder::createCompositeConstruct(Id typeId, const std::vector<Id>& constituents)
{
assert(isAggregateType(typeId) || (getNumTypeConstituents(typeId) > 1 && getNumTypeConstituents(typeId) == (int)constituents.size()));
assert(isAggregateType(typeId) || (getNumTypeConstituents(typeId) > 1 &&
getNumTypeConstituents(typeId) == (int)constituents.size()));
if (generatingOpCodeForSpecConst) {
// Sometime, even in spec-constant-op mode, the constant composite to be
@ -2609,7 +2633,8 @@ void Builder::clearAccessChain()
}
// Comments in header
void Builder::accessChainPushSwizzle(std::vector<unsigned>& swizzle, Id preSwizzleBaseType, AccessChain::CoherentFlags coherentFlags, unsigned int alignment)
void Builder::accessChainPushSwizzle(std::vector<unsigned>& swizzle, Id preSwizzleBaseType,
AccessChain::CoherentFlags coherentFlags, unsigned int alignment)
{
accessChain.coherentFlags |= coherentFlags;
accessChain.alignment |= alignment;
@ -2663,7 +2688,8 @@ void Builder::accessChainStore(Id rvalue, spv::MemoryAccessMask memoryAccess, sp
}
// Comments in header
Id Builder::accessChainLoad(Decoration precision, Decoration nonUniform, Id resultType, spv::MemoryAccessMask memoryAccess, spv::Scope scope, unsigned int alignment)
Id Builder::accessChainLoad(Decoration precision, Decoration nonUniform, Id resultType,
spv::MemoryAccessMask memoryAccess, spv::Scope scope, unsigned int alignment)
{
Id id;
@ -2721,7 +2747,13 @@ Id Builder::accessChainLoad(Decoration precision, Decoration nonUniform, Id resu
}
// load through the access chain
id = createLoad(collapseAccessChain(), memoryAccess, scope, alignment);
id = collapseAccessChain();
// Apply nonuniform both to the access chain and the loaded value.
// Buffer accesses need the access chain decorated, and this is where
// loaded image types get decorated. TODO: This should maybe move to
// createImageTextureFunctionCall.
addDecoration(id, nonUniform);
id = createLoad(id, memoryAccess, scope, alignment);
setPrecision(id, precision);
addDecoration(id, nonUniform);
}
@ -3075,7 +3107,8 @@ void Builder::dumpSourceInstructions(std::vector<unsigned int>& out) const
dumpSourceInstructions(iItr->first, *iItr->second, out);
}
void Builder::dumpInstructions(std::vector<unsigned int>& out, const std::vector<std::unique_ptr<Instruction> >& instructions) const
void Builder::dumpInstructions(std::vector<unsigned int>& out,
const std::vector<std::unique_ptr<Instruction> >& instructions) const
{
for (int i = 0; i < (int)instructions.size(); ++i) {
instructions[i]->dump(out);

View File

@ -1,7 +1,8 @@
//
// Copyright (C) 2014-2015 LunarG, Inc.
// Copyright (C) 2015-2018 Google, Inc.
// Copyright (C) 2015-2020 Google, Inc.
// Copyright (C) 2017 ARM Limited.
// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
//
// All rights reserved.
//
@ -94,6 +95,7 @@ public:
const char* file_c_str = str.c_str();
fileString->addStringOperand(file_c_str);
strings.push_back(std::unique_ptr<Instruction>(fileString));
module.mapInstruction(fileString);
stringIds[file_c_str] = strId;
return strId;
}
@ -181,7 +183,9 @@ public:
Id makeCooperativeMatrixType(Id component, Id scope, Id rows, Id cols);
// accelerationStructureNV type
Id makeAccelerationStructureNVType();
Id makeAccelerationStructureType();
// rayQueryEXT type
Id makeRayQueryType();
// For querying about types.
Id getTypeId(Id resultId) const { return module.getTypeId(resultId); }
@ -196,7 +200,8 @@ public:
Id getContainedTypeId(Id typeId) const;
Id getContainedTypeId(Id typeId, int) const;
StorageClass getTypeStorageClass(Id typeId) const { return module.getStorageClass(typeId); }
ImageFormat getImageTypeFormat(Id typeId) const { return (ImageFormat)module.getInstruction(typeId)->getImmediateOperand(6); }
ImageFormat getImageTypeFormat(Id typeId) const
{ return (ImageFormat)module.getInstruction(typeId)->getImmediateOperand(6); }
bool isPointer(Id resultId) const { return isPointerType(getTypeId(resultId)); }
bool isScalar(Id resultId) const { return isScalarType(getTypeId(resultId)); }
@ -206,12 +211,17 @@ public:
bool isAggregate(Id resultId) const { return isAggregateType(getTypeId(resultId)); }
bool isSampledImage(Id resultId) const { return isSampledImageType(getTypeId(resultId)); }
bool isBoolType(Id typeId) { return groupedTypes[OpTypeBool].size() > 0 && typeId == groupedTypes[OpTypeBool].back()->getResultId(); }
bool isIntType(Id typeId) const { return getTypeClass(typeId) == OpTypeInt && module.getInstruction(typeId)->getImmediateOperand(1) != 0; }
bool isUintType(Id typeId) const { return getTypeClass(typeId) == OpTypeInt && module.getInstruction(typeId)->getImmediateOperand(1) == 0; }
bool isBoolType(Id typeId)
{ return groupedTypes[OpTypeBool].size() > 0 && typeId == groupedTypes[OpTypeBool].back()->getResultId(); }
bool isIntType(Id typeId) const
{ return getTypeClass(typeId) == OpTypeInt && module.getInstruction(typeId)->getImmediateOperand(1) != 0; }
bool isUintType(Id typeId) const
{ return getTypeClass(typeId) == OpTypeInt && module.getInstruction(typeId)->getImmediateOperand(1) == 0; }
bool isFloatType(Id typeId) const { return getTypeClass(typeId) == OpTypeFloat; }
bool isPointerType(Id typeId) const { return getTypeClass(typeId) == OpTypePointer; }
bool isScalarType(Id typeId) const { return getTypeClass(typeId) == OpTypeFloat || getTypeClass(typeId) == OpTypeInt || getTypeClass(typeId) == OpTypeBool; }
bool isScalarType(Id typeId) const
{ return getTypeClass(typeId) == OpTypeFloat || getTypeClass(typeId) == OpTypeInt ||
getTypeClass(typeId) == OpTypeBool; }
bool isVectorType(Id typeId) const { return getTypeClass(typeId) == OpTypeVector; }
bool isMatrixType(Id typeId) const { return getTypeClass(typeId) == OpTypeMatrix; }
bool isStructType(Id typeId) const { return getTypeClass(typeId) == OpTypeStruct; }
@ -221,7 +231,8 @@ public:
#else
bool isCooperativeMatrixType(Id typeId)const { return getTypeClass(typeId) == OpTypeCooperativeMatrixNV; }
#endif
bool isAggregateType(Id typeId) const { return isArrayType(typeId) || isStructType(typeId) || isCooperativeMatrixType(typeId); }
bool isAggregateType(Id typeId) const
{ return isArrayType(typeId) || isStructType(typeId) || isCooperativeMatrixType(typeId); }
bool isImageType(Id typeId) const { return getTypeClass(typeId) == OpTypeImage; }
bool isSamplerType(Id typeId) const { return getTypeClass(typeId) == OpTypeSampler; }
bool isSampledImageType(Id typeId) const { return getTypeClass(typeId) == OpTypeSampledImage; }
@ -233,7 +244,8 @@ public:
bool isConstant(Id resultId) const { return isConstantOpCode(getOpCode(resultId)); }
bool isConstantScalar(Id resultId) const { return getOpCode(resultId) == OpConstant; }
bool isSpecConstant(Id resultId) const { return isSpecConstantOpCode(getOpCode(resultId)); }
unsigned int getConstantScalar(Id resultId) const { return module.getInstruction(resultId)->getImmediateOperand(0); }
unsigned int getConstantScalar(Id resultId) const
{ return module.getInstruction(resultId)->getImmediateOperand(0); }
StorageClass getStorageClass(Id resultId) const { return getTypeStorageClass(getTypeId(resultId)); }
int getScalarTypeWidth(Id typeId) const
@ -275,14 +287,22 @@ public:
// For making new constants (will return old constant if the requested one was already made).
Id makeBoolConstant(bool b, bool specConstant = false);
Id makeInt8Constant(int i, bool specConstant = false) { return makeIntConstant(makeIntType(8), (unsigned)i, specConstant); }
Id makeUint8Constant(unsigned u, bool specConstant = false) { return makeIntConstant(makeUintType(8), u, specConstant); }
Id makeInt16Constant(int i, bool specConstant = false) { return makeIntConstant(makeIntType(16), (unsigned)i, specConstant); }
Id makeUint16Constant(unsigned u, bool specConstant = false) { return makeIntConstant(makeUintType(16), u, specConstant); }
Id makeIntConstant(int i, bool specConstant = false) { return makeIntConstant(makeIntType(32), (unsigned)i, specConstant); }
Id makeUintConstant(unsigned u, bool specConstant = false) { return makeIntConstant(makeUintType(32), u, specConstant); }
Id makeInt64Constant(long long i, bool specConstant = false) { return makeInt64Constant(makeIntType(64), (unsigned long long)i, specConstant); }
Id makeUint64Constant(unsigned long long u, bool specConstant = false) { return makeInt64Constant(makeUintType(64), u, specConstant); }
Id makeInt8Constant(int i, bool specConstant = false)
{ return makeIntConstant(makeIntType(8), (unsigned)i, specConstant); }
Id makeUint8Constant(unsigned u, bool specConstant = false)
{ return makeIntConstant(makeUintType(8), u, specConstant); }
Id makeInt16Constant(int i, bool specConstant = false)
{ return makeIntConstant(makeIntType(16), (unsigned)i, specConstant); }
Id makeUint16Constant(unsigned u, bool specConstant = false)
{ return makeIntConstant(makeUintType(16), u, specConstant); }
Id makeIntConstant(int i, bool specConstant = false)
{ return makeIntConstant(makeIntType(32), (unsigned)i, specConstant); }
Id makeUintConstant(unsigned u, bool specConstant = false)
{ return makeIntConstant(makeUintType(32), u, specConstant); }
Id makeInt64Constant(long long i, bool specConstant = false)
{ return makeInt64Constant(makeIntType(64), (unsigned long long)i, specConstant); }
Id makeUint64Constant(unsigned long long u, bool specConstant = false)
{ return makeInt64Constant(makeUintType(64), u, specConstant); }
Id makeFloatConstant(float f, bool specConstant = false);
Id makeDoubleConstant(double d, bool specConstant = false);
Id makeFloat16Constant(float f16, bool specConstant = false);
@ -313,8 +333,8 @@ public:
// Make a shader-style function, and create its entry block if entry is non-zero.
// Return the function, pass back the entry.
// The returned pointer is only valid for the lifetime of this builder.
Function* makeFunctionEntry(Decoration precision, Id returnType, const char* name, const std::vector<Id>& paramTypes,
const std::vector<std::vector<Decoration>>& precisions, Block **entry = 0);
Function* makeFunctionEntry(Decoration precision, Id returnType, const char* name,
const std::vector<Id>& paramTypes, const std::vector<std::vector<Decoration>>& precisions, Block **entry = 0);
// Create a return. An 'implicit' return is one not appearing in the source
// code. In the case of an implicit return, no post-return block is inserted.
@ -333,10 +353,12 @@ public:
Id createUndefined(Id type);
// Store into an Id and return the l-value
void createStore(Id rValue, Id lValue, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, spv::Scope scope = spv::ScopeMax, unsigned int alignment = 0);
void createStore(Id rValue, Id lValue, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone,
spv::Scope scope = spv::ScopeMax, unsigned int alignment = 0);
// Load from an Id and return it
Id createLoad(Id lValue, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, spv::Scope scope = spv::ScopeMax, unsigned int alignment = 0);
Id createLoad(Id lValue, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone,
spv::Scope scope = spv::ScopeMax, unsigned int alignment = 0);
// Create an OpAccessChain instruction
Id createAccessChain(StorageClass, Id base, const std::vector<Id>& offsets);
@ -495,7 +517,7 @@ public:
// recursion stack can hold the memory for it.
//
void makeSwitch(Id condition, unsigned int control, int numSegments, const std::vector<int>& caseValues,
const std::vector<int>& valueToSegment, int defaultSegment, std::vector<Block*>& segmentBB); // return argument
const std::vector<int>& valueToSegment, int defaultSegment, std::vector<Block*>& segmentBB);
// Add a branch to the innermost switch's merge block.
void addSwitchBreak();
@ -512,7 +534,7 @@ public:
Block &head, &body, &merge, &continue_target;
private:
LoopBlocks();
LoopBlocks& operator=(const LoopBlocks&);
LoopBlocks& operator=(const LoopBlocks&) = delete;
};
// Start a new loop and prepare the builder to generate code for it. Until
@ -569,10 +591,13 @@ public:
std::vector<Id> indexChain;
Id instr; // cache the instruction that generates this access chain
std::vector<unsigned> swizzle; // each std::vector element selects the next GLSL component number
Id component; // a dynamic component index, can coexist with a swizzle, done after the swizzle, NoResult if not present
Id preSwizzleBaseType; // dereferenced type, before swizzle or component is applied; NoType unless a swizzle or component is present
Id component; // a dynamic component index, can coexist with a swizzle,
// done after the swizzle, NoResult if not present
Id preSwizzleBaseType; // dereferenced type, before swizzle or component is applied;
// NoType unless a swizzle or component is present
bool isRValue; // true if 'base' is an r-value, otherwise, base is an l-value
unsigned int alignment; // bitwise OR of alignment values passed in. Accumulates worst alignment. Only tracks base and (optional) component selection alignment.
unsigned int alignment; // bitwise OR of alignment values passed in. Accumulates worst alignment.
// Only tracks base and (optional) component selection alignment.
// Accumulate whether anything in the chain of structures has coherent decorations.
struct CoherentFlags {
@ -583,12 +608,17 @@ public:
CoherentFlags operator |=(const CoherentFlags &other) { return *this; }
#else
bool isVolatile() const { return volatil; }
bool anyCoherent() const {
return coherent || devicecoherent || queuefamilycoherent || workgroupcoherent ||
subgroupcoherent || shadercallcoherent;
}
unsigned coherent : 1;
unsigned devicecoherent : 1;
unsigned queuefamilycoherent : 1;
unsigned workgroupcoherent : 1;
unsigned subgroupcoherent : 1;
unsigned shadercallcoherent : 1;
unsigned nonprivate : 1;
unsigned volatil : 1;
unsigned isImage : 1;
@ -599,6 +629,7 @@ public:
queuefamilycoherent = 0;
workgroupcoherent = 0;
subgroupcoherent = 0;
shadercallcoherent = 0;
nonprivate = 0;
volatil = 0;
isImage = 0;
@ -610,6 +641,7 @@ public:
queuefamilycoherent |= other.queuefamilycoherent;
workgroupcoherent |= other.workgroupcoherent;
subgroupcoherent |= other.subgroupcoherent;
shadercallcoherent |= other.shadercallcoherent;
nonprivate |= other.nonprivate;
volatil |= other.volatil;
isImage |= other.isImage;
@ -655,11 +687,13 @@ public:
}
// push new swizzle onto the end of any existing swizzle, merging into a single swizzle
void accessChainPushSwizzle(std::vector<unsigned>& swizzle, Id preSwizzleBaseType, AccessChain::CoherentFlags coherentFlags, unsigned int alignment);
void accessChainPushSwizzle(std::vector<unsigned>& swizzle, Id preSwizzleBaseType,
AccessChain::CoherentFlags coherentFlags, unsigned int alignment);
// push a dynamic component selection onto the access chain, only applicable with a
// non-trivial swizzle or no swizzle
void accessChainPushComponent(Id component, Id preSwizzleBaseType, AccessChain::CoherentFlags coherentFlags, unsigned int alignment)
void accessChainPushComponent(Id component, Id preSwizzleBaseType, AccessChain::CoherentFlags coherentFlags,
unsigned int alignment)
{
if (accessChain.swizzle.size() != 1) {
accessChain.component = component;
@ -671,10 +705,18 @@ public:
}
// use accessChain and swizzle to store value
void accessChainStore(Id rvalue, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, spv::Scope scope = spv::ScopeMax, unsigned int alignment = 0);
void accessChainStore(Id rvalue, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone,
spv::Scope scope = spv::ScopeMax, unsigned int alignment = 0);
// use accessChain and swizzle to load an r-value
Id accessChainLoad(Decoration precision, Decoration nonUniform, Id ResultType, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, spv::Scope scope = spv::ScopeMax, unsigned int alignment = 0);
Id accessChainLoad(Decoration precision, Decoration nonUniform, Id ResultType,
spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, spv::Scope scope = spv::ScopeMax,
unsigned int alignment = 0);
// Return whether or not the access chain can be represented in SPIR-V
// as an l-value.
// E.g., a[3].yx cannot be, while a[3].y and a[3].y[x] can be.
bool isSpvLvalue() const { return accessChain.swizzle.size() <= 1; }
// get the direct pointer for an l-value
Id accessChainGetLValue();
@ -703,7 +745,8 @@ public:
void createBranch(Block* block);
void createConditionalBranch(Id condition, Block* thenBlock, Block* elseBlock);
void createLoopMerge(Block* mergeBlock, Block* continueBlock, unsigned int control, const std::vector<unsigned int>& operands);
void createLoopMerge(Block* mergeBlock, Block* continueBlock, unsigned int control,
const std::vector<unsigned int>& operands);
// Sets to generate opcode for specialization constants.
void setToSpecConstCodeGenMode() { generatingOpCodeForSpecConst = true; }
@ -729,7 +772,8 @@ public:
void dumpSourceInstructions(const spv::Id fileId, const std::string& text, std::vector<unsigned int>&) const;
void dumpInstructions(std::vector<unsigned int>&, const std::vector<std::unique_ptr<Instruction> >&) const;
void dumpModuleProcesses(std::vector<unsigned int>&) const;
spv::MemoryAccessMask sanitizeMemoryAccessForStorageClass(spv::MemoryAccessMask memoryAccess, StorageClass sc) const;
spv::MemoryAccessMask sanitizeMemoryAccessForStorageClass(spv::MemoryAccessMask memoryAccess, StorageClass sc)
const;
unsigned int spvVersion; // the version of SPIR-V to emit in the header
SourceLanguage source;
@ -764,10 +808,14 @@ public:
std::vector<std::unique_ptr<Instruction> > externals;
std::vector<std::unique_ptr<Function> > functions;
// not output, internally used for quick & dirty canonical (unique) creation
std::unordered_map<unsigned int, std::vector<Instruction*>> groupedConstants; // map type opcodes to constant inst.
std::unordered_map<unsigned int, std::vector<Instruction*>> groupedStructConstants; // map struct-id to constant instructions
std::unordered_map<unsigned int, std::vector<Instruction*>> groupedTypes; // map type opcodes to type instructions
// not output, internally used for quick & dirty canonical (unique) creation
// map type opcodes to constant inst.
std::unordered_map<unsigned int, std::vector<Instruction*>> groupedConstants;
// map struct-id to constant instructions
std::unordered_map<unsigned int, std::vector<Instruction*>> groupedStructConstants;
// map type opcodes to type instructions
std::unordered_map<unsigned int, std::vector<Instruction*>> groupedTypes;
// stack of switches
std::stack<Block*> switchMerges;

View File

@ -1,6 +1,6 @@
//
// Copyright (C) 2014-2016 LunarG, Inc.
// Copyright (C) 2018 Google, Inc.
// Copyright (C) 2018-2020 Google, Inc.
//
// All rights reserved.
//
@ -67,6 +67,8 @@ spv_target_env MapToSpirvToolsEnv(const SpvVersion& spvVersion, spv::SpvBuildLog
logger->missingFunctionality("Target version for SPIRV-Tools validator");
return spv_target_env::SPV_ENV_VULKAN_1_1;
}
case glslang::EShTargetVulkan_1_2:
return spv_target_env::SPV_ENV_VULKAN_1_2;
default:
break;
}
@ -128,8 +130,8 @@ void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector<
// Apply the SPIRV-Tools optimizer to generated SPIR-V, for the purpose of
// legalizing HLSL SPIR-V.
void SpirvToolsLegalize(const glslang::TIntermediate&, std::vector<unsigned int>& spirv,
spv::SpvBuildLogger*, const SpvOptions* options)
void SpirvToolsLegalize(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv,
spv::SpvBuildLogger* logger, const SpvOptions* options)
{
spv_target_env target_env = SPV_ENV_UNIVERSAL_1_2;
@ -205,7 +207,8 @@ void SpirvToolsLegalize(const glslang::TIntermediate&, std::vector<unsigned int>
}
spvtools::OptimizerOptions spvOptOptions;
spvOptOptions.set_run_validator(false); // The validator may run as a seperate step later on
optimizer.SetTargetEnv(MapToSpirvToolsEnv(intermediate.getSpv(), logger));
spvOptOptions.set_run_validator(false); // The validator may run as a separate step later on
optimizer.Run(spirv.data(), spirv.size(), &spirv, spvOptOptions);
}

View File

@ -75,6 +75,7 @@ enum ExtInstSet {
GLSLextAMDInst,
GLSLextNVInst,
OpenCLExtInst,
NonSemanticDebugPrintfExtInst,
};
// Container class for a single instance of a SPIR-V stream, with methods for disassembly.
@ -480,8 +481,12 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
if (opCode == OpExtInst) {
ExtInstSet extInstSet = GLSL450Inst;
const char* name = idDescriptor[stream[word - 2]].c_str();
if (0 == memcmp("OpenCL", name, 6)) {
if (strcmp("OpenCL.std", name) == 0) {
extInstSet = OpenCLExtInst;
} else if (strcmp("OpenCL.DebugInfo.100", name) == 0) {
extInstSet = OpenCLExtInst;
} else if (strcmp("NonSemantic.DebugPrintf", name) == 0) {
extInstSet = NonSemanticDebugPrintfExtInst;
} else if (strcmp(spv::E_SPV_AMD_shader_ballot, name) == 0 ||
strcmp(spv::E_SPV_AMD_shader_trinary_minmax, name) == 0 ||
strcmp(spv::E_SPV_AMD_shader_explicit_vertex_parameter, name) == 0 ||
@ -505,6 +510,8 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
}
else if (extInstSet == GLSLextNVInst) {
out << "(" << GLSLextNVGetDebugNames(name, entrypoint) << ")";
} else if (extInstSet == NonSemanticDebugPrintfExtInst) {
out << "(DebugPrintf)";
}
}
break;

View File

@ -1,5 +1,6 @@
//
// Copyright (C) 2014-2015 LunarG, Inc.
// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
//
// All rights reserved.
//
@ -99,12 +100,12 @@ const char* ExecutionModelString(int model)
default: return "Bad";
case ExecutionModelRayGenerationNV: return "RayGenerationNV";
case ExecutionModelIntersectionNV: return "IntersectionNV";
case ExecutionModelAnyHitNV: return "AnyHitNV";
case ExecutionModelClosestHitNV: return "ClosestHitNV";
case ExecutionModelMissNV: return "MissNV";
case ExecutionModelCallableNV: return "CallableNV";
case ExecutionModelRayGenerationKHR: return "RayGenerationKHR";
case ExecutionModelIntersectionKHR: return "IntersectionKHR";
case ExecutionModelAnyHitKHR: return "AnyHitKHR";
case ExecutionModelClosestHitKHR: return "ClosestHitKHR";
case ExecutionModelMissKHR: return "MissKHR";
case ExecutionModelCallableKHR: return "CallableKHR";
}
}
@ -209,12 +210,12 @@ const char* StorageClassString(int StorageClass)
case 11: return "Image";
case 12: return "StorageBuffer";
case StorageClassRayPayloadNV: return "RayPayloadNV";
case StorageClassHitAttributeNV: return "HitAttributeNV";
case StorageClassIncomingRayPayloadNV: return "IncomingRayPayloadNV";
case StorageClassShaderRecordBufferNV: return "ShaderRecordBufferNV";
case StorageClassCallableDataNV: return "CallableDataNV";
case StorageClassIncomingCallableDataNV: return "IncomingCallableDataNV";
case StorageClassRayPayloadKHR: return "RayPayloadKHR";
case StorageClassHitAttributeKHR: return "HitAttributeKHR";
case StorageClassIncomingRayPayloadKHR: return "IncomingRayPayloadKHR";
case StorageClassShaderRecordBufferKHR: return "ShaderRecordBufferKHR";
case StorageClassCallableDataKHR: return "CallableDataKHR";
case StorageClassIncomingCallableDataKHR: return "IncomingCallableDataKHR";
case StorageClassPhysicalStorageBufferEXT: return "PhysicalStorageBufferEXT";
@ -361,32 +362,33 @@ const char* BuiltInString(int builtIn)
case 4996: return "BaryCoordSmoothCentroidAMD";
case 4997: return "BaryCoordSmoothSampleAMD";
case 4998: return "BaryCoordPullModelAMD";
case BuiltInLaunchIdNV: return "LaunchIdNV";
case BuiltInLaunchSizeNV: return "LaunchSizeNV";
case BuiltInWorldRayOriginNV: return "WorldRayOriginNV";
case BuiltInWorldRayDirectionNV: return "WorldRayDirectionNV";
case BuiltInObjectRayOriginNV: return "ObjectRayOriginNV";
case BuiltInObjectRayDirectionNV: return "ObjectRayDirectionNV";
case BuiltInRayTminNV: return "RayTminNV";
case BuiltInRayTmaxNV: return "RayTmaxNV";
case BuiltInInstanceCustomIndexNV: return "InstanceCustomIndexNV";
case BuiltInObjectToWorldNV: return "ObjectToWorldNV";
case BuiltInWorldToObjectNV: return "WorldToObjectNV";
case BuiltInHitTNV: return "HitTNV";
case BuiltInHitKindNV: return "HitKindNV";
case BuiltInIncomingRayFlagsNV: return "IncomingRayFlagsNV";
case BuiltInViewportMaskNV: return "ViewportMaskNV";
case BuiltInSecondaryPositionNV: return "SecondaryPositionNV";
case BuiltInSecondaryViewportMaskNV: return "SecondaryViewportMaskNV";
case BuiltInPositionPerViewNV: return "PositionPerViewNV";
case BuiltInViewportMaskPerViewNV: return "ViewportMaskPerViewNV";
case BuiltInLaunchIdKHR: return "LaunchIdKHR";
case BuiltInLaunchSizeKHR: return "LaunchSizeKHR";
case BuiltInWorldRayOriginKHR: return "WorldRayOriginKHR";
case BuiltInWorldRayDirectionKHR: return "WorldRayDirectionKHR";
case BuiltInObjectRayOriginKHR: return "ObjectRayOriginKHR";
case BuiltInObjectRayDirectionKHR: return "ObjectRayDirectionKHR";
case BuiltInRayTminKHR: return "RayTminKHR";
case BuiltInRayTmaxKHR: return "RayTmaxKHR";
case BuiltInInstanceCustomIndexKHR: return "InstanceCustomIndexKHR";
case BuiltInRayGeometryIndexKHR: return "RayGeometryIndexKHR";
case BuiltInObjectToWorldKHR: return "ObjectToWorldKHR";
case BuiltInWorldToObjectKHR: return "WorldToObjectKHR";
case BuiltInHitTKHR: return "HitTKHR";
case BuiltInHitKindKHR: return "HitKindKHR";
case BuiltInIncomingRayFlagsKHR: return "IncomingRayFlagsKHR";
case BuiltInViewportMaskNV: return "ViewportMaskNV";
case BuiltInSecondaryPositionNV: return "SecondaryPositionNV";
case BuiltInSecondaryViewportMaskNV: return "SecondaryViewportMaskNV";
case BuiltInPositionPerViewNV: return "PositionPerViewNV";
case BuiltInViewportMaskPerViewNV: return "ViewportMaskPerViewNV";
// case BuiltInFragmentSizeNV: return "FragmentSizeNV"; // superseded by BuiltInFragSizeEXT
// case BuiltInInvocationsPerPixelNV: return "InvocationsPerPixelNV"; // superseded by BuiltInFragInvocationCountEXT
case BuiltInBaryCoordNV: return "BaryCoordNV";
case BuiltInBaryCoordNoPerspNV: return "BaryCoordNoPerspNV";
case BuiltInBaryCoordNV: return "BaryCoordNV";
case BuiltInBaryCoordNoPerspNV: return "BaryCoordNoPerspNV";
case BuiltInFragSizeEXT: return "FragSizeEXT";
case BuiltInFragInvocationCountEXT: return "FragInvocationCountEXT";
case BuiltInFragSizeEXT: return "FragSizeEXT";
case BuiltInFragInvocationCountEXT: return "FragInvocationCountEXT";
case 5264: return "FullyCoveredEXT";
@ -890,6 +892,9 @@ const char* CapabilityString(int info)
case CapabilityPerViewAttributesNV: return "PerViewAttributesNV";
case CapabilityGroupNonUniformPartitionedNV: return "GroupNonUniformPartitionedNV";
case CapabilityRayTracingNV: return "RayTracingNV";
case CapabilityRayTracingProvisionalKHR: return "RayTracingProvisionalKHR";
case CapabilityRayQueryProvisionalKHR: return "RayQueryProvisionalKHR";
case CapabilityRayTraversalPrimitiveCullingProvisionalKHR: return "RayTraversalPrimitiveCullingProvisionalKHR";
case CapabilityComputeDerivativeGroupQuadsNV: return "ComputeDerivativeGroupQuadsNV";
case CapabilityComputeDerivativeGroupLinearNV: return "ComputeDerivativeGroupLinearNV";
case CapabilityFragmentBarycentricNV: return "FragmentBarycentricNV";
@ -1326,15 +1331,40 @@ const char* OpcodeString(int op)
case OpMemberDecorateStringGOOGLE: return "OpMemberDecorateStringGOOGLE";
case OpGroupNonUniformPartitionNV: return "OpGroupNonUniformPartitionNV";
case OpReportIntersectionNV: return "OpReportIntersectionNV";
case OpIgnoreIntersectionNV: return "OpIgnoreIntersectionNV";
case OpTerminateRayNV: return "OpTerminateRayNV";
case OpTraceNV: return "OpTraceNV";
case OpTypeAccelerationStructureNV: return "OpTypeAccelerationStructureNV";
case OpExecuteCallableNV: return "OpExecuteCallableNV";
case OpReportIntersectionKHR: return "OpReportIntersectionKHR";
case OpIgnoreIntersectionKHR: return "OpIgnoreIntersectionKHR";
case OpTerminateRayKHR: return "OpTerminateRayKHR";
case OpTraceRayKHR: return "OpTraceRayKHR";
case OpTypeAccelerationStructureKHR: return "OpTypeAccelerationStructureKHR";
case OpExecuteCallableKHR: return "OpExecuteCallableKHR";
case OpImageSampleFootprintNV: return "OpImageSampleFootprintNV";
case OpWritePackedPrimitiveIndices4x8NV: return "OpWritePackedPrimitiveIndices4x8NV";
case OpTypeRayQueryProvisionalKHR: return "OpTypeRayQueryProvisionalKHR";
case OpRayQueryInitializeKHR: return "OpRayQueryInitializeKHR";
case OpRayQueryTerminateKHR: return "OpRayQueryTerminateKHR";
case OpRayQueryGenerateIntersectionKHR: return "OpRayQueryGenerateIntersectionKHR";
case OpRayQueryConfirmIntersectionKHR: return "OpRayQueryConfirmIntersectionKHR";
case OpRayQueryProceedKHR: return "OpRayQueryProceedKHR";
case OpRayQueryGetIntersectionTypeKHR: return "OpRayQueryGetIntersectionTypeKHR";
case OpRayQueryGetRayTMinKHR: return "OpRayQueryGetRayTMinKHR";
case OpRayQueryGetRayFlagsKHR: return "OpRayQueryGetRayFlagsKHR";
case OpRayQueryGetIntersectionTKHR: return "OpRayQueryGetIntersectionTKHR";
case OpRayQueryGetIntersectionInstanceCustomIndexKHR: return "OpRayQueryGetIntersectionInstanceCustomIndexKHR";
case OpRayQueryGetIntersectionInstanceIdKHR: return "OpRayQueryGetIntersectionInstanceIdKHR";
case OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR: return "OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR";
case OpRayQueryGetIntersectionGeometryIndexKHR: return "OpRayQueryGetIntersectionGeometryIndexKHR";
case OpRayQueryGetIntersectionPrimitiveIndexKHR: return "OpRayQueryGetIntersectionPrimitiveIndexKHR";
case OpRayQueryGetIntersectionBarycentricsKHR: return "OpRayQueryGetIntersectionBarycentricsKHR";
case OpRayQueryGetIntersectionFrontFaceKHR: return "OpRayQueryGetIntersectionFrontFaceKHR";
case OpRayQueryGetIntersectionCandidateAABBOpaqueKHR: return "OpRayQueryGetIntersectionCandidateAABBOpaqueKHR";
case OpRayQueryGetIntersectionObjectRayDirectionKHR: return "OpRayQueryGetIntersectionObjectRayDirectionKHR";
case OpRayQueryGetIntersectionObjectRayOriginKHR: return "OpRayQueryGetIntersectionObjectRayOriginKHR";
case OpRayQueryGetWorldRayDirectionKHR: return "OpRayQueryGetWorldRayDirectionKHR";
case OpRayQueryGetWorldRayOriginKHR: return "OpRayQueryGetWorldRayOriginKHR";
case OpRayQueryGetIntersectionObjectToWorldKHR: return "OpRayQueryGetIntersectionObjectToWorldKHR";
case OpRayQueryGetIntersectionWorldToObjectKHR: return "OpRayQueryGetIntersectionWorldToObjectKHR";
case OpTypeCooperativeMatrixNV: return "OpTypeCooperativeMatrixNV";
case OpCooperativeMatrixLoadNV: return "OpCooperativeMatrixLoadNV";
case OpCooperativeMatrixStoreNV: return "OpCooperativeMatrixStoreNV";
@ -2694,31 +2724,125 @@ void Parameterize()
InstructionDesc[OpGroupNonUniformPartitionNV].operands.push(OperandId, "X");
InstructionDesc[OpTypeAccelerationStructureNV].setResultAndType(true, false);
InstructionDesc[OpTypeAccelerationStructureKHR].setResultAndType(true, false);
InstructionDesc[OpTraceNV].operands.push(OperandId, "'NV Acceleration Structure'");
InstructionDesc[OpTraceNV].operands.push(OperandId, "'Ray Flags'");
InstructionDesc[OpTraceNV].operands.push(OperandId, "'Cull Mask'");
InstructionDesc[OpTraceNV].operands.push(OperandId, "'SBT Record Offset'");
InstructionDesc[OpTraceNV].operands.push(OperandId, "'SBT Record Stride'");
InstructionDesc[OpTraceNV].operands.push(OperandId, "'Miss Index'");
InstructionDesc[OpTraceNV].operands.push(OperandId, "'Ray Origin'");
InstructionDesc[OpTraceNV].operands.push(OperandId, "'TMin'");
InstructionDesc[OpTraceNV].operands.push(OperandId, "'Ray Direction'");
InstructionDesc[OpTraceNV].operands.push(OperandId, "'TMax'");
InstructionDesc[OpTraceNV].operands.push(OperandId, "'Payload'");
InstructionDesc[OpTraceNV].setResultAndType(false, false);
InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'NV Acceleration Structure'");
InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'Ray Flags'");
InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'Cull Mask'");
InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'SBT Record Offset'");
InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'SBT Record Stride'");
InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'Miss Index'");
InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'Ray Origin'");
InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'TMin'");
InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'Ray Direction'");
InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'TMax'");
InstructionDesc[OpTraceRayKHR].operands.push(OperandId, "'Payload'");
InstructionDesc[OpTraceRayKHR].setResultAndType(false, false);
InstructionDesc[OpReportIntersectionNV].operands.push(OperandId, "'Hit Parameter'");
InstructionDesc[OpReportIntersectionNV].operands.push(OperandId, "'Hit Kind'");
InstructionDesc[OpReportIntersectionKHR].operands.push(OperandId, "'Hit Parameter'");
InstructionDesc[OpReportIntersectionKHR].operands.push(OperandId, "'Hit Kind'");
InstructionDesc[OpIgnoreIntersectionNV].setResultAndType(false, false);
InstructionDesc[OpIgnoreIntersectionKHR].setResultAndType(false, false);
InstructionDesc[OpTerminateRayNV].setResultAndType(false, false);
InstructionDesc[OpTerminateRayKHR].setResultAndType(false, false);
InstructionDesc[OpExecuteCallableNV].operands.push(OperandId, "SBT Record Index");
InstructionDesc[OpExecuteCallableNV].operands.push(OperandId, "CallableData ID");
InstructionDesc[OpExecuteCallableNV].setResultAndType(false, false);
InstructionDesc[OpExecuteCallableKHR].operands.push(OperandId, "SBT Record Index");
InstructionDesc[OpExecuteCallableKHR].operands.push(OperandId, "CallableData ID");
InstructionDesc[OpExecuteCallableKHR].setResultAndType(false, false);
// Ray Query
InstructionDesc[OpTypeAccelerationStructureKHR].setResultAndType(true, false);
InstructionDesc[OpTypeRayQueryProvisionalKHR].setResultAndType(true, false);
InstructionDesc[OpRayQueryInitializeKHR].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryInitializeKHR].operands.push(OperandId, "'AccelerationS'");
InstructionDesc[OpRayQueryInitializeKHR].operands.push(OperandId, "'RayFlags'");
InstructionDesc[OpRayQueryInitializeKHR].operands.push(OperandId, "'CullMask'");
InstructionDesc[OpRayQueryInitializeKHR].operands.push(OperandId, "'Origin'");
InstructionDesc[OpRayQueryInitializeKHR].operands.push(OperandId, "'Tmin'");
InstructionDesc[OpRayQueryInitializeKHR].operands.push(OperandId, "'Direction'");
InstructionDesc[OpRayQueryInitializeKHR].operands.push(OperandId, "'Tmax'");
InstructionDesc[OpRayQueryInitializeKHR].setResultAndType(false, false);
InstructionDesc[OpRayQueryTerminateKHR].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryTerminateKHR].setResultAndType(false, false);
InstructionDesc[OpRayQueryGenerateIntersectionKHR].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryGenerateIntersectionKHR].operands.push(OperandId, "'THit'");
InstructionDesc[OpRayQueryGenerateIntersectionKHR].setResultAndType(false, false);
InstructionDesc[OpRayQueryConfirmIntersectionKHR].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryConfirmIntersectionKHR].setResultAndType(false, false);
InstructionDesc[OpRayQueryProceedKHR].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryProceedKHR].setResultAndType(true, true);
InstructionDesc[OpRayQueryGetIntersectionTypeKHR].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryGetIntersectionTypeKHR].operands.push(OperandId, "'Committed'");
InstructionDesc[OpRayQueryGetIntersectionTypeKHR].setResultAndType(true, true);
InstructionDesc[OpRayQueryGetRayTMinKHR].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryGetRayTMinKHR].setResultAndType(true, true);
InstructionDesc[OpRayQueryGetRayFlagsKHR].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryGetRayFlagsKHR].setResultAndType(true, true);
InstructionDesc[OpRayQueryGetIntersectionTKHR].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryGetIntersectionTKHR].operands.push(OperandId, "'Committed'");
InstructionDesc[OpRayQueryGetIntersectionTKHR].setResultAndType(true, true);
InstructionDesc[OpRayQueryGetIntersectionInstanceCustomIndexKHR].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryGetIntersectionInstanceCustomIndexKHR].operands.push(OperandId, "'Committed'");
InstructionDesc[OpRayQueryGetIntersectionInstanceCustomIndexKHR].setResultAndType(true, true);
InstructionDesc[OpRayQueryGetIntersectionInstanceIdKHR].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryGetIntersectionInstanceIdKHR].operands.push(OperandId, "'Committed'");
InstructionDesc[OpRayQueryGetIntersectionInstanceIdKHR].setResultAndType(true, true);
InstructionDesc[OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR].operands.push(OperandId, "'Committed'");
InstructionDesc[OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR].setResultAndType(true, true);
InstructionDesc[OpRayQueryGetIntersectionGeometryIndexKHR].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryGetIntersectionGeometryIndexKHR].operands.push(OperandId, "'Committed'");
InstructionDesc[OpRayQueryGetIntersectionGeometryIndexKHR].setResultAndType(true, true);
InstructionDesc[OpRayQueryGetIntersectionPrimitiveIndexKHR].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryGetIntersectionPrimitiveIndexKHR].operands.push(OperandId, "'Committed'");
InstructionDesc[OpRayQueryGetIntersectionPrimitiveIndexKHR].setResultAndType(true, true);
InstructionDesc[OpRayQueryGetIntersectionBarycentricsKHR].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryGetIntersectionBarycentricsKHR].operands.push(OperandId, "'Committed'");
InstructionDesc[OpRayQueryGetIntersectionBarycentricsKHR].setResultAndType(true, true);
InstructionDesc[OpRayQueryGetIntersectionFrontFaceKHR].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryGetIntersectionFrontFaceKHR].operands.push(OperandId, "'Committed'");
InstructionDesc[OpRayQueryGetIntersectionFrontFaceKHR].setResultAndType(true, true);
InstructionDesc[OpRayQueryGetIntersectionCandidateAABBOpaqueKHR].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryGetIntersectionCandidateAABBOpaqueKHR].setResultAndType(true, true);
InstructionDesc[OpRayQueryGetIntersectionObjectRayDirectionKHR].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryGetIntersectionObjectRayDirectionKHR].operands.push(OperandId, "'Committed'");
InstructionDesc[OpRayQueryGetIntersectionObjectRayDirectionKHR].setResultAndType(true, true);
InstructionDesc[OpRayQueryGetIntersectionObjectRayOriginKHR].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryGetIntersectionObjectRayOriginKHR].operands.push(OperandId, "'Committed'");
InstructionDesc[OpRayQueryGetIntersectionObjectRayOriginKHR].setResultAndType(true, true);
InstructionDesc[OpRayQueryGetWorldRayDirectionKHR].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryGetWorldRayDirectionKHR].setResultAndType(true, true);
InstructionDesc[OpRayQueryGetWorldRayOriginKHR].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryGetWorldRayOriginKHR].setResultAndType(true, true);
InstructionDesc[OpRayQueryGetIntersectionObjectToWorldKHR].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryGetIntersectionObjectToWorldKHR].operands.push(OperandId, "'Committed'");
InstructionDesc[OpRayQueryGetIntersectionObjectToWorldKHR].setResultAndType(true, true);
InstructionDesc[OpRayQueryGetIntersectionWorldToObjectKHR].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryGetIntersectionWorldToObjectKHR].operands.push(OperandId, "'Committed'");
InstructionDesc[OpRayQueryGetIntersectionWorldToObjectKHR].setResultAndType(true, true);
InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Sampled Image'");
InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Coordinate'");

View File

@ -784,8 +784,8 @@ inline std::istream& ParseNormalFloat(std::istream& is, bool negate_value,
if (val.isInfinity()) {
// Fail the parse. Emulate standard behaviour by setting the value to
// the closest normal value, and set the fail bit on the stream.
value.set_value((value.isNegative() | negate_value) ? T::lowest()
: T::max());
value.set_value((value.isNegative() || negate_value) ? T::lowest()
: T::max());
is.setstate(std::ios_base::failbit);
}
return is;

View File

@ -1,4 +1,4 @@
// Copyright (c) 2014-2019 The Khronos Group Inc.
// Copyright (c) 2014-2020 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"),
@ -49,12 +49,12 @@ namespace spv {
typedef unsigned int Id;
#define SPV_VERSION 0x10400
#define SPV_REVISION 1
#define SPV_VERSION 0x10500
#define SPV_REVISION 3
static const unsigned int MagicNumber = 0x07230203;
static const unsigned int Version = 0x00010400;
static const unsigned int Revision = 1;
static const unsigned int Version = 0x00010500;
static const unsigned int Revision = 3;
static const unsigned int OpCodeMask = 0xffff;
static const unsigned int WordCountShift = 16;
@ -78,11 +78,17 @@ enum ExecutionModel {
ExecutionModelKernel = 6,
ExecutionModelTaskNV = 5267,
ExecutionModelMeshNV = 5268,
ExecutionModelRayGenerationKHR = 5313,
ExecutionModelRayGenerationNV = 5313,
ExecutionModelIntersectionKHR = 5314,
ExecutionModelIntersectionNV = 5314,
ExecutionModelAnyHitKHR = 5315,
ExecutionModelAnyHitNV = 5315,
ExecutionModelClosestHitKHR = 5316,
ExecutionModelClosestHitNV = 5316,
ExecutionModelMissKHR = 5317,
ExecutionModelMissNV = 5317,
ExecutionModelCallableKHR = 5318,
ExecutionModelCallableNV = 5318,
ExecutionModelMax = 0x7fffffff,
};
@ -179,11 +185,17 @@ enum StorageClass {
StorageClassAtomicCounter = 10,
StorageClassImage = 11,
StorageClassStorageBuffer = 12,
StorageClassCallableDataKHR = 5328,
StorageClassCallableDataNV = 5328,
StorageClassIncomingCallableDataKHR = 5329,
StorageClassIncomingCallableDataNV = 5329,
StorageClassRayPayloadKHR = 5338,
StorageClassRayPayloadNV = 5338,
StorageClassHitAttributeKHR = 5339,
StorageClassHitAttributeNV = 5339,
StorageClassIncomingRayPayloadKHR = 5342,
StorageClassIncomingRayPayloadNV = 5342,
StorageClassShaderRecordBufferKHR = 5343,
StorageClassShaderRecordBufferNV = 5343,
StorageClassPhysicalStorageBuffer = 5349,
StorageClassPhysicalStorageBufferEXT = 5349,
@ -558,20 +570,35 @@ enum BuiltIn {
BuiltInFragmentSizeNV = 5292,
BuiltInFragInvocationCountEXT = 5293,
BuiltInInvocationsPerPixelNV = 5293,
BuiltInLaunchIdKHR = 5319,
BuiltInLaunchIdNV = 5319,
BuiltInLaunchSizeKHR = 5320,
BuiltInLaunchSizeNV = 5320,
BuiltInWorldRayOriginKHR = 5321,
BuiltInWorldRayOriginNV = 5321,
BuiltInWorldRayDirectionKHR = 5322,
BuiltInWorldRayDirectionNV = 5322,
BuiltInObjectRayOriginKHR = 5323,
BuiltInObjectRayOriginNV = 5323,
BuiltInObjectRayDirectionKHR = 5324,
BuiltInObjectRayDirectionNV = 5324,
BuiltInRayTminKHR = 5325,
BuiltInRayTminNV = 5325,
BuiltInRayTmaxKHR = 5326,
BuiltInRayTmaxNV = 5326,
BuiltInInstanceCustomIndexKHR = 5327,
BuiltInInstanceCustomIndexNV = 5327,
BuiltInObjectToWorldKHR = 5330,
BuiltInObjectToWorldNV = 5330,
BuiltInWorldToObjectKHR = 5331,
BuiltInWorldToObjectNV = 5331,
BuiltInHitTKHR = 5332,
BuiltInHitTNV = 5332,
BuiltInHitKindKHR = 5333,
BuiltInHitKindNV = 5333,
BuiltInIncomingRayFlagsKHR = 5351,
BuiltInIncomingRayFlagsNV = 5351,
BuiltInRayGeometryIndexKHR = 5352,
BuiltInWarpsPerSMNV = 5374,
BuiltInSMCountNV = 5375,
BuiltInWarpIDNV = 5376,
@ -709,6 +736,7 @@ enum Scope {
ScopeInvocation = 4,
ScopeQueueFamily = 5,
ScopeQueueFamilyKHR = 5,
ScopeShaderCallKHR = 6,
ScopeMax = 0x7fffffff,
};
@ -833,6 +861,8 @@ enum Capability {
CapabilitySignedZeroInfNanPreserve = 4466,
CapabilityRoundingModeRTE = 4467,
CapabilityRoundingModeRTZ = 4468,
CapabilityRayQueryProvisionalKHR = 4471,
CapabilityRayTraversalPrimitiveCullingProvisionalKHR = 4478,
CapabilityFloat16ImageAMD = 5008,
CapabilityImageGatherBiasLodAMD = 5009,
CapabilityFragmentMaskAMD = 5010,
@ -886,6 +916,7 @@ enum Capability {
CapabilityPhysicalStorageBufferAddresses = 5347,
CapabilityPhysicalStorageBufferAddressesEXT = 5347,
CapabilityComputeDerivativeGroupLinearNV = 5350,
CapabilityRayTracingProvisionalKHR = 5353,
CapabilityCooperativeMatrixNV = 5357,
CapabilityFragmentShaderSampleInterlockEXT = 5363,
CapabilityFragmentShaderShadingRateInterlockEXT = 5372,
@ -903,6 +934,53 @@ enum Capability {
CapabilityMax = 0x7fffffff,
};
enum RayFlagsShift {
RayFlagsOpaqueKHRShift = 0,
RayFlagsNoOpaqueKHRShift = 1,
RayFlagsTerminateOnFirstHitKHRShift = 2,
RayFlagsSkipClosestHitShaderKHRShift = 3,
RayFlagsCullBackFacingTrianglesKHRShift = 4,
RayFlagsCullFrontFacingTrianglesKHRShift = 5,
RayFlagsCullOpaqueKHRShift = 6,
RayFlagsCullNoOpaqueKHRShift = 7,
RayFlagsSkipTrianglesKHRShift = 8,
RayFlagsSkipAABBsKHRShift = 9,
RayFlagsMax = 0x7fffffff,
};
enum RayFlagsMask {
RayFlagsMaskNone = 0,
RayFlagsOpaqueKHRMask = 0x00000001,
RayFlagsNoOpaqueKHRMask = 0x00000002,
RayFlagsTerminateOnFirstHitKHRMask = 0x00000004,
RayFlagsSkipClosestHitShaderKHRMask = 0x00000008,
RayFlagsCullBackFacingTrianglesKHRMask = 0x00000010,
RayFlagsCullFrontFacingTrianglesKHRMask = 0x00000020,
RayFlagsCullOpaqueKHRMask = 0x00000040,
RayFlagsCullNoOpaqueKHRMask = 0x00000080,
RayFlagsSkipTrianglesKHRMask = 0x00000100,
RayFlagsSkipAABBsKHRMask = 0x00000200,
};
enum RayQueryIntersection {
RayQueryIntersectionRayQueryCandidateIntersectionKHR = 0,
RayQueryIntersectionRayQueryCommittedIntersectionKHR = 1,
RayQueryIntersectionMax = 0x7fffffff,
};
enum RayQueryCommittedIntersectionType {
RayQueryCommittedIntersectionTypeRayQueryCommittedIntersectionNoneKHR = 0,
RayQueryCommittedIntersectionTypeRayQueryCommittedIntersectionTriangleKHR = 1,
RayQueryCommittedIntersectionTypeRayQueryCommittedIntersectionGeneratedKHR = 2,
RayQueryCommittedIntersectionTypeMax = 0x7fffffff,
};
enum RayQueryCandidateIntersectionType {
RayQueryCandidateIntersectionTypeRayQueryCandidateIntersectionTriangleKHR = 0,
RayQueryCandidateIntersectionTypeRayQueryCandidateIntersectionAABBKHR = 1,
RayQueryCandidateIntersectionTypeMax = 0x7fffffff,
};
enum Op {
OpNop = 0,
OpUndef = 1,
@ -1254,6 +1332,13 @@ enum Op {
OpSubgroupAnyKHR = 4429,
OpSubgroupAllEqualKHR = 4430,
OpSubgroupReadInvocationKHR = 4432,
OpTypeRayQueryProvisionalKHR = 4472,
OpRayQueryInitializeKHR = 4473,
OpRayQueryTerminateKHR = 4474,
OpRayQueryGenerateIntersectionKHR = 4475,
OpRayQueryConfirmIntersectionKHR = 4476,
OpRayQueryProceedKHR = 4477,
OpRayQueryGetIntersectionTypeKHR = 4479,
OpGroupIAddNonUniformAMD = 5000,
OpGroupFAddNonUniformAMD = 5001,
OpGroupFMinNonUniformAMD = 5002,
@ -1268,11 +1353,17 @@ enum Op {
OpImageSampleFootprintNV = 5283,
OpGroupNonUniformPartitionNV = 5296,
OpWritePackedPrimitiveIndices4x8NV = 5299,
OpReportIntersectionKHR = 5334,
OpReportIntersectionNV = 5334,
OpIgnoreIntersectionKHR = 5335,
OpIgnoreIntersectionNV = 5335,
OpTerminateRayKHR = 5336,
OpTerminateRayNV = 5336,
OpTraceNV = 5337,
OpTraceRayKHR = 5337,
OpTypeAccelerationStructureKHR = 5341,
OpTypeAccelerationStructureNV = 5341,
OpExecuteCallableKHR = 5344,
OpExecuteCallableNV = 5344,
OpTypeCooperativeMatrixNV = 5358,
OpCooperativeMatrixLoadNV = 5359,
@ -1429,6 +1520,23 @@ enum Op {
OpSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL = 5814,
OpSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL = 5815,
OpSubgroupAvcSicGetInterRawSadsINTEL = 5816,
OpRayQueryGetRayTMinKHR = 6016,
OpRayQueryGetRayFlagsKHR = 6017,
OpRayQueryGetIntersectionTKHR = 6018,
OpRayQueryGetIntersectionInstanceCustomIndexKHR = 6019,
OpRayQueryGetIntersectionInstanceIdKHR = 6020,
OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR = 6021,
OpRayQueryGetIntersectionGeometryIndexKHR = 6022,
OpRayQueryGetIntersectionPrimitiveIndexKHR = 6023,
OpRayQueryGetIntersectionBarycentricsKHR = 6024,
OpRayQueryGetIntersectionFrontFaceKHR = 6025,
OpRayQueryGetIntersectionCandidateAABBOpaqueKHR = 6026,
OpRayQueryGetIntersectionObjectRayDirectionKHR = 6027,
OpRayQueryGetIntersectionObjectRayOriginKHR = 6028,
OpRayQueryGetWorldRayDirectionKHR = 6029,
OpRayQueryGetWorldRayOriginKHR = 6030,
OpRayQueryGetIntersectionObjectToWorldKHR = 6031,
OpRayQueryGetIntersectionWorldToObjectKHR = 6032,
OpMax = 0x7fffffff,
};
@ -1787,6 +1895,13 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
case OpSubgroupAnyKHR: *hasResult = true; *hasResultType = true; break;
case OpSubgroupAllEqualKHR: *hasResult = true; *hasResultType = true; break;
case OpSubgroupReadInvocationKHR: *hasResult = true; *hasResultType = true; break;
case OpTypeRayQueryProvisionalKHR: *hasResult = true; *hasResultType = false; break;
case OpRayQueryInitializeKHR: *hasResult = false; *hasResultType = false; break;
case OpRayQueryTerminateKHR: *hasResult = false; *hasResultType = false; break;
case OpRayQueryGenerateIntersectionKHR: *hasResult = false; *hasResultType = false; break;
case OpRayQueryConfirmIntersectionKHR: *hasResult = false; *hasResultType = false; break;
case OpRayQueryProceedKHR: *hasResult = true; *hasResultType = true; break;
case OpRayQueryGetIntersectionTypeKHR: *hasResult = true; *hasResultType = true; break;
case OpGroupIAddNonUniformAMD: *hasResult = true; *hasResultType = true; break;
case OpGroupFAddNonUniformAMD: *hasResult = true; *hasResultType = true; break;
case OpGroupFMinNonUniformAMD: *hasResult = true; *hasResultType = true; break;
@ -1960,6 +2075,23 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
case OpSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL: *hasResult = true; *hasResultType = true; break;
case OpSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL: *hasResult = true; *hasResultType = true; break;
case OpSubgroupAvcSicGetInterRawSadsINTEL: *hasResult = true; *hasResultType = true; break;
case OpRayQueryGetRayTMinKHR: *hasResult = true; *hasResultType = true; break;
case OpRayQueryGetRayFlagsKHR: *hasResult = true; *hasResultType = true; break;
case OpRayQueryGetIntersectionTKHR: *hasResult = true; *hasResultType = true; break;
case OpRayQueryGetIntersectionInstanceCustomIndexKHR: *hasResult = true; *hasResultType = true; break;
case OpRayQueryGetIntersectionInstanceIdKHR: *hasResult = true; *hasResultType = true; break;
case OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR: *hasResult = true; *hasResultType = true; break;
case OpRayQueryGetIntersectionGeometryIndexKHR: *hasResult = true; *hasResultType = true; break;
case OpRayQueryGetIntersectionPrimitiveIndexKHR: *hasResult = true; *hasResultType = true; break;
case OpRayQueryGetIntersectionBarycentricsKHR: *hasResult = true; *hasResultType = true; break;
case OpRayQueryGetIntersectionFrontFaceKHR: *hasResult = true; *hasResultType = true; break;
case OpRayQueryGetIntersectionCandidateAABBOpaqueKHR: *hasResult = true; *hasResultType = true; break;
case OpRayQueryGetIntersectionObjectRayDirectionKHR: *hasResult = true; *hasResultType = true; break;
case OpRayQueryGetIntersectionObjectRayOriginKHR: *hasResult = true; *hasResultType = true; break;
case OpRayQueryGetWorldRayDirectionKHR: *hasResult = true; *hasResultType = true; break;
case OpRayQueryGetWorldRayOriginKHR: *hasResult = true; *hasResultType = true; break;
case OpRayQueryGetIntersectionObjectToWorldKHR: *hasResult = true; *hasResultType = true; break;
case OpRayQueryGetIntersectionWorldToObjectKHR: *hasResult = true; *hasResultType = true; break;
}
}
#endif /* SPV_ENABLE_UTILITY_CODE */
@ -1974,6 +2106,7 @@ inline FunctionControlMask operator|(FunctionControlMask a, FunctionControlMask
inline MemorySemanticsMask operator|(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) | unsigned(b)); }
inline MemoryAccessMask operator|(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) | unsigned(b)); }
inline KernelProfilingInfoMask operator|(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) | unsigned(b)); }
inline RayFlagsMask operator|(RayFlagsMask a, RayFlagsMask b) { return RayFlagsMask(unsigned(a) | unsigned(b)); }
} // end namespace spv

View File

@ -235,8 +235,7 @@ public:
assert(instructions.size() > 0);
instructions.resize(1);
successors.clear();
Instruction* unreachable = new Instruction(OpUnreachable);
addInstruction(std::unique_ptr<Instruction>(unreachable));
addInstruction(std::unique_ptr<Instruction>(new Instruction(OpUnreachable)));
}
// Change this block into a canonical dead continue target branching to the
// given header ID. Delete instructions as necessary. A canonical dead continue

View File

@ -1,5 +1,6 @@
add_library(glslang-default-resource-limits
${CMAKE_CURRENT_SOURCE_DIR}/ResourceLimits.cpp)
${CMAKE_CURRENT_SOURCE_DIR}/ResourceLimits.cpp
${CMAKE_CURRENT_SOURCE_DIR}/resource_limits_c.cpp)
set_property(TARGET glslang-default-resource-limits PROPERTY FOLDER glslang)
set_property(TARGET glslang-default-resource-limits PROPERTY POSITION_INDEPENDENT_CODE ON)

View File

@ -1,6 +1,7 @@
//
// Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
// Copyright (C) 2013-2016 LunarG, Inc.
// Copyright (C) 2016-2020 Google, Inc.
//
// All rights reserved.
//
@ -204,7 +205,7 @@ public:
text.append("#define ");
fixLine(def);
Processes.push_back("D");
Processes.push_back("define-macro ");
Processes.back().append(def);
// The first "=" needs to turn into a space
@ -222,7 +223,7 @@ public:
text.append("#undef ");
fixLine(undef);
Processes.push_back("U");
Processes.push_back("undef-macro ");
Processes.back().append(undef);
text.append(undef);
@ -241,6 +242,7 @@ protected:
std::string text; // contents of preamble
};
// Track the user's #define and #undef from the command line.
TPreamble UserPreamble;
//
@ -257,12 +259,12 @@ const char* GetBinaryName(EShLanguage stage)
case EShLangGeometry: name = "geom.spv"; break;
case EShLangFragment: name = "frag.spv"; break;
case EShLangCompute: name = "comp.spv"; break;
case EShLangRayGenNV: name = "rgen.spv"; break;
case EShLangIntersectNV: name = "rint.spv"; break;
case EShLangAnyHitNV: name = "rahit.spv"; break;
case EShLangClosestHitNV: name = "rchit.spv"; break;
case EShLangMissNV: name = "rmiss.spv"; break;
case EShLangCallableNV: name = "rcall.spv"; break;
case EShLangRayGen: name = "rgen.spv"; break;
case EShLangIntersect: name = "rint.spv"; break;
case EShLangAnyHit: name = "rahit.spv"; break;
case EShLangClosestHit: name = "rchit.spv"; break;
case EShLangMiss: name = "rmiss.spv"; break;
case EShLangCallable: name = "rcall.spv"; break;
case EShLangMeshNV: name = "mesh.spv"; break;
case EShLangTaskNV: name = "task.spv"; break;
default: name = "unknown"; break;
@ -500,6 +502,13 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
} else
Error("expects vulkan100 or opengl100", lowerword.c_str());
bumpArg();
} else if (lowerword == "define-macro" ||
lowerword == "d") {
if (argc > 1)
UserPreamble.addDef(argv[1]);
else
Error("expects <name[=def]>", argv[0]);
bumpArg();
} else if (lowerword == "dump-builtin-symbols") {
DumpBuiltinSymbols = true;
} else if (lowerword == "entry-point") {
@ -601,6 +610,9 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
} else if (strcmp(argv[1], "vulkan1.1") == 0) {
setVulkanSpv();
ClientVersion = glslang::EShTargetVulkan_1_1;
} else if (strcmp(argv[1], "vulkan1.2") == 0) {
setVulkanSpv();
ClientVersion = glslang::EShTargetVulkan_1_2;
} else if (strcmp(argv[1], "opengl") == 0) {
setOpenGlSpv();
ClientVersion = glslang::EShTargetOpenGL_450;
@ -623,10 +635,17 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
TargetLanguage = glslang::EShTargetSpv;
TargetVersion = glslang::EShTargetSpv_1_5;
} else
Error("--target-env expected one of: vulkan1.0, vulkan1.1, opengl,\n"
Error("--target-env expected one of: vulkan1.0, vulkan1.1, vulkan1.2, opengl,\n"
"spirv1.0, spirv1.1, spirv1.2, spirv1.3, spirv1.4, or spirv1.5");
}
bumpArg();
} else if (lowerword == "undef-macro" ||
lowerword == "u") {
if (argc > 1)
UserPreamble.addUndef(argv[1]);
else
Error("expects <name>", argv[0]);
bumpArg();
} else if (lowerword == "variable-name" || // synonyms
lowerword == "vn") {
Options |= EOptionOutputHexadecimal;
@ -637,6 +656,9 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
break;
} else if (lowerword == "version") {
Options |= EOptionDumpVersions;
} else if (lowerword == "help") {
usage();
break;
} else {
Error("unrecognized command-line option", argv[0]);
}
@ -649,7 +671,7 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
if (argv[0][2] == 0)
Options |= EOptionReadHlsl;
else
UserPreamble.addDef(getStringOperand("-D<macro> macro name"));
UserPreamble.addDef(getStringOperand("-D<name[=def]>"));
break;
case 'u':
uniformLocationOverrides.push_back(getUniformOverride());
@ -692,7 +714,7 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
bumpArg();
break;
case 'U':
UserPreamble.addUndef(getStringOperand("-U<macro>: macro name"));
UserPreamble.addUndef(getStringOperand("-U<name>"));
break;
case 'V':
setVulkanSpv();
@ -811,6 +833,10 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
TargetLanguage = glslang::EShTargetSpv;
TargetVersion = glslang::EShTargetSpv_1_3;
break;
case glslang::EShTargetVulkan_1_2:
TargetLanguage = glslang::EShTargetSpv;
TargetVersion = glslang::EShTargetSpv_1_5;
break;
case glslang::EShTargetOpenGL_450:
TargetLanguage = glslang::EShTargetSpv;
TargetVersion = glslang::EShTargetSpv_1_0;
@ -1114,7 +1140,6 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
for (int stage = 0; stage < EShLangCount; ++stage) {
if (program.getIntermediate((EShLanguage)stage)) {
std::vector<unsigned int> spirv;
std::string warningsErrors;
spv::SpvBuildLogger logger;
glslang::SpvOptions spvOptions;
if (Options & EOptionDebug)
@ -1404,17 +1429,17 @@ EShLanguage FindLanguage(const std::string& name, bool parseStageName)
else if (stageName == "comp")
return EShLangCompute;
else if (stageName == "rgen")
return EShLangRayGenNV;
return EShLangRayGen;
else if (stageName == "rint")
return EShLangIntersectNV;
return EShLangIntersect;
else if (stageName == "rahit")
return EShLangAnyHitNV;
return EShLangAnyHit;
else if (stageName == "rchit")
return EShLangClosestHitNV;
return EShLangClosestHit;
else if (stageName == "rmiss")
return EShLangMissNV;
return EShLangMiss;
else if (stageName == "rcall")
return EShLangCallableNV;
return EShLangCallable;
else if (stageName == "mesh")
return EShLangMeshNV;
else if (stageName == "task")
@ -1502,8 +1527,8 @@ void usage()
"Options:\n"
" -C cascading errors; risk crash from accumulation of error recoveries\n"
" -D input is HLSL (this is the default when any suffix is .hlsl)\n"
" -D<macro=def>\n"
" -D<macro> define a pre-processor macro\n"
" -D<name[=def]> | --define-macro <name[=def]> | --D <name[=def]>\n"
" define a pre-processor macro\n"
" -E print pre-processed GLSL; cannot be used with -l;\n"
" errors will appear on stderr\n"
" -G[ver] create SPIR-V binary, under OpenGL semantics; turns on -l;\n"
@ -1519,7 +1544,8 @@ void usage()
" -Os optimizes SPIR-V to minimize size\n"
" -S <stage> uses specified stage rather than parsing the file extension\n"
" choices for <stage> are vert, tesc, tese, geom, frag, or comp\n"
" -U<macro> undefine a pre-processor macro\n"
" -U<name> | --undef-macro <name> | --U <name>\n"
" undefine a pre-processor macro\n"
" -V[ver] create SPIR-V binary, under Vulkan semantics; turns on -l;\n"
" default file name is <stage>.spv (-o overrides this)\n"
" 'ver', when present, is the version of the input semantics,\n"
@ -1625,16 +1651,17 @@ void usage()
" --sep synonym for --source-entrypoint\n"
" --stdin read from stdin instead of from a file;\n"
" requires providing the shader stage using -S\n"
" --target-env {vulkan1.0 | vulkan1.1 | opengl | \n"
" --target-env {vulkan1.0 | vulkan1.1 | vulkan1.2 | opengl | \n"
" spirv1.0 | spirv1.1 | spirv1.2 | spirv1.3 | spirv1.4 | spirv1.5}\n"
" set execution environment that emitted code\n"
" will execute in (versus source language\n"
" semantics selected by --client) defaults:\n"
" * 'vulkan1.0' under '--client vulkan<ver>'\n"
" * 'opengl' under '--client opengl<ver>'\n"
" * 'spirv1.0' under --target-env vulkan1.0\n"
" * 'spirv1.3' under --target-env vulkan1.1\n"
" multiple --targen-env can be specified.\n"
" Set the execution environment that the\n"
" generated code will be executed in.\n"
" Defaults to:\n"
" * vulkan1.0 under --client vulkan<ver>\n"
" * opengl under --client opengl<ver>\n"
" * spirv1.0 under --target-env vulkan1.0\n"
" * spirv1.3 under --target-env vulkan1.1\n"
" * spirv1.5 under --target-env vulkan1.2\n"
" Multiple --target-env can be specified.\n"
" --variable-name <name>\n"
" --vn <name> creates a C header file that contains a\n"
" uint32_t array named <name>\n"

View File

@ -0,0 +1,65 @@
/**
BSD 2-Clause License
Copyright (c) 2020, Travis Fort
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. 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.
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 HOLDER 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 "resource_limits_c.h"
#include "ResourceLimits.h"
#include <stdlib.h>
#include <string.h>
#include <string>
const glslang_resource_t* glslang_default_resource(void)
{
return reinterpret_cast<const glslang_resource_t*>(&glslang::DefaultTBuiltInResource);
}
#if defined(__clang__) || defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#elif defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable : 4996)
#endif
const char* glslang_default_resource_string()
{
std::string cpp_str = glslang::GetDefaultTBuiltInResourceString();
char* c_str = (char*)malloc(cpp_str.length() + 1);
strcpy(c_str, cpp_str.c_str());
return c_str;
}
#if defined(__clang__) || defined(__GNUC__)
#pragma GCC diagnostic pop
#elif defined(_MSC_VER)
#pragma warning(pop)
#endif
void glslang_decode_resource_limits(glslang_resource_t* resources, char* config)
{
glslang::DecodeResourceLimits(reinterpret_cast<TBuiltInResource*>(resources), config);
}

View File

@ -0,0 +1,54 @@
/**
BSD 2-Clause License
Copyright (c) 2020, Travis Fort
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. 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.
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 HOLDER 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_C_INCLUDED_
#define _STAND_ALONE_RESOURCE_LIMITS_C_INCLUDED_
#include "../glslang/Include/glslang_c_interface.h"
#ifdef __cplusplus
extern "C" {
#endif
// 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.
const glslang_resource_t* glslang_default_resource(void);
// Returns the DefaultTBuiltInResource as a human-readable string.
// NOTE: User is responsible for freeing this string.
const char* glslang_default_resource_string();
// Decodes the resource limits from |config| to |resources|.
void glslang_decode_resource_limits(glslang_resource_t* resources, char* config);
#ifdef __cplusplus
}
#endif
#endif // _STAND_ALONE_RESOURCE_LIMITS_C_INCLUDED_

View File

@ -334,8 +334,6 @@ int main(int argc, char** argv)
if (outputDir.empty())
usage(argv[0], "Output directory required");
std::string errmsg;
// Main operations: read, remap, and write.
execute(inputFile, outputDir, opts, verbosity);

View File

@ -1,230 +1,230 @@
// 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;
#define A__B // error
int a__b; // error
#pragma STDGL invariant(all)
#line 3000
#error line of this error should be 3000
uniform samplerExternalOES badExt; // syntax ERROR
// 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;
#define A__B // error
int a__b; // error
#pragma STDGL invariant(all)
#line 3000
#error line of this error should be 3000
uniform samplerExternalOES badExt; // syntax ERROR

View File

@ -1,76 +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];
}
#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

@ -1,41 +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
#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

View File

@ -1,76 +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
#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

View File

@ -1,87 +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;
};
}
}
#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;
};
}
}

View File

@ -245,4 +245,4 @@ void voidTernary()
b ? 3 : foo12111(); // ERROR
}
float halfFloat1 = 1.0h; // syntax ERROR
float halfFloat1 = 1.0h; // syntax ERROR

View File

@ -139,12 +139,12 @@ void foo2()
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));
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

View File

@ -1,78 +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);
#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);

View File

@ -1,62 +1,62 @@
#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));
}
#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()
{

View File

@ -1,51 +1,81 @@
#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;
gl_PerFragment; // ERROR, block name can't get reused
}
#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;
gl_PerFragment; // ERROR, block name can't get reused
}
in double type1; // ERROR
#extension GL_ARB_gpu_shader_fp64 : enable
double type2;
double type3 = 2.0;
int absTest = sqrt(type3);
double absTest2 = sqrt(type3);
double absTest3 = sqrt(2);
float dk = sqrt(11);
#extension GL_ARB_shader_bit_encoding: enable
float f;
vec4 v4;
ivec4 iv4a;
uvec2 uv2c;
void bitEncodingPass()
{
int i = floatBitsToInt(f);
uvec4 uv11 = floatBitsToUint(v4);
vec4 v14 = intBitsToFloat(iv4a);
vec2 v15 = uintBitsToFloat(uv2c);
}
#extension GL_ARB_shader_bit_encoding: disable
void bitEncodingFail()
{
int i = floatBitsToInt(f); // Error, extention GL_ARB_bit_encoding is diabled
}

View File

@ -1,139 +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;
#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;

View File

@ -1,34 +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;
}
#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;
}

View File

@ -1,35 +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;
}
#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;
}

View File

@ -1,29 +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
#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

View File

@ -184,7 +184,7 @@ void fooDeeparray()
yp = y;
xp = y; // ERROR, wrong size
yp = x; // ERROR, wrong size
}
}
layout(num_views = 2) in; // ERROR, no extension

View File

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

View File

@ -1,11 +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()
{
}
#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

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

View File

@ -1,41 +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
#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

View File

@ -1,38 +1,38 @@
#version 300 es
#extension GL_EXT_YUV_target : enable
uniform __samplerExternal2DY2YEXT sExt;
precision mediump __samplerExternal2DY2YEXT;
uniform __samplerExternal2DY2YEXT mediumExt;
uniform highp __samplerExternal2DY2YEXT 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_EXT_YUV_target : disable
uniform __samplerExternal2DY2YEXT badExt; // ERROR
#version 300 es
#extension GL_EXT_YUV_target : enable
uniform __samplerExternal2DY2YEXT sExt;
precision mediump __samplerExternal2DY2YEXT;
uniform __samplerExternal2DY2YEXT mediumExt;
uniform highp __samplerExternal2DY2YEXT 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_EXT_YUV_target : disable
uniform __samplerExternal2DY2YEXT badExt; // ERROR

View File

@ -1,237 +1,237 @@
#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); // ERROR, changing formats
passr(qualim2); // ERROR, drops restrict, ERROR, changing formats
passr(iimg2D); // ERROR, changing formats
}
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;
#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); // ERROR, changing formats
passr(qualim2); // ERROR, drops restrict, ERROR, changing formats
passr(iimg2D); // ERROR, changing formats
}
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

View File

@ -1,291 +1,291 @@
#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));
#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));
1 << mix(1u, 1u, false); // does not require folding
}
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;
}
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
@ -301,24 +301,24 @@ void badImageAtom()
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;
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);
@ -334,75 +334,75 @@ void goodImageAtom()
imageAtomicExchange(im2Di, P, dati);
imageAtomicExchange(im2Du, P, datu);
imageAtomicExchange(im2Df, P, datf);
imageAtomicCompSwap(im2Di, P, 3, dati);
imageAtomicCompSwap(im2Du, P, 5u, datu);
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
}
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;

View File

@ -1,152 +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;
}
#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;
}

View File

@ -1,43 +1,43 @@
#version 310 es
precision mediump float;
struct S {
float buff[10];
};
layout(std430, binding=2) readonly buffer RoBuff {
float buff_ro[10];
S s_ro;
} ro_buffer;
layout(std430, binding=2) buffer Buff {
float buff[10];
S s;
} non_ro_buffer;
void non_ro_fun(float[10] buff) { }
void non_ro_funf(float el) { }
void non_ro_funS(S s) { }
out vec4 fragColor;
void main()
{
S s;
non_ro_fun(s.buff);
non_ro_funf(s.buff[3]);
non_ro_funS(s);
non_ro_fun(non_ro_buffer.buff);
non_ro_fun(non_ro_buffer.s.buff);
non_ro_funf(non_ro_buffer.buff[3]);
non_ro_funf(non_ro_buffer.s.buff[3]);
non_ro_funS(non_ro_buffer.s);
non_ro_fun(ro_buffer.buff_ro);
non_ro_fun(ro_buffer.s_ro.buff);
non_ro_funf(ro_buffer.buff_ro[3]);
non_ro_funf(ro_buffer.s_ro.buff[3]);
non_ro_funS(ro_buffer.s_ro);
}
#version 310 es
precision mediump float;
struct S {
float buff[10];
};
layout(std430, binding=2) readonly buffer RoBuff {
float buff_ro[10];
S s_ro;
} ro_buffer;
layout(std430, binding=2) buffer Buff {
float buff[10];
S s;
} non_ro_buffer;
void non_ro_fun(float[10] buff) { }
void non_ro_funf(float el) { }
void non_ro_funS(S s) { }
out vec4 fragColor;
void main()
{
S s;
non_ro_fun(s.buff);
non_ro_funf(s.buff[3]);
non_ro_funS(s);
non_ro_fun(non_ro_buffer.buff);
non_ro_fun(non_ro_buffer.s.buff);
non_ro_funf(non_ro_buffer.buff[3]);
non_ro_funf(non_ro_buffer.s.buff[3]);
non_ro_funS(non_ro_buffer.s);
non_ro_fun(ro_buffer.buff_ro);
non_ro_fun(ro_buffer.s_ro.buff);
non_ro_funf(ro_buffer.buff_ro[3]);
non_ro_funf(ro_buffer.s_ro.buff[3]);
non_ro_funS(ro_buffer.s_ro);
}

View File

@ -1,184 +1,184 @@
#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 bbextBad()
{
gl_BoundingBoxEXT; // ERROR without GL_EXT_primitive_bounding_box
gl_BoundingBox; // ERROR, version < 320
}
#extension GL_EXT_primitive_bounding_box : enable
void bbext()
{
gl_BoundingBoxEXT[0] = vec4(0.0);
gl_BoundingBoxEXT[1] = vec4(1.0);
gl_BoundingBoxEXT[2] = vec4(2.0); // ERROR, overflow
}
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;
}
#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 bbextBad()
{
gl_BoundingBoxEXT; // ERROR without GL_EXT_primitive_bounding_box
gl_BoundingBox; // ERROR, version < 320
}
#extension GL_EXT_primitive_bounding_box : enable
void bbext()
{
gl_BoundingBoxEXT[0] = vec4(0.0);
gl_BoundingBoxEXT[1] = vec4(1.0);
gl_BoundingBoxEXT[2] = vec4(2.0); // ERROR, overflow
}
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;
}

View File

@ -1,128 +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
}
#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
}

View File

@ -1,372 +1,372 @@
#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;
#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);
@ -382,22 +382,22 @@ void goodImageAtom()
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
}
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
}

View File

@ -13,109 +13,109 @@ void main() {
f(false, 12.1, uint[NZ](uint(0),uint(1),uint(1),uint(2)), d);
}
buffer b {
float u[]; // ERROR
vec4 v[];
buffer b {
float u[]; // ERROR
vec4 v[];
} name[3];
uniform ub {
float u;
vec4 v[]; // ERROR
uniform ub {
float u;
vec4 v[]; // ERROR
} uname[3];
buffer b2 {
float u;
vec4 v[][]; // ERROR
buffer b2 {
float u;
vec4 v[][]; // ERROR
} name2[3];
buffer b3 {
float u;
vec4 v[][7];
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];
}
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

@ -1,8 +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];
}
#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

@ -1,8 +1,8 @@
#version 320 es
#version 320 es
float fX;
float fY;
void main()
{
dFdx(fX);

View File

@ -1,136 +1,136 @@
#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;
#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);
@ -146,57 +146,57 @@ void goodImageAtom()
imageAtomicExchange(im2Di, P, dati);
imageAtomicExchange(im2Du, P, datu);
imageAtomicExchange(im2Df, P, datf);
imageAtomicCompSwap(im2Di, P, 3, dati);
imageAtomicCompSwap(im2Du, P, 5u, datu);
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
}
}
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;

View File

@ -1,134 +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
}
#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
}

View File

@ -1,161 +1,161 @@
#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_BoundingBoxEXT[0] = vec4(0.0); // ERROR without GL_EXT_primitive_bounding_box
gl_BoundingBoxOES[0] = vec4(0.0); // ERROR without GL_OES_primitive_bounding_box
gl_BoundingBox[0] = vec4(1.0);
gl_BoundingBox[1] = vec4(1.0);
gl_BoundingBox[2] = vec4(2.0); // ERROR, overflow
}
#extension GL_EXT_primitive_bounding_box : enable
#extension GL_OES_primitive_bounding_box : enable
void bbext()
{
gl_BoundingBoxEXT[1] = vec4(0.0);
gl_BoundingBoxOES[1] = vec4(0.0);
}
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;
}
#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_BoundingBoxEXT[0] = vec4(0.0); // ERROR without GL_EXT_primitive_bounding_box
gl_BoundingBoxOES[0] = vec4(0.0); // ERROR without GL_OES_primitive_bounding_box
gl_BoundingBox[0] = vec4(1.0);
gl_BoundingBox[1] = vec4(1.0);
gl_BoundingBox[2] = vec4(2.0); // ERROR, overflow
}
#extension GL_EXT_primitive_bounding_box : enable
#extension GL_OES_primitive_bounding_box : enable
void bbext()
{
gl_BoundingBoxEXT[1] = vec4(0.0);
gl_BoundingBoxOES[1] = vec4(0.0);
}
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;
}

View File

@ -1,114 +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
}
#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
}

View File

@ -1,228 +1,228 @@
#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;
#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);
@ -238,18 +238,18 @@ void goodImageAtom()
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
}
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
}

View File

@ -126,29 +126,29 @@ 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;
}
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
layout(location=4) uniform vec4 ucolor0; // ERROR: extension is not enabled

View File

@ -99,103 +99,103 @@ void foodc2()
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
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

View File

@ -1,330 +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);
}
#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);
}

View File

@ -1,108 +1,108 @@
#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
#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()
{

View File

@ -1,108 +1,108 @@
#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;
#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()
{

View File

@ -5,90 +5,90 @@ 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 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);
@ -96,10 +96,10 @@ void itf(int, double, int);
void tf()
{
double d;
uint u;
int i;
float f;
double d;
uint u;
int i;
float f;
itf(i, i, i);
itf(i, u, i);

View File

@ -1,39 +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
}
#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
}

View File

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

View File

@ -6,4 +6,5 @@ in dmat4 dm4;
void main()
{
int test = gl_MaxFragmentUniformVectors;
}

View File

@ -1,30 +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();
#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();
}

View File

@ -12,3 +12,31 @@ layout(depth_less) in float depth; // ERROR: depth_less only applies to gl_FragD
layout(depth_any) out float gl_FragDepth; // ERROR, done after use
layout(binding=0) uniform atomic_uint a[];
uniform writeonly image2D i2D;
ivec2 iv2dim = imageSize(i2D); // ERROR: imageSize called without enabling GL_ARB_shader_image_size extension
#extension GL_ARB_shader_image_size : enable
ivec2 iv2dim1 = imageSize(i2D);
#extension GL_ARB_shader_storage_buffer_object : enable
layout(binding = 0,std430) buffer Buffer
{
int atomi;
uint atomu;
};
void atomicOpPass()
{
int origi = atomicAdd(atomi, 3);
uint origu = atomicAnd(atomu, 7u);
origi = atomicExchange(atomi, 4);
origu = atomicCompSwap(atomu, 10u, 8u);
}
#extension GL_ARB_shader_storage_buffer_object : disable
layout(binding = 1,std430) buffer BufferFail // Error std430 and "buffer" block support disabled
{
int atom1i;
};

View File

@ -1,55 +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
}
#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
}

View File

@ -1,43 +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
#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

View File

@ -1,90 +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)
;
}
#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)
;
}

View File

@ -147,15 +147,15 @@ 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[];
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

@ -1,21 +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[];
#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[];

View File

@ -1,90 +1,90 @@
#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_y = 1) in;
layout(local_size_y = 2) in; // ERROR, changing
layout(local_size_y = 1) in;
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;
#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_y = 1) in;
layout(local_size_y = 2) in; // ERROR, changing
layout(local_size_y = 1) in;
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;

View File

@ -1,223 +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
}
#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
}

View File

@ -1,108 +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
}
#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
}

View File

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

View File

@ -1,153 +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;
}
#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;
}

View File

@ -1,197 +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
}
#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
}

View File

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

View File

@ -1,68 +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
#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

View File

@ -1,19 +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
#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

View File

@ -1,23 +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];
#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];

View File

@ -1,21 +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
#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

View File

@ -1,56 +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;
};
#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;
};

View File

@ -1,32 +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
#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
#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
}

View File

@ -1,15 +1,16 @@
#version 460 core
int i;
; // extraneous semicolon okay
float f;;;
void main()
{
bool b1;
b1 = anyInvocation(b1);
b1 = allInvocations(b1);
b1 = allInvocationsEqual(b1);
}
;
;
#version 460 core
int i;
; // extraneous semicolon okay
float f;;;
void main()
{
bool b1;
float array[int(mod(float (7.1), float (4.0)))];
b1 = anyInvocation(b1);
b1 = allInvocations(b1);
b1 = allInvocationsEqual(b1);
}
;
;

View File

@ -1,166 +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;
}
#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;
}

View File

@ -1,51 +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;
}
#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

@ -1,36 +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;
}
#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

@ -1,19 +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;
}
#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;
}

View File

@ -20,30 +20,30 @@ void main()
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[2]; // 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
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[2]; // 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

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

View File

@ -5,10 +5,17 @@ ERROR: 0:6: 'layout qualifier' : can only apply origin_upper_left and pixel_cent
ERROR: 0:14: 'gl_FragCoord' : cannot redeclare after use
ERROR: 0:50: 'gl_PerFragment' : cannot be used (maybe an instance name is needed)
ERROR: 0:50: 'gl_PerFragment' : undeclared identifier
ERROR: 6 compilation errors. No code generated.
ERROR: 0:53: 'double' : Reserved word.
ERROR: 0:53: 'double' : not supported for this version or the enabled extensions
ERROR: 0:53: 'double' : must be qualified as flat in
ERROR: 0:57: '=' : cannot convert from ' global double' to ' global int'
ERROR: 0:80: 'floatBitsToInt' : required extension not requested: GL_ARB_shader_bit_encoding
ERROR: 11 compilation errors. No code generated.
Shader version: 150
Requested GL_ARB_gpu_shader_fp64
Requested GL_ARB_shader_bit_encoding
gl_FragCoord pixel center is integer
gl_FragCoord origin is upper left
ERROR: node is still EOpNull!
@ -109,6 +116,57 @@ ERROR: node is still EOpNull!
0:49 Branch: Return with expression
0:49 'gl_PrimitiveID' ( flat in int PrimitiveID)
0:50 'gl_PerFragment' ( temp float)
0:56 Sequence
0:56 move second child to first child ( temp double)
0:56 'type3' ( global double)
0:56 Constant:
0:56 2.000000
0:58 Sequence
0:58 move second child to first child ( temp double)
0:58 'absTest2' ( global double)
0:58 sqrt ( global double)
0:58 'type3' ( global double)
0:59 Sequence
0:59 move second child to first child ( temp double)
0:59 'absTest3' ( global double)
0:59 Constant:
0:59 1.414214
0:60 Sequence
0:60 move second child to first child ( temp float)
0:60 'dk' ( global float)
0:60 Constant:
0:60 3.316625
0:68 Function Definition: bitEncodingPass( ( global void)
0:68 Function Parameters:
0:70 Sequence
0:70 Sequence
0:70 move second child to first child ( temp int)
0:70 'i' ( temp int)
0:70 floatBitsToInt ( global int)
0:70 'f' ( global float)
0:71 Sequence
0:71 move second child to first child ( temp 4-component vector of uint)
0:71 'uv11' ( temp 4-component vector of uint)
0:71 floatBitsToUint ( global 4-component vector of uint)
0:71 'v4' ( global 4-component vector of float)
0:72 Sequence
0:72 move second child to first child ( temp 4-component vector of float)
0:72 'v14' ( temp 4-component vector of float)
0:72 intBitsToFloat ( global 4-component vector of float)
0:72 'iv4a' ( global 4-component vector of int)
0:73 Sequence
0:73 move second child to first child ( temp 2-component vector of float)
0:73 'v15' ( temp 2-component vector of float)
0:73 uintBitsToFloat ( global 2-component vector of float)
0:73 'uv2c' ( global 2-component vector of uint)
0:78 Function Definition: bitEncodingFail( ( global void)
0:78 Function Parameters:
0:80 Sequence
0:80 Sequence
0:80 move second child to first child ( temp int)
0:80 'i' ( temp int)
0:80 floatBitsToInt ( global int)
0:80 'f' ( global float)
0:? Linker Objects
0:? 'gl_FragCoord' ( gl_FragCoord 4-component vector of float FragCoord)
0:? 'foo' ( smooth in 4-component vector of float)
@ -123,12 +181,25 @@ ERROR: node is still EOpNull!
0:? 'p2' ( flat in 2-component vector of int)
0:? 'p3' ( flat in 3-component vector of int)
0:? 'samp' ( flat in int)
0:? 'type1' ( smooth in double)
0:? 'type2' ( global double)
0:? 'type3' ( global double)
0:? 'absTest' ( global int)
0:? 'absTest2' ( global double)
0:? 'absTest3' ( global double)
0:? 'dk' ( global float)
0:? 'f' ( global float)
0:? 'v4' ( global 4-component vector of float)
0:? 'iv4a' ( global 4-component vector of int)
0:? 'uv2c' ( global 2-component vector of uint)
Linked fragment stage:
Shader version: 150
Requested GL_ARB_gpu_shader_fp64
Requested GL_ARB_shader_bit_encoding
gl_FragCoord pixel center is integer
gl_FragCoord origin is upper left
ERROR: node is still EOpNull!
@ -144,6 +215,26 @@ ERROR: node is still EOpNull!
0:18 'patch' ( global float)
0:18 Constant:
0:18 3.100000
0:56 Sequence
0:56 move second child to first child ( temp double)
0:56 'type3' ( global double)
0:56 Constant:
0:56 2.000000
0:58 Sequence
0:58 move second child to first child ( temp double)
0:58 'absTest2' ( global double)
0:58 sqrt ( global double)
0:58 'type3' ( global double)
0:59 Sequence
0:59 move second child to first child ( temp double)
0:59 'absTest3' ( global double)
0:59 Constant:
0:59 1.414214
0:60 Sequence
0:60 move second child to first child ( temp float)
0:60 'dk' ( global float)
0:60 Constant:
0:60 3.316625
0:? Linker Objects
0:? 'gl_FragCoord' ( gl_FragCoord 4-component vector of float FragCoord)
0:? 'foo' ( smooth in 4-component vector of float)
@ -158,4 +249,15 @@ ERROR: node is still EOpNull!
0:? 'p2' ( flat in 2-component vector of int)
0:? 'p3' ( flat in 3-component vector of int)
0:? 'samp' ( flat in int)
0:? 'type1' ( smooth in double)
0:? 'type2' ( global double)
0:? 'type3' ( global double)
0:? 'absTest' ( global int)
0:? 'absTest2' ( global double)
0:? 'absTest3' ( global double)
0:? 'dk' ( global float)
0:? 'f' ( global float)
0:? 'v4' ( global 4-component vector of float)
0:? 'iv4a' ( global 4-component vector of int)
0:? 'uv2c' ( global 2-component vector of uint)

View File

@ -3,6 +3,12 @@ Shader version: 410
0:? Sequence
0:7 Function Definition: main( ( global void)
0:7 Function Parameters:
0:9 Sequence
0:9 Sequence
0:9 move second child to first child ( temp int)
0:9 'test' ( temp int)
0:9 Constant:
0:9 16 (const int)
0:? Linker Objects
0:? 'd' ( in double)
0:? 'd3' ( in 3-component vector of double)
@ -18,6 +24,12 @@ Shader version: 410
0:? Sequence
0:7 Function Definition: main( ( global void)
0:7 Function Parameters:
0:9 Sequence
0:9 Sequence
0:9 move second child to first child ( temp int)
0:9 'test' ( temp int)
0:9 Constant:
0:9 16 (const int)
0:? Linker Objects
0:? 'd' ( in double)
0:? 'd3' ( in 3-component vector of double)

View File

@ -3,10 +3,15 @@ ERROR: 0:4: 'redeclaration' : all redeclarations must use the same depth layout
ERROR: 0:11: 'layout qualifier' : can only apply depth layout to gl_FragDepth
ERROR: 0:12: 'gl_FragDepth' : cannot redeclare after use
ERROR: 0:14: 'atomic_uint' : array must be explicitly sized
ERROR: 4 compilation errors. No code generated.
ERROR: 0:17: 'imageSize' : required extension not requested: GL_ARB_shader_image_size
ERROR: 0:39: 'std430' : not supported for this version or the enabled extensions
ERROR: 0:39: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON
ERROR: 7 compilation errors. No code generated.
Shader version: 420
Requested GL_ARB_shader_image_size
Requested GL_ARB_shader_storage_buffer_object
using depth_any
ERROR: node is still EOpNull!
0:6 Function Definition: main( ( global void)
@ -16,16 +21,75 @@ ERROR: node is still EOpNull!
0:8 'gl_FragDepth' ( gl_FragDepth float FragDepth)
0:8 Constant:
0:8 0.300000
0:17 Sequence
0:17 move second child to first child ( temp 2-component vector of int)
0:17 'iv2dim' ( global 2-component vector of int)
0:17 imageQuerySize ( global 2-component vector of int)
0:17 'i2D' ( writeonly uniform image2D)
0:19 Sequence
0:19 move second child to first child ( temp 2-component vector of int)
0:19 'iv2dim1' ( global 2-component vector of int)
0:19 imageQuerySize ( global 2-component vector of int)
0:19 'i2D' ( writeonly uniform image2D)
0:29 Function Definition: atomicOpPass( ( global void)
0:29 Function Parameters:
0:31 Sequence
0:31 Sequence
0:31 move second child to first child ( temp int)
0:31 'origi' ( temp int)
0:31 AtomicAdd ( global int)
0:31 atomi: direct index for structure (layout( column_major std430 offset=0) buffer int)
0:31 'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430 offset=0) buffer int atomi, layout( column_major std430 offset=4) buffer uint atomu})
0:31 Constant:
0:31 0 (const uint)
0:31 Constant:
0:31 3 (const int)
0:32 Sequence
0:32 move second child to first child ( temp uint)
0:32 'origu' ( temp uint)
0:32 AtomicAnd ( global uint)
0:32 atomu: direct index for structure (layout( column_major std430 offset=4) buffer uint)
0:32 'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430 offset=0) buffer int atomi, layout( column_major std430 offset=4) buffer uint atomu})
0:32 Constant:
0:32 1 (const uint)
0:32 Constant:
0:32 7 (const uint)
0:33 move second child to first child ( temp int)
0:33 'origi' ( temp int)
0:33 AtomicExchange ( global int)
0:33 atomi: direct index for structure (layout( column_major std430 offset=0) buffer int)
0:33 'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430 offset=0) buffer int atomi, layout( column_major std430 offset=4) buffer uint atomu})
0:33 Constant:
0:33 0 (const uint)
0:33 Constant:
0:33 4 (const int)
0:34 move second child to first child ( temp uint)
0:34 'origu' ( temp uint)
0:34 AtomicCompSwap ( global uint)
0:34 atomu: direct index for structure (layout( column_major std430 offset=4) buffer uint)
0:34 'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430 offset=0) buffer int atomi, layout( column_major std430 offset=4) buffer uint atomu})
0:34 Constant:
0:34 1 (const uint)
0:34 Constant:
0:34 10 (const uint)
0:34 Constant:
0:34 8 (const uint)
0:? Linker Objects
0:? 'gl_FragDepth' ( gl_FragDepth float FragDepth)
0:? 'depth' ( smooth in float)
0:? 'a' (layout( binding=0 offset=0) uniform unsized 1-element array of atomic_uint)
0:? 'i2D' ( writeonly uniform image2D)
0:? 'iv2dim' ( global 2-component vector of int)
0:? 'iv2dim1' ( global 2-component vector of int)
0:? 'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430 offset=0) buffer int atomi, layout( column_major std430 offset=4) buffer uint atomu})
Linked fragment stage:
Shader version: 420
Requested GL_ARB_shader_image_size
Requested GL_ARB_shader_storage_buffer_object
using depth_any
ERROR: node is still EOpNull!
0:6 Function Definition: main( ( global void)
@ -35,8 +99,22 @@ ERROR: node is still EOpNull!
0:8 'gl_FragDepth' ( gl_FragDepth float FragDepth)
0:8 Constant:
0:8 0.300000
0:17 Sequence
0:17 move second child to first child ( temp 2-component vector of int)
0:17 'iv2dim' ( global 2-component vector of int)
0:17 imageQuerySize ( global 2-component vector of int)
0:17 'i2D' ( writeonly uniform image2D)
0:19 Sequence
0:19 move second child to first child ( temp 2-component vector of int)
0:19 'iv2dim1' ( global 2-component vector of int)
0:19 imageQuerySize ( global 2-component vector of int)
0:19 'i2D' ( writeonly uniform image2D)
0:? Linker Objects
0:? 'gl_FragDepth' ( gl_FragDepth float FragDepth)
0:? 'depth' ( smooth in float)
0:? 'a' (layout( binding=0 offset=0) uniform 1-element array of atomic_uint)
0:? 'i2D' ( writeonly uniform image2D)
0:? 'iv2dim' ( global 2-component vector of int)
0:? 'iv2dim1' ( global 2-component vector of int)
0:? 'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430 offset=0) buffer int atomi, layout( column_major std430 offset=4) buffer uint atomu})

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