Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
glslang
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
glslang
Commits
ea50f6d7
Unverified
Commit
ea50f6d7
authored
Apr 27, 2020
by
pmistryNV
Committed by
GitHub
Apr 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for extension GL_ARB_shading_language_packing (#2192)
parent
bcf6a243
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
96 additions
and
9 deletions
+96
-9
150.frag
Test/150.frag
+20
-0
150.frag.out
Test/baseResults/150.frag.out
+49
-1
spv.specConstant.vert.out
Test/baseResults/spv.specConstant.vert.out
+3
-3
Initialize.cpp
glslang/MachineIndependent/Initialize.cpp
+21
-5
Versions.cpp
glslang/MachineIndependent/Versions.cpp
+2
-0
Versions.h
glslang/MachineIndependent/Versions.h
+1
-0
No files found.
Test/150.frag
View file @
ea50f6d7
...
@@ -79,3 +79,23 @@ void bitEncodingFail()
...
@@ -79,3 +79,23 @@ void bitEncodingFail()
{
{
int
i
=
floatBitsToInt
(
f
);
// Error, extention GL_ARB_bit_encoding is diabled
int
i
=
floatBitsToInt
(
f
);
// Error, extention GL_ARB_bit_encoding is diabled
}
}
#extension GL_ARB_shading_language_packing : enable
vec2
v2a
;
uint
uy
;
void
packingPass
()
{
uint
u19
=
packSnorm2x16
(
v2a
);
vec2
v20
=
unpackSnorm2x16
(
uy
);
uint
u15
=
packUnorm2x16
(
v2a
);
vec2
v16
=
unpackUnorm2x16
(
uy
);
uint
u17
=
packHalf2x16
(
v2a
);
vec2
v18
=
unpackHalf2x16
(
uy
);
}
#extension GL_ARB_shading_language_packing : disable
void
packingFail
()
{
uint
u19
=
packSnorm2x16
(
v2a
);
// Error, extension GL_ARB_shading_language_packing is disabled
}
Test/baseResults/150.frag.out
View file @
ea50f6d7
...
@@ -10,12 +10,14 @@ ERROR: 0:53: 'double' : not supported for this version or the enabled extensions
...
@@ -10,12 +10,14 @@ ERROR: 0:53: 'double' : not supported for this version or the enabled extensions
ERROR: 0:53: 'double' : must be qualified as flat in
ERROR: 0:53: 'double' : must be qualified as flat in
ERROR: 0:57: '=' : cannot convert from ' global double' to ' global int'
ERROR: 0:57: '=' : cannot convert from ' global double' to ' global int'
ERROR: 0:80: 'floatBitsToInt' : required extension not requested: GL_ARB_shader_bit_encoding
ERROR: 0:80: 'floatBitsToInt' : required extension not requested: GL_ARB_shader_bit_encoding
ERROR: 11 compilation errors. No code generated.
ERROR: 0:100: 'packSnorm2x16' : required extension not requested: GL_ARB_shading_language_packing
ERROR: 12 compilation errors. No code generated.
Shader version: 150
Shader version: 150
Requested GL_ARB_gpu_shader_fp64
Requested GL_ARB_gpu_shader_fp64
Requested GL_ARB_shader_bit_encoding
Requested GL_ARB_shader_bit_encoding
Requested GL_ARB_shading_language_packing
gl_FragCoord pixel center is integer
gl_FragCoord pixel center is integer
gl_FragCoord origin is upper left
gl_FragCoord origin is upper left
ERROR: node is still EOpNull!
ERROR: node is still EOpNull!
...
@@ -167,6 +169,47 @@ ERROR: node is still EOpNull!
...
@@ -167,6 +169,47 @@ ERROR: node is still EOpNull!
0:80 'i' ( temp int)
0:80 'i' ( temp int)
0:80 floatBitsToInt ( global int)
0:80 floatBitsToInt ( global int)
0:80 'f' ( global float)
0:80 'f' ( global float)
0:87 Function Definition: packingPass( ( global void)
0:87 Function Parameters:
0:89 Sequence
0:89 Sequence
0:89 move second child to first child ( temp uint)
0:89 'u19' ( temp uint)
0:89 packSnorm2x16 ( global uint)
0:89 'v2a' ( global 2-component vector of float)
0:90 Sequence
0:90 move second child to first child ( temp 2-component vector of float)
0:90 'v20' ( temp 2-component vector of float)
0:90 unpackSnorm2x16 ( global 2-component vector of float)
0:90 'uy' ( global uint)
0:91 Sequence
0:91 move second child to first child ( temp uint)
0:91 'u15' ( temp uint)
0:91 packUnorm2x16 ( global uint)
0:91 'v2a' ( global 2-component vector of float)
0:92 Sequence
0:92 move second child to first child ( temp 2-component vector of float)
0:92 'v16' ( temp 2-component vector of float)
0:92 unpackUnorm2x16 ( global 2-component vector of float)
0:92 'uy' ( global uint)
0:93 Sequence
0:93 move second child to first child ( temp uint)
0:93 'u17' ( temp uint)
0:93 packHalf2x16 ( global uint)
0:93 'v2a' ( global 2-component vector of float)
0:94 Sequence
0:94 move second child to first child ( temp 2-component vector of float)
0:94 'v18' ( temp 2-component vector of float)
0:94 unpackHalf2x16 ( global 2-component vector of float)
0:94 'uy' ( global uint)
0:98 Function Definition: packingFail( ( global void)
0:98 Function Parameters:
0:100 Sequence
0:100 Sequence
0:100 move second child to first child ( temp uint)
0:100 'u19' ( temp uint)
0:100 packSnorm2x16 ( global uint)
0:100 'v2a' ( global 2-component vector of float)
0:? Linker Objects
0:? Linker Objects
0:? 'gl_FragCoord' ( gl_FragCoord 4-component vector of float FragCoord)
0:? 'gl_FragCoord' ( gl_FragCoord 4-component vector of float FragCoord)
0:? 'foo' ( smooth in 4-component vector of float)
0:? 'foo' ( smooth in 4-component vector of float)
...
@@ -192,6 +235,8 @@ ERROR: node is still EOpNull!
...
@@ -192,6 +235,8 @@ ERROR: node is still EOpNull!
0:? 'v4' ( global 4-component vector of float)
0:? 'v4' ( global 4-component vector of float)
0:? 'iv4a' ( global 4-component vector of int)
0:? 'iv4a' ( global 4-component vector of int)
0:? 'uv2c' ( global 2-component vector of uint)
0:? 'uv2c' ( global 2-component vector of uint)
0:? 'v2a' ( global 2-component vector of float)
0:? 'uy' ( global uint)
Linked fragment stage:
Linked fragment stage:
...
@@ -200,6 +245,7 @@ Linked fragment stage:
...
@@ -200,6 +245,7 @@ Linked fragment stage:
Shader version: 150
Shader version: 150
Requested GL_ARB_gpu_shader_fp64
Requested GL_ARB_gpu_shader_fp64
Requested GL_ARB_shader_bit_encoding
Requested GL_ARB_shader_bit_encoding
Requested GL_ARB_shading_language_packing
gl_FragCoord pixel center is integer
gl_FragCoord pixel center is integer
gl_FragCoord origin is upper left
gl_FragCoord origin is upper left
ERROR: node is still EOpNull!
ERROR: node is still EOpNull!
...
@@ -260,4 +306,6 @@ ERROR: node is still EOpNull!
...
@@ -260,4 +306,6 @@ ERROR: node is still EOpNull!
0:? 'v4' ( global 4-component vector of float)
0:? 'v4' ( global 4-component vector of float)
0:? 'iv4a' ( global 4-component vector of int)
0:? 'iv4a' ( global 4-component vector of int)
0:? 'uv2c' ( global 2-component vector of uint)
0:? 'uv2c' ( global 2-component vector of uint)
0:? 'v2a' ( global 2-component vector of float)
0:? 'uy' ( global uint)
Test/baseResults/spv.specConstant.vert.out
View file @
ea50f6d7
...
@@ -11,7 +11,7 @@ spv.specConstant.vert
...
@@ -11,7 +11,7 @@ spv.specConstant.vert
Source GLSL 400
Source GLSL 400
Name 4 "main"
Name 4 "main"
Name 9 "arraySize"
Name 9 "arraySize"
Name 14 "foo(vf4[s453
0
];"
Name 14 "foo(vf4[s453
4
];"
Name 13 "p"
Name 13 "p"
Name 17 "builtin_spec_constant("
Name 17 "builtin_spec_constant("
Name 20 "color"
Name 20 "color"
...
@@ -102,10 +102,10 @@ spv.specConstant.vert
...
@@ -102,10 +102,10 @@ spv.specConstant.vert
Store 20(color) 46
Store 20(color) 46
48: 10 Load 22(ucol)
48: 10 Load 22(ucol)
Store 47(param) 48
Store 47(param) 48
49: 2 FunctionCall 14(foo(vf4[s453
0
];) 47(param)
49: 2 FunctionCall 14(foo(vf4[s453
4
];) 47(param)
Return
Return
FunctionEnd
FunctionEnd
14(foo(vf4[s453
0
];): 2 Function None 12
14(foo(vf4[s453
4
];): 2 Function None 12
13(p): 11(ptr) FunctionParameter
13(p): 11(ptr) FunctionParameter
15: Label
15: Label
54: 24(ptr) AccessChain 53(dupUcol) 23
54: 24(ptr) AccessChain 53(dupUcol) 23
...
...
glslang/MachineIndependent/Initialize.cpp
View file @
ea50f6d7
...
@@ -1349,7 +1349,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
...
@@ -1349,7 +1349,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
#endif
#endif
if
((
profile
==
EEsProfile
&&
version
>=
300
)
||
if
((
profile
==
EEsProfile
&&
version
>=
300
)
||
(
profile
!=
EEsProfile
&&
version
>=
40
0
))
{
(
profile
!=
EEsProfile
&&
version
>=
15
0
))
{
commonBuiltins
.
append
(
commonBuiltins
.
append
(
"highp uint packUnorm2x16(vec2);"
"highp uint packUnorm2x16(vec2);"
"vec2 unpackUnorm2x16(highp uint);"
"vec2 unpackUnorm2x16(highp uint);"
...
@@ -1357,7 +1357,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
...
@@ -1357,7 +1357,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
}
}
if
((
profile
==
EEsProfile
&&
version
>=
300
)
||
if
((
profile
==
EEsProfile
&&
version
>=
300
)
||
(
profile
!=
EEsProfile
&&
version
>=
42
0
))
{
(
profile
!=
EEsProfile
&&
version
>=
15
0
))
{
commonBuiltins
.
append
(
commonBuiltins
.
append
(
"highp uint packSnorm2x16(vec2);"
"highp uint packSnorm2x16(vec2);"
" vec2 unpackSnorm2x16(highp uint);"
" vec2 unpackSnorm2x16(highp uint);"
...
@@ -1369,7 +1369,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
...
@@ -1369,7 +1369,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
commonBuiltins
.
append
(
commonBuiltins
.
append
(
"mediump vec2 unpackHalf2x16(highp uint);"
"mediump vec2 unpackHalf2x16(highp uint);"
"
\n
"
);
"
\n
"
);
}
else
if
(
profile
!=
EEsProfile
&&
version
>=
42
0
)
{
}
else
if
(
profile
!=
EEsProfile
&&
version
>=
15
0
)
{
commonBuiltins
.
append
(
commonBuiltins
.
append
(
" vec2 unpackHalf2x16(highp uint);"
" vec2 unpackHalf2x16(highp uint);"
"
\n
"
);
"
\n
"
);
...
@@ -1377,7 +1377,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
...
@@ -1377,7 +1377,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
#ifndef GLSLANG_WEB
#ifndef GLSLANG_WEB
if
((
profile
==
EEsProfile
&&
version
>=
310
)
||
if
((
profile
==
EEsProfile
&&
version
>=
310
)
||
(
profile
!=
EEsProfile
&&
version
>=
40
0
))
{
(
profile
!=
EEsProfile
&&
version
>=
15
0
))
{
commonBuiltins
.
append
(
commonBuiltins
.
append
(
"highp uint packSnorm4x8(vec4);"
"highp uint packSnorm4x8(vec4);"
"highp uint packUnorm4x8(vec4);"
"highp uint packUnorm4x8(vec4);"
...
@@ -1389,7 +1389,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
...
@@ -1389,7 +1389,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"mediump vec4 unpackSnorm4x8(highp uint);"
"mediump vec4 unpackSnorm4x8(highp uint);"
"mediump vec4 unpackUnorm4x8(highp uint);"
"mediump vec4 unpackUnorm4x8(highp uint);"
"
\n
"
);
"
\n
"
);
}
else
if
(
profile
!=
EEsProfile
&&
version
>=
40
0
)
{
}
else
if
(
profile
!=
EEsProfile
&&
version
>=
15
0
)
{
commonBuiltins
.
append
(
commonBuiltins
.
append
(
"vec4 unpackSnorm4x8(highp uint);"
"vec4 unpackSnorm4x8(highp uint);"
"vec4 unpackUnorm4x8(highp uint);"
"vec4 unpackUnorm4x8(highp uint);"
...
@@ -7844,6 +7844,22 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
...
@@ -7844,6 +7844,22 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable
.
setFunctionExtensions
(
"atomicCompSwap"
,
1
,
&
E_GL_ARB_shader_storage_buffer_object
);
symbolTable
.
setFunctionExtensions
(
"atomicCompSwap"
,
1
,
&
E_GL_ARB_shader_storage_buffer_object
);
}
}
// GL_ARB_shading_language_packing
if
(
profile
!=
EEsProfile
&&
version
<
400
)
{
symbolTable
.
setFunctionExtensions
(
"packUnorm2x16"
,
1
,
&
E_GL_ARB_shading_language_packing
);
symbolTable
.
setFunctionExtensions
(
"unpackUnorm2x16"
,
1
,
&
E_GL_ARB_shading_language_packing
);
symbolTable
.
setFunctionExtensions
(
"packSnorm4x8"
,
1
,
&
E_GL_ARB_shading_language_packing
);
symbolTable
.
setFunctionExtensions
(
"packUnorm4x8"
,
1
,
&
E_GL_ARB_shading_language_packing
);
symbolTable
.
setFunctionExtensions
(
"unpackSnorm4x8"
,
1
,
&
E_GL_ARB_shading_language_packing
);
symbolTable
.
setFunctionExtensions
(
"unpackUnorm4x8"
,
1
,
&
E_GL_ARB_shading_language_packing
);
}
if
(
profile
!=
EEsProfile
&&
version
<
420
)
{
symbolTable
.
setFunctionExtensions
(
"packSnorm2x16"
,
1
,
&
E_GL_ARB_shading_language_packing
);
symbolTable
.
setFunctionExtensions
(
"unpackSnorm2x16"
,
1
,
&
E_GL_ARB_shading_language_packing
);
symbolTable
.
setFunctionExtensions
(
"unpackHalf2x16"
,
1
,
&
E_GL_ARB_shading_language_packing
);
symbolTable
.
setFunctionExtensions
(
"packHalf2x16"
,
1
,
&
E_GL_ARB_shading_language_packing
);
}
symbolTable
.
setVariableExtensions
(
"gl_DeviceIndex"
,
1
,
&
E_GL_EXT_device_group
);
symbolTable
.
setVariableExtensions
(
"gl_DeviceIndex"
,
1
,
&
E_GL_EXT_device_group
);
BuiltInVariable
(
"gl_DeviceIndex"
,
EbvDeviceIndex
,
symbolTable
);
BuiltInVariable
(
"gl_DeviceIndex"
,
EbvDeviceIndex
,
symbolTable
);
symbolTable
.
setVariableExtensions
(
"gl_ViewIndex"
,
1
,
&
E_GL_EXT_multiview
);
symbolTable
.
setVariableExtensions
(
"gl_ViewIndex"
,
1
,
&
E_GL_EXT_multiview
);
...
...
glslang/MachineIndependent/Versions.cpp
View file @
ea50f6d7
...
@@ -200,6 +200,7 @@ void TParseVersions::initializeExtensionBehavior()
...
@@ -200,6 +200,7 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior
[
E_GL_ARB_shader_bit_encoding
]
=
EBhDisable
;
extensionBehavior
[
E_GL_ARB_shader_bit_encoding
]
=
EBhDisable
;
extensionBehavior
[
E_GL_ARB_shader_image_size
]
=
EBhDisable
;
extensionBehavior
[
E_GL_ARB_shader_image_size
]
=
EBhDisable
;
extensionBehavior
[
E_GL_ARB_shader_storage_buffer_object
]
=
EBhDisable
;
extensionBehavior
[
E_GL_ARB_shader_storage_buffer_object
]
=
EBhDisable
;
extensionBehavior
[
E_GL_ARB_shading_language_packing
]
=
EBhDisable
;
extensionBehavior
[
E_GL_KHR_shader_subgroup_basic
]
=
EBhDisable
;
extensionBehavior
[
E_GL_KHR_shader_subgroup_basic
]
=
EBhDisable
;
extensionBehavior
[
E_GL_KHR_shader_subgroup_vote
]
=
EBhDisable
;
extensionBehavior
[
E_GL_KHR_shader_subgroup_vote
]
=
EBhDisable
;
...
@@ -409,6 +410,7 @@ void TParseVersions::getPreamble(std::string& preamble)
...
@@ -409,6 +410,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_ARB_shader_stencil_export 1
\n
"
"#define GL_ARB_shader_stencil_export 1
\n
"
"#define GL_ARB_sample_shading 1
\n
"
"#define GL_ARB_sample_shading 1
\n
"
"#define GL_ARB_shader_image_size 1
\n
"
"#define GL_ARB_shader_image_size 1
\n
"
"#define GL_ARB_shading_language_packing 1
\n
"
// "#define GL_ARB_cull_distance 1\n" // present for 4.5, but need extension control over block members
// "#define GL_ARB_cull_distance 1\n" // present for 4.5, but need extension control over block members
"#define GL_ARB_post_depth_coverage 1
\n
"
"#define GL_ARB_post_depth_coverage 1
\n
"
"#define GL_ARB_fragment_shader_interlock 1
\n
"
"#define GL_ARB_fragment_shader_interlock 1
\n
"
...
...
glslang/MachineIndependent/Versions.h
View file @
ea50f6d7
...
@@ -155,6 +155,7 @@ const char* const E_GL_ARB_sample_shading = "GL_ARB_sample_shading
...
@@ -155,6 +155,7 @@ const char* const E_GL_ARB_sample_shading = "GL_ARB_sample_shading
const
char
*
const
E_GL_ARB_shader_bit_encoding
=
"GL_ARB_shader_bit_encoding"
;
const
char
*
const
E_GL_ARB_shader_bit_encoding
=
"GL_ARB_shader_bit_encoding"
;
const
char
*
const
E_GL_ARB_shader_image_size
=
"GL_ARB_shader_image_size"
;
const
char
*
const
E_GL_ARB_shader_image_size
=
"GL_ARB_shader_image_size"
;
const
char
*
const
E_GL_ARB_shader_storage_buffer_object
=
"GL_ARB_shader_storage_buffer_object"
;
const
char
*
const
E_GL_ARB_shader_storage_buffer_object
=
"GL_ARB_shader_storage_buffer_object"
;
const
char
*
const
E_GL_ARB_shading_language_packing
=
"GL_ARB_shading_language_packing"
;
const
char
*
const
E_GL_KHR_shader_subgroup_basic
=
"GL_KHR_shader_subgroup_basic"
;
const
char
*
const
E_GL_KHR_shader_subgroup_basic
=
"GL_KHR_shader_subgroup_basic"
;
const
char
*
const
E_GL_KHR_shader_subgroup_vote
=
"GL_KHR_shader_subgroup_vote"
;
const
char
*
const
E_GL_KHR_shader_subgroup_vote
=
"GL_KHR_shader_subgroup_vote"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment