Skip to content

Commit e225eb0

Browse files
committed
Define a new Image operand bit mask for non constant offsets
For details refer to https://gitlab.khronos.org/spirv/SPIR-V/-/issues/639 As part of the commit following changes have been introduced: 1. Added a separate section in spirv xml to reserve vendor specific bit masks. 2. Added a new image operand bit mask to support non constant offsets in textureGatherOffsets as defined in GL_NV_gpu_shader5
1 parent ae217c1 commit e225eb0

File tree

10 files changed

+43
-1
lines changed

10 files changed

+43
-1
lines changed

include/spirv/spir-v.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,4 +251,24 @@
251251
<ids type="MemoryOperand" start="18" end="30" comment="Unreserved bits reservable for use by vendors"/>
252252
<ids type="MemoryOperand" start="31" end="31" vendor="Khronos" comment="Reserved MemoryOperand bit, not available to vendors"/>
253253

254+
<!-- SECTION: SPIR-V Image Operand Bit Reservations -->
255+
<!-- Reserve ranges of bits in the image operands bitfield.
256+
257+
Each vendor determines the use of values in their own ranges.
258+
Vendors are not required to disclose those uses. If the use of a
259+
value is included in an extension that is adopted by a Khronos
260+
extension or specification, then that value's use may be permanently
261+
fixed as if originally reserved in a Khronos range.
262+
263+
The SPIR Working Group strongly recommends:
264+
- Each value is used for only one purpose.
265+
- All values in a range should be used before allocating a new range.
266+
-->
267+
268+
<!-- Reserved image operand bits -->
269+
<ids type="ImageOperand" start="0" end="15" vendor="Khronos" comment="Reserved ImageOperand bits, not available to vendors - see the SPIR-V Specification"/>
270+
<ids type="ImageOperand" start="16" end="16" vendor="Nvidia" comment="Contact [email protected]"/>
271+
<ids type="ImageOperand" start="17" end="30" comment="Unreserved bits reservable for use by vendors"/>
272+
<ids type="ImageOperand" start="31" end="31" vendor="Khronos" comment="Reserved ImageOperand bit, not available to vendors"/>
273+
254274
</registry>

include/spirv/unified1/spirv.core.grammar.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8475,6 +8475,13 @@
84758475
"enumerant" : "ZeroExtend",
84768476
"value" : "0x2000",
84778477
"version" : "1.4"
8478+
},
8479+
{
8480+
"enumerant" : "Offsets",
8481+
"value" : "0x10000",
8482+
"parameters" : [
8483+
{ "kind" : "IdRef" }
8484+
]
84788485
}
84798486
]
84808487
},

include/spirv/unified1/spirv.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ public enum ImageOperandsShift
349349
VolatileTexelKHR = 11,
350350
SignExtend = 12,
351351
ZeroExtend = 13,
352+
Offsets = 16,
352353
}
353354

354355
public enum ImageOperandsMask
@@ -372,6 +373,7 @@ public enum ImageOperandsMask
372373
VolatileTexelKHR = 0x00000800,
373374
SignExtend = 0x00001000,
374375
ZeroExtend = 0x00002000,
376+
Offsets = 0x00010000,
375377
}
376378

377379
public enum FPFastMathModeShift

include/spirv/unified1/spirv.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ typedef enum SpvImageOperandsShift_ {
357357
SpvImageOperandsVolatileTexelKHRShift = 11,
358358
SpvImageOperandsSignExtendShift = 12,
359359
SpvImageOperandsZeroExtendShift = 13,
360+
SpvImageOperandsOffsetsShift = 16,
360361
SpvImageOperandsMax = 0x7fffffff,
361362
} SpvImageOperandsShift;
362363

