• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Name
2
3    ARB_shader_image_size
4
5Name Strings
6
7    GL_ARB_shader_image_size
8
9Contact
10
11    Christophe Riccio, AMD (christophe.riccio@amd.com)
12
13Contributors
14
15    Jeannot Breton, NVIDIA
16
17Notice
18
19    Copyright (c) 2012-2013 The Khronos Group Inc. Copyright terms at
20        http://www.khronos.org/registry/speccopyright.html
21
22Specification Update Policy
23
24    Khronos-approved extension specifications are updated in response to
25    issues and bugs prioritized by the Khronos OpenGL Working Group. For
26    extensions which have been promoted to a core Specification, fixes will
27    first appear in the latest version of that core Specification, and will
28    eventually be backported to the extension document. This policy is
29    described in more detail at
30        https://www.khronos.org/registry/OpenGL/docs/update_policy.php
31
32Status
33
34    Complete.
35    Approved by the ARB on 2012/06/12.
36
37Version
38
39    Last Modified Date: July 19, 2012
40    Revision: 3
41
42Number
43
44    ARB Extension #136
45
46Dependencies
47
48    OpenGL 4.2 is required.
49
50    OpenGL Shading Language 4.20 is required
51
52    This extension is written against the OpenGL 4.2 specification and
53    version 4.20 of the OpenGL Shading Language Specification.
54
55    This extension interacts with NV_gpu_program5 and
56    EXT_shader_image_load_store.
57
58Overview
59    This extension provides GLSL built-in functions allowing shaders to query
60    the size of an image.
61
62New Procedures and Functions
63
64    None.
65
66New Tokens
67
68    None.
69
70Additions to Chapter 2 of the OpenGL 4.2 (Core Profile) Specification
71(OpenGL Operation)
72
73    None.
74
75Additions to Chapter 3 of the OpenGL 4.2 (Core Profile) Specification
76(Rasterization)
77
78    None.
79
80Additions to Chapter 4 of the OpenGL 4.2 (Core Profile) Specification
81(Per-Fragment Operations and the Frame Buffer)
82
83    None.
84
85Additions to Chapter 5 of the OpenGL 4.2 (Core Profile) Specification
86(Special Functions)
87
88    None.
89
90Additions to Chapter 6 of the OpenGL 4.2 (Core Profile) Specification
91(State and State Requests)
92
93    None.
94
95Errors
96
97    None.
98
99New State
100
101    None.
102
103New Implementation Dependent State
104
105    None.
106
107Modifications to The OpenGL Shading Language Specification, Version 4.20.11
108
109    Including the following line in a shader can be used to control the
110    language features described in this extension:
111
112      #extension GL_ARB_shader_image_size
113
114    A new preprocessor #define is added to the OpenGL Shading Language:
115
116      #define GL_ARB_shader_image_size 1
117
118    Add to section 8.11 "Image Functions"
119
120    Syntax:
121      int imageSize(gimage1D image)
122      ivec2 imageSize(gimage2D image)
123      ivec3 imageSize(gimage3D image)
124      ivec2 imageSize(gimageCube image)
125      ivec3 imageSize(gimageCubeArray image)
126      ivec2 imageSize(gimageRect image)
127      ivec2 imageSize(gimage1DArray image)
128      ivec3 imageSize(gimage2DArray image)
129      int imageSize(gimageBuffer image)
130      ivec2 imageSize(gimage2DMS image)
131      ivec3 imageSize(gimage2DMSArray image)
132
133Description:
134
135    Returns the dimensions of the image or images bound to <image>.  For arrayed
136    images, the last component of the return value will hold the size of the
137    array.  Cube images return the dimensions of one face, and number of cubes
138    in the cube map array, if arrayed.
139
140Dependencies on NV_gpu_program5 and EXT_shader_image_load_store
141
142    If NV_gpu_program5 and EXT_shader_image_load_store are supported and
143    "OPTION ARB_shader_image_size" is specified in an assembly program, the
144    following edits are made to extend the assembly programming model
145    documented in the NV_gpu_program4 extension and extended by NV_gpu_program5
146    and EXT_shader_image_load_store.
147
148    If NV_gpu_program5 and EXT_shader_image_load_store are not supported, or if
149    "OPTION ARB_shader_image_size" is not specified in an assembly program, the
150    contents of this dependencies section should be ignored.
151
152    Section 2.X.2, Program Grammar
153
154    (add the following rules to the grammar)
155
156      <ImageInstruction>:     ::= <IMQop_instruction>
157
158      <IMQop_instruction:>    ::= <IMQop> <opModifiers> <instResult> ","
159                                       <imageAccess>
160
161      <IMQop>                 ::= "IMQ"
162
163
164    Modify Section 2.X.4, Program Execution Environment
165
166      Instr-      Modifiers
167      uction  V  F I C S H D  Out Inputs    Description
168      ------- -- - - - - - -  --- --------  --------------------------------
169      IMQ     50 - - - - - S  vs  i         image size query
170
171    (Add to "Section 2.X.6, Program Options" of the NV_gpu_program4 extension,
172    as extended by NV_gpu_program5)
173
174      + Image size query (ARB_shader_image_size)
175
176      If a program specifies the "ARB_shader_image_size" option, it may use the
177      IMQ instruction.  If this option is not specified, a program will fail to
178      compile if it uses this instruction.
179
180    Section 2.X.8.Z, IMQ:  Image size query
181
182    The IMQ instruction returns the dimensions of the image unit specified by
183    <imageUnit>.  Eleven image targets are supported:  1D, 2D, 3D, RECT, CUBE,
184    BUFFER, ARRAY1D, ARRAY2D, ARRAYCUBE, 2DMS, and ARRAY2DMS.
185
186    For one-dimensional, one-dimensional array and buffer textures, the "x"
187    component of the result vector is filled with the width of the image(s).
188    For two-dimensional, rectangle, cube map, two-dimensional array, cube map
189    array, three-dimensional, two-dimensional multisample and two-dimensional
190    multisample array textures, the "x" and "y" components are filled with the
191    width and height of the image(s).
192
193    Additionally, when the entire one-dimensional array texture level is bound,
194    the "y" component of the result vector is filled with the number of layers
195    in the image(s).  When the entire two-dimensional array or two-dimensional
196    multisample array texture level is bound, the "z" component of the result
197    vector is filled with the number of layers in the image(s).  When the
198    entire cube map array texture level is bound, the "z" component of the
199    result vector is filled with the number of cubes in the cube map array.
200    When the entire three-dimensional texture level is bound, the "z" component
201    of the result vector is filled with the depth of the image(s).  All other
202    components of the result vector are undefined.
203
204    IMQ supports no storage modifier, since the image size is independent of
205    the image unit format.  It supports no data type modifiers; the result
206    vector is interpreted as signed integers.
207
208Conformance Tests
209
210    <TBD>
211
212Issues
213
214    none
215
216Revision History
217
218    Revision 3, 2012/7/19 (JBreton)
219      - Add interaction with NV_gpu_program5 and EXT_shader_image_load_store,
220        providing a new image size query instruction to the assembly program.
221
222    Revision 2, 2012/5/12 (JohnK)
223      - Expand description to include details consistent with textureSize().
224
225    Revision 1, 2012/03/30 (criccio)
226      - First draft
227