The OpenGL® Shading Language Language Version: 4.50 Document Revision: 7 09-May-2017 Editor: John Kessenich, Google Version 1.1 Authors: John Kessenich, Dave Baldwin, Randi Rost Copyright (c) 2008-2017 The Khronos Group Inc. All Rights Reserved. This specification is protected by copyright laws and contains material proprietary to the Khronos Group, Inc. It or any components may not be reproduced, republished, distributed, transmitted, displayed, broadcast, or otherwise exploited in any manner without the express prior written permission of Khronos Group. You may use this specification for implementing the functionality therein, without altering or removing any trademark, copyright or other notice from the specification, but the receipt or possession of this specification does not convey any rights to reproduce, disclose, or distribute its contents, or to manufacture, use, or sell anything that it may describe, in whole or in part. Khronos Group grants express permission to any current Promoter, Contributor or Adopter member of Khronos to copy and redistribute UNMODIFIED versions of this specification in any fashion, provided that NO CHARGE is made for the specification and the latest available update of the specification for any version of the API is used whenever possible. Such distributed specification may be reformatted AS LONG AS the contents of the specification are not changed in any way. The specification may be incorporated into a product that is sold as long as such product includes significant independent work developed by the seller. A link to the current version of this specification on the Khronos Group website should be included whenever possible with specification distributions. Khronos Group makes no, and expressly disclaims any, representations or warranties, express or implied, regarding this specification, including, without limitation, any implied warranties of merchantability or fitness for a particular purpose or noninfringement of any intellectual property. Khronos Group makes no, and expressly disclaims any, warranties, express or implied, regarding the correctness, accuracy, completeness, timeliness, and reliability of the specification. Under no circumstances will the Khronos Group, or any of its Promoters, Contributors or Members or their respective partners, officers, directors, employees, agents, or representatives be liable for any damages, whether direct, indirect, special or consequential damages for lost revenues, lost profits, or otherwise, arising from or in connection with these materials. Khronos, SYCL, SPIR, WebGL, EGL, COLLADA, StreamInput, OpenVX, OpenKCam, glTF, OpenKODE, OpenVG, OpenWF, OpenSL ES, OpenMAX, OpenMAX AL, OpenMAX IL and OpenMAX DL are trademarks and WebCL is a certification mark of the Khronos Group Inc. OpenCL is a trademark of Apple Inc. and OpenGL and OpenML are registered trademarks and the OpenGL ES and OpenGL SC logos are trademarks of Silicon Graphics International used under license by Khronos. All other product names, trademarks, and/or company names are used solely for identification and belong to their respective owners. ii Table of Contents 1 Introduction.................................................................................................................................1 1.1 Acknowledgments................................................................................................................2 1.2 Changes................................................................................................................................3 1.2.1 Changes from Revision 6 of GLSL Version 4.50.........................................................3 1.2.2 Changes from Revision 5 of GLSL Version 4.50.........................................................4 1.2.3 Changes from Revision 3 of GLSL Version 4.50.........................................................4 1.2.4 Summary of Changes from Revision 9 of GLSL Version 4.40....................................5 1.3 Overview..............................................................................................................................6 1.4 Error Handling......................................................................................................................6 1.5 Typographical Conventions..................................................................................................7 1.6 Deprecation..........................................................................................................................7 2 Overview of OpenGL Shading....................................................................................................8 2.1 Vertex Processor...................................................................................................................8 2.2 Tessellation Control Processor.............................................................................................8 2.3 Tessellation Evaluation Processor........................................................................................9 2.4 Geometry Processor.............................................................................................................9 2.5 Fragment Processor..............................................................................................................9 2.6 Compute Processor...............................................................................................................9 3 Basics........................................................................................................................................11 3.1 Character Set and Phases of Compilation..........................................................................11 3.2 Source Strings....................................................................................................................12 3.3 Preprocessor.......................................................................................................................12 3.4 Comments..........................................................................................................................18 3.5 Tokens................................................................................................................................19 3.6 Keywords............................................................................................................................19 3.7 Identifiers...........................................................................................................................21 3.8 Definitions..........................................................................................................................21 3.8.1 Static Use....................................................................................................................22 3.8.2 Dynamically Uniform Expressions and Uniform Control Flow.................................22 4 Variables and Types...................................................................................................................24 4.1 Basic Types.........................................................................................................................24 4.1.1 Void.............................................................................................................................28 4.1.2 Booleans.....................................................................................................................28 4.1.3 Integers.......................................................................................................................28 4.1.4 Floating-Point Variables.............................................................................................30 4.1.5 Vectors........................................................................................................................31 4.1.6 Matrices......................................................................................................................31 4.1.7 Opaque Types.............................................................................................................32 iii 4.1.7.1 Samplers.............................................................................................................32 4.1.7.2 Images.................................................................................................................32 4.1.7.3 Atomic Counters.................................................................................................33 4.1.8 Structures....................................................................................................................33 4.1.9 Arrays..........................................................................................................................34 4.1.10 Implicit Conversions................................................................................................38 4.1.11 Initializers.................................................................................................................39 4.2 Scoping...............................................................................................................................41 4.3 Storage Qualifiers...............................................................................................................44 4.3.1 Default Storage Qualifier............................................................................................45 4.3.2 Constant Qualifier......................................................................................................45
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages213 Page
-
File Size-