@@ -380,6 +381,7 @@ typedef enum SpvImageOperandsMask_ {
380381
SpvImageOperandsVolatileTexelKHRMask = 0x00000800,
381382
SpvImageOperandsSignExtendMask = 0x00001000,
382383
SpvImageOperandsZeroExtendMask = 0x00002000,
384+
SpvImageOperandsOffsetsMask = 0x00010000,
383385
} SpvImageOperandsMask;
384386

385387
typedef enum SpvFPFastMathModeShift_ {

include/spirv/unified1/spirv.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ enum ImageOperandsShift {
353353
ImageOperandsVolatileTexelKHRShift = 11,
354354
ImageOperandsSignExtendShift = 12,
355355
ImageOperandsZeroExtendShift = 13,
356+
ImageOperandsOffsetsShift = 16,
356357
ImageOperandsMax = 0x7fffffff,
357358
};
358359

@@ -376,6 +377,7 @@ enum ImageOperandsMask {
376377
ImageOperandsVolatileTexelKHRMask = 0x00000800,
377378
ImageOperandsSignExtendMask = 0x00001000,
378379
ImageOperandsZeroExtendMask = 0x00002000,
380+
ImageOperandsOffsetsMask = 0x00010000,
379381
};
380382

381383
enum FPFastMathModeShift {

include/spirv/unified1/spirv.hpp11

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ enum class ImageOperandsShift : unsigned {
353353
VolatileTexelKHR = 11,
354354
SignExtend = 12,
355355
ZeroExtend = 13,
356+
Offsets = 16,
356357
Max = 0x7fffffff,
357358
};
358359

@@ -376,6 +377,7 @@ enum class ImageOperandsMask : unsigned {
376377
VolatileTexelKHR = 0x00000800,
377378
SignExtend = 0x00001000,
378379
ZeroExtend = 0x00002000,
380+
Offsets = 0x00010000,
379381
};
380382

381383
enum class FPFastMathModeShift : unsigned {

include/spirv/unified1/spirv.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,8 @@
395395
"VolatileTexel": 11,
396396
"VolatileTexelKHR": 11,
397397
"SignExtend": 12,
398-
"ZeroExtend": 13
398+
"ZeroExtend": 13,
399+
"Offsets": 16
399400
}
400401
},
401402
{

include/spirv/unified1/spirv.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ spv = {
332332
VolatileTexelKHR = 11,
333333
SignExtend = 12,
334334
ZeroExtend = 13,
335+
Offsets = 16,
335336
},
336337

337338
ImageOperandsMask = {
@@ -354,6 +355,7 @@ spv = {
354355
VolatileTexelKHR = 0x00000800,
355356
SignExtend = 0x00001000,
356357
ZeroExtend = 0x00002000,
358+
Offsets = 0x00010000,
357359
},
358360

359361
FPFastMathModeShift = {

include/spirv/unified1/spirv.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@
332332
'VolatileTexelKHR' : 11,
333333
'SignExtend' : 12,
334334
'ZeroExtend' : 13,
335+
'Offsets' : 16,
335336
},
336337

337338
'ImageOperandsMask' : {
@@ -354,6 +355,7 @@
354355
'VolatileTexelKHR' : 0x00000800,
355356
'SignExtend' : 0x00001000,
356357
'ZeroExtend' : 0x00002000,
358+
'Offsets' : 0x00010000,
357359
},
358360

359361
'FPFastMathModeShift' : {

include/spirv/unified1/spv.d

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ enum ImageOperandsShift : uint
352352
VolatileTexelKHR = 11,
353353
SignExtend = 12,
354354
ZeroExtend = 13,
355+
Offsets = 16,
355356
}
356357

357358
enum ImageOperandsMask : uint
@@ -375,6 +376,7 @@ enum ImageOperandsMask : uint
375376
VolatileTexelKHR = 0x00000800,
376377
SignExtend = 0x00001000,
377378
ZeroExtend = 0x00002000,
379+
Offsets = 0x00010000,
378380
}
379381

380382
enum FPFastMathModeShift : uint

0 commit comments

Comments
 (0)