当前位置:网站首页>Chapter 10 of OpenGL super classic (7th Edition) calculation shader
Chapter 10 of OpenGL super classic (7th Edition) calculation shader
2022-06-30 05:01:00 【Jason_ Chen__】
OpenGL Super treasure ( The first 7 edition ) Chapter 10 calculation shaders
Preface
utilize GPU Of computing power
Unlike other shaders , It can synchronize and share data with each other
No fixed input or output , Do not connect with any other fixed pipeline process , High flexibility , It has functions that other processes do not have
One 、 Use calculation shaders
The calculation shader must be a separate program , You cannot combine other shaders ( The vertices 、 Surface subdivision 、 The geometric 、 fragment )
1. Execute calculation shader
sketch : Calculation shaders are executed in the workgroup , There is and only one global workgroup sent to opengl perform , There are multiple local workgroups under the global workgroup , Each local workgroup has its own work item (3D block ), Each work item can be set in the layout qualifier of the calculation shader
glDispatchCompute() and glDispatchComputeIndirect(): Set the number of local workgroups
glGetIntegeri_v(): Get the working status of the local workgroup , for example : The maximum size of the global workgroup ( Number of local working groups ), The volume of a local working group
glGetIntegeriv(): Get the volume of a local workgroup
Calculate the input and output of the shader :
sketch : No built-in output , It is a single process pipeline , Built in variables can determine the location of local workgroups and work items ( Indexes )
gl_WorkGroupID: The index of the local workgroup in the global workgroup , for example :gl_WorkGroupID.x、gl_WorkGroupID.y、gl_WorkGroupID.z
gl_LocalInvocationID: Index of work items in local workgroups , for example :gl_LocalInvocationID.x、gl_LocalInvocationID.y、gl_LocalInvocationID.z
gl_NumWorkGroups: Total number of calls to local workgroups
gl_WorkGroupSize: Total number of calls to work items
gl_LocalInvocationIndex: Put... In the work item 3D Variable to 1D Indexes
have access to imageStore、atomics As shader output , Write to shader storage block , for example : Image inversion
2. Compute shader communication
sketch : Computational shaders can declare variable communication through a limited number of shared memory qualifiers , The access speed is very fast
Sync : adopt barrier() function , Pay attention to competitive conditions and barrier() Impact on competitive conditions
Example : Parallel prefix and 、 Application of depth of field
Compute shader cluster :
sketch : An individual's behavior is based only on his perception of other members of the group around him , There is no cooperation between the members on a certain decision , for example : There is no leader in the fish school
Example : Clustered paper planes
边栏推荐
- Sailing experience not to be missed in New York Tourism: take you to enjoy the magnificent city scenery from different perspectives
- Unreal 4 learning notes - set player birth point
- SCM learning notes: interrupt learning
- Easyrecovery data recovery software recovers my photo and video data two years ago
- How to install win7 on AMD Ruilong CPU A320 series motherboard
- Singapore parent-child tour, these popular attractions must be arranged
- HTC vive cosmos development - handle button event
- Tensorflow2 of ubantu18.04 X installation
- Malignant bug: 1252 of unit MySQL export
- Connect to the database and run node JS running database shows that the database is missing
猜你喜欢

Malignant bug: 1252 of unit MySQL export

Force buckle 209 Minimum length subarray

【VCS+Verdi聯合仿真】~ 以計數器為例

EasyRecovery数据恢复软件 恢复了我两年前的照片视频数据

Create transfer generation point

UE4 method of embedding web pages

Force buckle 704 Binary search

PWN入门(2)栈溢出基础

【VCS+Verdi联合仿真】~ 以计数器为例

Arsenal Stadium Tour - take you to the front and back of Arsenal Stadium
随机推荐
Generate a slice of mesh Foundation
Collective system
Is the Flink connector JDBC open source? Where can I download it
Singapore parent-child tour, these popular attractions must be arranged
JS 数组的排序 sort方法详解
2021-03-16
How does unity use mapbox to implement real maps in games?
Unreal 4 learning notes - Animated Montage
[recruitment] UE4 Development Engineer
Leetcode 180 Consecutive numbers (2022.06.29)
Unit screenshot saved on the phone
003-JS-DOM-Attr-innerText
On mask culling of unity
Check London attractions suitable for parents and children in winter vacation
Some problems encountered in unity steamvr
PBR material: basic principle and simple fabrication
Sailing experience not to be missed in New York Tourism: take you to enjoy the magnificent city scenery from different perspectives
力扣27. 移除元素
Detailed explanation of the process of "flyingbird" small game (camera adjustment and following part)
Pycharm database tool