没有合适的资源?快使用搜索试试~ 我知道了~
首页opengl4.5 shading language 规范
资源详情
资源评论
资源推荐
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
4.3.3 Constant Expressions.................................................................................................46
4.3.4 Input Variables............................................................................................................47
4.3.5 Uniform Variables.......................................................................................................50
4.3.6 Output Variables.........................................................................................................50
4.3.7 Buffer Variables..........................................................................................................53
4.3.8 Shared Variables.........................................................................................................53
4.3.9 Interface Blocks..........................................................................................................54
4.4 Layout Qualifiers................................................................................................................58
4.4.1 Input Layout Qualifiers...............................................................................................60
4.4.1.1 Tessellation Evaluation Inputs............................................................................64
4.4.1.2 Geometry Shader Inputs......................................................................................65
4.4.1.3 Fragment Shader Inputs......................................................................................66
4.4.1.4 Compute Shader Inputs.......................................................................................67
4.4.2 Output Layout Qualifiers............................................................................................68
4.4.2.1 Transform Feedback Layout Qualifiers..............................................................70
4.4.2.2 Tessellation Control Outputs..............................................................................72
4.4.2.3 Geometry Outputs...............................................................................................73
4.4.2.4 Fragment Outputs...............................................................................................75
4.4.3 Uniform Variable Layout Qualifiers...........................................................................76
4.4.4 Subroutine Function Layout Qualifiers......................................................................77
4.4.5 Uniform and Shader Storage Block Layout Qualifiers...............................................77
4.4.6 Opaque-Uniform Layout Qualifiers............................................................................80
4.4.6.1 Atomic Counter Layout Qualifiers......................................................................81
4.4.6.2 Format Layout Qualifiers....................................................................................82
4.5 Interpolation Qualifiers......................................................................................................84
4.5.1 Redeclaring Built-in Interpolation Variables in the Compatibility Profile.................85
4.6 Parameter Qualifiers...........................................................................................................86
4.7 Precision and Precision Qualifiers.....................................................................................86
iv
4.7.1 Range and Precision...................................................................................................86
4.7.2 Precision Qualifiers....................................................................................................87
4.7.3 Default Precision Qualifiers.......................................................................................88
4.7.4 Available Precision Qualifiers....................................................................................89
4.8 Variance and the Invariant Qualifier...................................................................................89
4.8.1 The Invariant Qualifier...............................................................................................89
4.8.2 Invariance of Constant Expressions...........................................................................90
4.9 The Precise Qualifier..........................................................................................................90
4.10 Memory Qualifiers...........................................................................................................93
4.11 Order and Repetition of Qualification..............................................................................96
4.12 Empty Declarations..........................................................................................................96
5 Operators and Expressions........................................................................................................97
5.1 Operators............................................................................................................................97
5.2 Array Operations................................................................................................................98
5.3 Function Calls....................................................................................................................98
5.4 Constructors.......................................................................................................................98
5.4.1 Conversion and Scalar Constructors..........................................................................98
5.4.2 Vector and Matrix Constructors..................................................................................99
5.4.3 Structure Constructors..............................................................................................101
5.4.4 Array Constructors....................................................................................................102
5.5 Vector and Scalar Components and Length......................................................................102
5.6 Matrix Components..........................................................................................................104
5.7 Structure and Array Operations........................................................................................104
5.8 Assignments.....................................................................................................................105
5.9 Expressions......................................................................................................................106
5.10 Vector and Matrix Operations........................................................................................109
5.11 Out-of-Bounds Accesses.................................................................................................110
6 Statements and Structure.........................................................................................................112
6.1 Function Definitions.........................................................................................................113
6.1.1 Function Calling Conventions..................................................................................116
6.1.2 Subroutines...............................................................................................................117
6.2 Selection...........................................................................................................................119
6.3 Iteration............................................................................................................................120
6.4 Jumps................................................................................................................................121
7 Built-in Variables....................................................................................................................122
7.1 Built-In Language Variables.............................................................................................122
7.1.1 Compatibility Profile Built-In Language Variables..................................................132
7.2 Compatibility Profile Vertex Shader Built-In Inputs........................................................135
7.3 Built-In Constants............................................................................................................136
v
剩余212页未读,继续阅读
CyberLogix
- 粉丝: 397
- 资源: 23
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- 27页智慧街道信息化建设综合解决方案.pptx
- 计算机二级Ms-Office选择题汇总.doc
- 单链表的插入和删除实验报告 (2).docx
- 单链表的插入和删除实验报告.pdf
- 物联网智能终端项目设备管理方案.pdf
- 如何打造品牌的模式.doc
- 样式控制与页面布局.pdf
- 武汉理工Java实验报告(二).docx
- 2021线上新品消费趋势报告.pdf
- 第3章 Matlab中的矩阵及其运算.docx
- 基于Web的人力资源管理系统的必要性和可行性.doc
- 基于一阶倒立摆的matlab仿真实验.doc
- 速运公司物流管理模式研究教材
- 大数据与管理.pptx
- 单片机课程设计之步进电机.doc
- 大数据与数据挖掘.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0