GLSL 4.50 Spec

Total Page:16

File Type:pdf, Size:1020Kb

GLSL 4.50 Spec 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
Recommended publications
  • Introduction to the Vulkan Computer Graphics API
    1 Introduction to the Vulkan Computer Graphics API Mike Bailey mjb – July 24, 2020 2 Computer Graphics Introduction to the Vulkan Computer Graphics API Mike Bailey [email protected] SIGGRAPH 2020 Abridged Version This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License http://cs.oregonstate.edu/~mjb/vulkan ABRIDGED.pptx mjb – July 24, 2020 3 Course Goals • Give a sense of how Vulkan is different from OpenGL • Show how to do basic drawing in Vulkan • Leave you with working, documented, understandable sample code http://cs.oregonstate.edu/~mjb/vulkan mjb – July 24, 2020 4 Mike Bailey • Professor of Computer Science, Oregon State University • Has been in computer graphics for over 30 years • Has had over 8,000 students in his university classes • [email protected] Welcome! I’m happy to be here. I hope you are too ! http://cs.oregonstate.edu/~mjb/vulkan mjb – July 24, 2020 5 Sections 13.Swap Chain 1. Introduction 14.Push Constants 2. Sample Code 15.Physical Devices 3. Drawing 16.Logical Devices 4. Shaders and SPIR-V 17.Dynamic State Variables 5. Data Buffers 18.Getting Information Back 6. GLFW 19.Compute Shaders 7. GLM 20.Specialization Constants 8. Instancing 21.Synchronization 9. Graphics Pipeline Data Structure 22.Pipeline Barriers 10.Descriptor Sets 23.Multisampling 11.Textures 24.Multipass 12.Queues and Command Buffers 25.Ray Tracing Section titles that have been greyed-out have not been included in the ABRIDGED noteset, i.e., the one that has been made to fit in SIGGRAPH’s reduced time slot.
    [Show full text]
  • Computer Graphics on Mobile Devices
    Computer Graphics on Mobile Devices Bruno Tunjic∗ Vienna University of Technology Figure 1: Different mobile devices available on the market today. Image courtesy of ASU [ASU 2011]. Abstract 1 Introduction Computer graphics hardware acceleration and rendering techniques Under the term mobile device we understand any device designed have improved significantly in recent years. These improvements for use in mobile context [Marcial 2010]. In other words this term are particularly noticeable in mobile devices that are produced in is used for devices that are battery-powered and therefore physi- great amounts and developed by different manufacturers. New tech- cally movable. This group of devices includes mobile (cellular) nologies are constantly developed and this extends the capabilities phones, personal media players (PMP), personal navigation devices of such devices correspondingly. (PND), personal digital assistants (PDA), smartphones, tablet per- sonal computers, notebooks, digital cameras, hand-held game con- soles and mobile internet devices (MID). Figure 1 shows different In this paper, a review about the existing and new hardware and mobile devices available on the market today. Traditional mobile software, as well as a closer look into some of the most important phones are aimed at making and receiving telephone calls over a revolutionary technologies, is given. Special emphasis is given on radio link. PDAs are personal organizers that later evolved into de- new Application Programming Interfaces (API) and rendering tech- vices with advanced units communication, entertainment and wire- niques that were developed in recent years. A review of limitations less capabilities [Wiggins 2004]. Smartphones can be seen as a that developers have to overcome when bringing graphics to mobile next generation of PDAs since they incorporate all its features but devices is also provided.
    [Show full text]
  • Report of Contributions
    X.Org Developers Conference 2020 Report of Contributions https://xdc2020.x.org/e/XDC2020 X.Org Developer … / Report of Contributions State of text input on Wayland Contribution ID: 1 Type: not specified State of text input on Wayland Wednesday, 16 September 2020 20:15 (5 minutes) Between the last impromptu talk at GUADEC 2018, text input on Wayland has become more organized and more widely adopted. As before, the three-pronged approach of text_input, in- put_method, and virtual keyboard still causes confusion, but increased interest in implementing it helps find problems and come closer to something that really works for many usecases. The talk will mention how a broken assumption causes a broken protocol, and why we’re notdone with Wayland input methods yet. It’s recommended to people who want to know more about the current state of input methods on Wayland. Recommended background: aforementioned GUADEC talk, wayland-protocols reposi- tory, my blog: https://dcz_self.gitlab.io/ Code of Conduct Yes GSoC, EVoC or Outreachy No Primary author: DCZ, Dorota Session Classification: Demos / Lightning talks I Track Classification: Lightning Talk September 30, 2021 Page 1 X.Org Developer … / Report of Contributions IGT GPU Tools 2020 Update Contribution ID: 2 Type: not specified IGT GPU Tools 2020 Update Wednesday, 16 September 2020 20:00 (5 minutes) Short update on IGT - what has changed in the last year, where are we right now and what we have planned for the near future. IGT GPU Tools is a collection of tools and tests aiding development of DRM drivers. It’s widely used by Intel in its public CI system.
    [Show full text]
  • Opencl on the GPU San Jose, CA | September 30, 2009
    OpenCL on the GPU San Jose, CA | September 30, 2009 Neil Trevett and Cyril Zeller, NVIDIA Welcome to the OpenCL Tutorial! • Khronos and industry perspective on OpenCL – Neil Trevett Khronos Group President OpenCL Working Group Chair NVIDIA Vice President Mobile Content • NVIDIA and OpenCL – Cyril Zeller NVIDIA Manager of Compute Developer Technology Khronos and the OpenCL Standard Neil Trevett OpenCL Working Group Chair, Khronos President NVIDIA Vice President Mobile Content Copyright Khronos 2009 Who is the Khronos Group? • Consortium creating open API standards ‘by the industry, for the industry’ – Non-profit founded nine years ago – over 100 members - any company welcome • Enabling software to leverage silicon acceleration – Low-level graphics, media and compute acceleration APIs • Strong commercial focus – Enabling members and the wider industry to grow markets • Commitment to royalty-free standards – Industry makes money through enabled products – not from standards themselves Silicon Community Software Community Copyright Khronos 2009 Apple Over 100 companies creating authoring and acceleration standards Board of Promoters Processor Parallelism CPUs GPUs Multiple cores driving Emerging Increasingly general purpose performance increases Intersection data-parallel computing Improving numerical precision Multi-processor Graphics APIs programming – Heterogeneous and Shading e.g. OpenMP Computing Languages Copyright Khronos 2009 OpenCL Commercial Objectives • Grow the market for parallel computing • Create a foundation layer for a parallel
    [Show full text]
  • GLSL Specification
    The OpenGL® Shading Language Language Version: 4.60 Document Revision: 3 23-Jul-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.
    [Show full text]
  • Marc Benito Bermúdez, Matina Maria Trompouki, Leonidas Kosmidis
    Evaluation of Graphics-based General Purpose Computation Solutions for Safety Critical Systems: An Avionics Case Study Marc Benito Bermúdez, Matina Maria Trompouki, Leonidas Kosmidis Juan David Garcia, Sergio Carretero, Ken Wenger {marc.benito, leonidas.Kosmidis}@bsc.es Motivation • Massively parallel architectures, high computational power and high energy efficiency, in thermally limited systems • OpenCL and CUDA dominate the market of GPGPU Embedded GPUs can programming in HPC provide the required • Easily programmable APIs performance • Cannot be used in safety critical systems because of pointers and dynamic memory allocation • Safety Critical Systems require higher performance to support new advanced functionalities • In this Bachelor’s thesis [1] awarded with a Technology Transfer Award we: Characteristics of Safety Critical Systems: • Analyze their differences compared to desktop graphics APIs • Certification: Need to comply with safety standards: ISO26262 / DO178 • Demonstrate how a safety-critical application written in a non-certifiable • Very conservative in terms of hardware and software: simple programming model can be converted to use safety-critical APIs. processors, mainly single core • Evaluate performance and programmability trade-offs OpenGL and Vulkan versions diagram Visual output of the Avionics Application Initial prototype GPU-based avionics application, written in Vulkan and ported to OpenGL SC 2 following the guidelines of [2][3]. Basic Compute Shader Shader 3D Image Processed Image Brook SC Porting and Comparison
    [Show full text]
  • Blackberry QNX Multimedia Suite
    PRODUCT BRIEF QNX Multimedia Suite The QNX Multimedia Suite is a comprehensive collection of media technology that has evolved over the years to keep pace with the latest media requirements of current-day embedded systems. Proven in tens of millions of automotive infotainment head units, the suite enables media-rich, high-quality playback, encoding and streaming of audio and video content. The multimedia suite comprises a modular, highly-scalable architecture that enables building high value, customized solutions that range from simple media players to networked systems in the car. The suite is optimized to leverage system-on-chip (SoC) video acceleration, in addition to supporting OpenMAX AL, an industry open standard API for application-level access to a device’s audio, video and imaging capabilities. Overview Consumer’s demand for multimedia has fueled an anywhere- o QNX SDK for Smartphone Connectivity (with support for Apple anytime paradigm, making multimedia ubiquitous in embedded CarPlay and Android Auto) systems. More and more embedded applications have require- o Qt distributions for QNX SDP 7 ments for audio, video and communication processing capabilities. For example, an infotainment system’s media player enables o QNX CAR Platform for Infotainment playback of content, stored either on-board or accessed from an • Support for a variety of external media stores external drive, mobile device or streamed over IP via a browser. Increasingly, these systems also have streaming requirements for Features at a Glance distributing content across a network, for instance from a head Multimedia Playback unit to the digital instrument cluster or rear seat entertainment units. Multimedia is also becoming pervasive in other markets, • Software-based audio CODECs such as medical, industrial, and whitegoods where user interfaces • Hardware accelerated video CODECs are increasingly providing users with a rich media experience.
    [Show full text]
  • Opengl ES / Openvg / Opencl / Webgl / Etc
    KNU-3DC : Education and Training Plan 24 July 2013 Hwanyong LEE, Ph.D. Principal Engineer & Industry Cooperation Prof., KNU 3DC [email protected] KNU-3DC Introduction • Kyungpook National Univ. 3D Convergence Technology Center . Korea Government Funded Org. 23 staffs (10 Ph.D) . Research / Supporting Industry . Training and Education • Training and Education . Dassault Training Center . KIKS(Korea Institute of Khronos Study) • Constructing New Center Building . HUGE ! 7 Floors ! (2014E) 2 KNU-3DC KIKS • KIKS(Korea Institute of Khronos Study) . Leading Role in Korea for Training and Education of Khronos Standard – Collaboration with Khronos Group . Open Lecture + Develop Coursework for • OpenGL / OpenGL ES / OpenVG / OpenCL / WebGL / etc. • Opening / Sponsoring Workshop and Forum . Participating Khronos Activities • Contributor Member (Plan, now Processing) • Active participation of Khronos WG . Other Standard Activities • Make Khronos Standard into Korea National Standard. (WebGL) • W3C, ISO/IEC JTC1, IEEE 3333.X . Research and Consulting for Industry and Academy 3 KIKS Course • KIKS Course will be categorized into . Basic / Advanced / Packaged . Special Course - For instance Overview / Optimization / Consulting • Developing Courseware (for Khronos API) . OpenGL ES Basic & Advanced . OpenGL Basic & Advanced . OpenVG . OpenCL Basic & Advanced . WebGL . Etc. – new standards (Red - Started / Orange – Start at 4Q2013 / Dark Blue – Start at 2014) 4 Different View of Courses University Computer Game Image Parallel View Graphics Develop Processing … Processing JavaScript Khronos Canvas View … iPhone Android Company Web-App Parallel App App Application Develop View Develop Develop … Develop Course Development – Packaging Example • Android Application with OpenGL ES . General Android API’s – JNI, Java etc. OpenGL ES • iPhone App. Development with OpenGL ES . General iPhone APP API – cocoa, Objective-C, etc.
    [Show full text]
  • Implementing FPGA Design with the Opencl Standard
    Implementing FPGA Design with the OpenCL Standard WP-01173-3.0 White Paper Utilizing the Khronos Group’s OpenCL™ standard on an FPGA may offer significantly higher performance and at much lower power than is available today from hardware architectures such as CPUs, graphics processing units (GPUs), and digital signal processing (DSP) units. In addition, an FPGA-based heterogeneous system (CPU + FPGA) using the OpenCL standard has a significant time-to-market advantage compared to traditional FPGA development using lower level hardware description languages (HDLs) such as Verilog or VHDL. 1 OpenCL and the OpenCL logo are trademarks of Apple Inc. used by permission by Khronos. Introduction The initial era of programmable technologies contained two different extremes of programmability. As illustrated in Figure 1, one extreme was represented by single core CPU and digital signal processing (DSP) units. These devices were programmable using software consisting of a list of instructions to be executed. These instructions were created in a manner that was conceptually sequential to the programmer, although an advanced processor could reorder instructions to extract instruction-level parallelism from these sequential programs at run time. In contrast, the other extreme of programmable technology was represented by the FPGA. These devices are programmed by creating configurable hardware circuits, which execute completely in parallel. A designer using an FPGA is essentially creating a massively- fine-grained parallel application. For many years, these extremes coexisted with each type of programmability being applied to different application domains. However, recent trends in technology scaling have favored technologies that are both programmable and parallel. Figure 1.
    [Show full text]
  • The Opengl Graphics System
    OpenGL R ES Native Platform Graphics Interface (Version 1.0) Editor: Jon Leech Copyright c 2002-2003 Promoters of the Khronos Group (3Dlabs, ARM Ltd., ATI Technologies, Inc., Discreet, Ericsson Mobile, Imagination Technologies Group plc, Motorola, Inc., Nokia, Silicon Graphics, Inc., SK Telecom, and Sun Microsystems). This document is protected by copyright, and contains information proprietary to The Khronos Group. Any copying, adaptation, distribution, public performance, or public display of this document without the express written consent of the copy- right holders is strictly prohibited. The receipt or possession of this document does not convey any rights to reproduce, disclose, or distribute its contents, or to manu- facture, use, or sell anything that it may describe, in whole or in part. R This document is a derivative work of ”OpenGL Graphics with the X Window System (Version 1.4)”. Silicon Graphics, Inc. owns, and reserves all rights in, the latter document. OpenGL is a registered trademark, and OpenGL ES is a trademark, of Silicon Graphics, Inc. Contents 1 Overview 1 2 EGL Operation 2 2.1 Native Window System and Rendering APIs . 2 2.1.1 Scalar Types . 2 2.1.2 Displays . 3 2.2 Rendering Contexts and Drawing Surfaces . 3 2.2.1 Using Rendering Contexts . 4 2.2.2 Rendering Models . 4 2.2.3 Interaction With Native Rendering . 4 2.3 Direct Rendering and Address Spaces . 5 2.4 Shared State . 5 2.4.1 Texture Objects . 6 2.5 Multiple Threads . 6 2.6 Power Management . 7 3 EGL Functions and Errors 8 3.1 Errors .
    [Show full text]
  • The Opencl Specification
    The OpenCL Specification Version: 2.0 Document Revision: 22 Khronos OpenCL Working Group Editor: Aaftab Munshi Last Revision Date: 3/18/14 Page 1 1. INTRODUCTION ............................................................................................................... 10 2. GLOSSARY ......................................................................................................................... 12 3. THE OPENCL ARCHITECTURE .................................................................................... 23 3.1 Platform Model ................................................................................................................................ 23 3.2 Execution Model .............................................................................................................................. 25 3.2.1 Execution Model: Mapping work-items onto an NDRange ........................................................................28 3.2.2 Execution Model: Execution of kernel-instances ........................................................................................30 3.2.3 Execution Model: Device-side enqueue ......................................................................................................31 3.2.4 Execution Model: Synchronization .............................................................................................................32 3.2.5 Execution Model: Categories of Kernels ....................................................................................................33 3.3 Memory
    [Show full text]
  • 414 Advances in Opengl ES for Ios 5 V3 DD F
    Advances in OpenGL ES for iOS 5 Session 414 Gokhan Avkarogullari Eric Sunalp iPhone GPU Software These are confidential sessions—please refrain from streaming, blogging, or taking pictures 1 iPad 2 2 3 Per Pixel Lighting/ Normal Maps 4 LightMaps GlossMaps SpecularMaps 5 Dynamic Shadows 6 MSAA 7 Higher Poly Models 8 GLKit New Features 9 GLKit New Features 10 OpenGL ES 2.0 Molecules.app OpenGL ES 1.1 OpenGL ES 2.0 11 GLKit Goals • Making life easier for the developers ■ Find common problems ■ Make solutions available • Encourage unique look ■ Fixed-function pipeline games look similar ■ Shaders to rescue ■ How about porting 12 GLKit GLKTextureLoader GLKTextureLoader • Give a reference—get an OpenGL Texture Object • No need to deal ImageIO, CGImage, libjpg, libpng… 13 GLKit GLKView and GLKViewController GLKTextureLoader GLKView/ViewController • First-class citizen of UIKit hierarchy • Encapsulates FBOs, display links, MSAA management… 14 GLKit GLKMath GLKTextureLoader GLKView/ViewController GLKMath • 3D Graphics math library • Matrix stack, transforms, quaternions… 15 GLKit GLKEffects GLKTextureLoader GLKView/ViewController GLKMath GLKEffects • Fixed-function pipeline features implemented in ES 2.0 context 16 GLKTextureLoader 17 GLKTextureLoader Overview • Makes texture loading simple • Supports common image formats ■ PNG, JPEG, TIFF, etc. • Non-premultiplied data stays non-premultiplied • Cubemap texture support • Convenient loading options ■ Force premultiplication ■ Y-flip ■ Mipmap generation 18 GLKTextureLoader Basic usage • Make an EAGLContext
    [Show full text]