The Opengl ES Shading Language

The Opengl ES Shading Language

The OpenGL ES® Shading Language Language Version: 3.00 Document Revision: 4 6 March 2013 Editor: Robert J. Simpson, Qualcomm OpenGL GLSL editor: John Kessenich, LunarG GLSL version 1.1 Authors: John Kessenich, Dave Baldwin, Randi Rost Copyright (c) 2008-2013 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 re-formatted 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 web-site 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 non-infringement 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, OpenKODE, OpenKOGS, OpenVG, OpenMAX, OpenSL ES and OpenWF are trademarks of the Khronos Group Inc. COLLADA is a trademark of Sony Computer Entertainment Inc. used by permission by Khronos. OpenGL and OpenML are registered trademarks and the OpenGL ES logo is a trademark of Silicon Graphics Inc. used by permission by Khronos. All other product names, trademarks, and/or company names are used solely for identification and belong to their respective owners. 2 Table of Contents 1 Introduction.................................................................................................................................1 1.1 Changes................................................................................................................................1 1.1.1 Changes from GLSL ES 3.0 revision 3........................................................................1 1.1.2 Changes from GLSL ES 3.0 revision 2........................................................................1 1.1.3 Changes from GLSL ES 3.0 revision 1:.......................................................................2 1.1.4 Changes from OpenGL GLSL 3.3:...............................................................................2 1.2 Overview..............................................................................................................................4 1.3 Error Handling......................................................................................................................4 1.4 Typographical Conventions.................................................................................................5 1.5 Compatibility........................................................................................................................5 2 Overview of OpenGL ES Shading..............................................................................................7 2.1 Vertex Processor..................................................................................................................7 2.2 Fragment Processor..............................................................................................................7 2.3 Executable............................................................................................................................7 3 Basics..........................................................................................................................................8 3.1 Character Set........................................................................................................................8 3.2 Source Strings......................................................................................................................8 3.3 Version Declaration..............................................................................................................9 3.4 Preprocessor.......................................................................................................................10 3.5 Comments..........................................................................................................................14 3.6 Tokens................................................................................................................................15 3.7 Keywords............................................................................................................................15 3.8 Identifiers...........................................................................................................................17 3.9 Definitions..........................................................................................................................17 3.9.1 Static Use....................................................................................................................17 3.9.2 Uniform and Non-Uniform Control Flow..................................................................18 3.9.3 Dynamically Uniform Expressions.............................................................................18 3.10 Logical Phases of Compilation........................................................................................18 4 Variables and Types..................................................................................................................20 4.1 Basic Types........................................................................................................................20 4.1.1 Void............................................................................................................................22 4.1.2 Booleans.....................................................................................................................22 4.1.3 Integers.......................................................................................................................22 4.1.4 Floats..........................................................................................................................24 4.1.5 Vectors........................................................................................................................25 4.1.6 Matrices......................................................................................................................26 4.1.7 Samplers.....................................................................................................................26 4.1.8 Structures....................................................................................................................26 4.1.9 Arrays.........................................................................................................................28 4.2 Scoping...............................................................................................................................29 3 4.2.1 Definition of Terms....................................................................................................29 4.2.2 Types of Scope...........................................................................................................29 4.2.3 Redeclaring Names.....................................................................................................31 4.2.4 Global Scope..............................................................................................................33 4.2.5 Shared Globals............................................................................................................33 4.3 Storage Qualifiers...............................................................................................................33 4.3.1 Default Storage Qualifier............................................................................................34 4.3.2 Constant Qualifier......................................................................................................34 4.3.3 Constant Expressions.................................................................................................35

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    156 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us