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
369ffa95
Commit
369ffa95
authored
Aug 21, 2019
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
web: Fix accidental additon of refract() prototypes and update README.
parent
deec1933
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
11 deletions
+23
-11
README.md
README.md
+9
-2
spv.specConstant.vert.out
Test/baseResults/spv.specConstant.vert.out
+3
-3
Initialize.cpp
glslang/MachineIndependent/Initialize.cpp
+11
-6
No files found.
README.md
View file @
369ffa95
...
@@ -155,17 +155,24 @@ changes are quite infrequent. For windows you can get binaries from
...
@@ -155,17 +155,24 @@ changes are quite infrequent. For windows you can get binaries from
The command to rebuild is:
The command to rebuild is:
```
bash
```
bash
m4
-P
MachineIndependent/glslang.m4
>
MachineIndependent/glslang.y
bison
--defines
=
MachineIndependent/glslang_tab.cpp.h
bison
--defines
=
MachineIndependent/glslang_tab.cpp.h
-t
MachineIndependent/glslang.y
-t
MachineIndependent/glslang.y
-o
MachineIndependent/glslang_tab.cpp
-o
MachineIndependent/glslang_tab.cpp
```
```
The above command is also available in the bash script at
The above commands are also available in the bash script in
`updateGrammar`
,
`glslang/updateGrammar`
.
when executed from the glslang subdirectory of the glslang repository.
With no arguments it builds the full grammar, and with a "web" argument,
the web grammar subset (see more about the web subset in the next section).
### WASM for the the Web
### WASM for the the Web
Use the steps in
[
Build Steps
](
#build-steps
)
, which following notes/exceptions:
Use the steps in
[
Build Steps
](
#build-steps
)
, which following notes/exceptions:
*
For building the web subset of core glslang:
+
`m4`
also needs a
`-DGLSLANG_WEB`
argument, or simply execute
`updateGrammar web`
from the glslang subdirectory
+
turn off the CMAKE options for
`BUILD_TESTING`
,
`ENABLE_OPT`
, and
`INSTALL_GTEST`
,
while turning on
`ENABLE_GLSLANG_WEB`
*
`emsdk`
needs to be present in your executable search path,
*PATH*
for
*
`emsdk`
needs to be present in your executable search path,
*PATH*
for
Bash-like enivironments
Bash-like enivironments
+
Instructions located
+
Instructions located
...
...
Test/baseResults/spv.specConstant.vert.out
View file @
369ffa95
...
@@ -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[s27
72
];"
Name 14 "foo(vf4[s27
69
];"
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[s27
72
];) 47(param)
49: 2 FunctionCall 14(foo(vf4[s27
69
];) 47(param)
Return
Return
FunctionEnd
FunctionEnd
14(foo(vf4[s27
72
];): 2 Function None 12
14(foo(vf4[s27
69
];): 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 @
369ffa95
...
@@ -107,7 +107,8 @@ const ArgType TypeIU = static_cast<ArgType>(TypeI | TypeU);
...
@@ -107,7 +107,8 @@ const ArgType TypeIU = static_cast<ArgType>(TypeI | TypeU);
// output, or other unusual situations.
// output, or other unusual situations.
enum
ArgClass
{
enum
ArgClass
{
ClassRegular
=
0
,
// nothing special, just all vector widths with matching return type; traditional arithmetic
ClassRegular
=
0
,
// nothing special, just all vector widths with matching return type; traditional arithmetic
ClassLS
=
1
<<
1
,
// the last argument is also held fixed as a (type-matched) scalar while the others cycle
ClassLS
=
1
<<
0
,
// the last argument is also held fixed as a (type-matched) scalar while the others cycle
ClassXLS
=
1
<<
1
,
// the last argument is exclusively a (type-matched) scalar while the others cycle
ClassLS2
=
1
<<
2
,
// the last two arguments are held fixed as a (type-matched) scalar while the others cycle
ClassLS2
=
1
<<
2
,
// the last two arguments are held fixed as a (type-matched) scalar while the others cycle
ClassFS
=
1
<<
3
,
// the first argument is held fixed as a (type-matched) scalar while the others cycle
ClassFS
=
1
<<
3
,
// the first argument is held fixed as a (type-matched) scalar while the others cycle
ClassFS2
=
1
<<
4
,
// the first two arguments are held fixed as a (type-matched) scalar while the others cycle
ClassFS2
=
1
<<
4
,
// the first two arguments are held fixed as a (type-matched) scalar while the others cycle
...
@@ -217,7 +218,7 @@ const BuiltInFunction BaseFunctions[] = {
...
@@ -217,7 +218,7 @@ const BuiltInFunction BaseFunctions[] = {
{
EOpNormalize
,
"normalize"
,
1
,
TypeF
,
ClassRegular
,
nullptr
},
{
EOpNormalize
,
"normalize"
,
1
,
TypeF
,
ClassRegular
,
nullptr
},
{
EOpFaceForward
,
"faceforward"
,
3
,
TypeF
,
ClassRegular
,
nullptr
},
{
EOpFaceForward
,
"faceforward"
,
3
,
TypeF
,
ClassRegular
,
nullptr
},
{
EOpReflect
,
"reflect"
,
2
,
TypeF
,
ClassRegular
,
nullptr
},
{
EOpReflect
,
"reflect"
,
2
,
TypeF
,
ClassRegular
,
nullptr
},
{
EOpRefract
,
"refract"
,
3
,
TypeF
,
Class
LS
,
nullptr
},
{
EOpRefract
,
"refract"
,
3
,
TypeF
,
Class
XLS
,
nullptr
},
{
EOpLength
,
"length"
,
1
,
TypeF
,
ClassRS
,
nullptr
},
{
EOpLength
,
"length"
,
1
,
TypeF
,
ClassRS
,
nullptr
},
{
EOpDistance
,
"distance"
,
2
,
TypeF
,
ClassRS
,
nullptr
},
{
EOpDistance
,
"distance"
,
2
,
TypeF
,
ClassRS
,
nullptr
},
{
EOpDot
,
"dot"
,
2
,
TypeF
,
ClassRS
,
nullptr
},
{
EOpDot
,
"dot"
,
2
,
TypeF
,
ClassRS
,
nullptr
},
...
@@ -286,9 +287,12 @@ void AddTabledBuiltin(TString& decls, const BuiltInFunction& function)
...
@@ -286,9 +287,12 @@ void AddTabledBuiltin(TString& decls, const BuiltInFunction& function)
// loop across these two:
// loop across these two:
// 0: the varying arg set, and
// 0: the varying arg set, and
// 1: the fixed scalar args
// 1: the fixed scalar args
const
ArgClass
ClassFixed
=
(
ArgClass
)(
ClassLS
|
ClassLS2
|
ClassFS
|
ClassFS2
);
const
ArgClass
ClassFixed
=
(
ArgClass
)(
ClassLS
|
Class
XLS
|
Class
LS2
|
ClassFS
|
ClassFS2
);
for
(
int
fixed
=
0
;
fixed
<
((
function
.
classes
&
ClassFixed
)
>
0
?
2
:
1
);
++
fixed
)
{
for
(
int
fixed
=
0
;
fixed
<
((
function
.
classes
&
ClassFixed
)
>
0
?
2
:
1
);
++
fixed
)
{
if
(
fixed
==
0
&&
(
function
.
classes
&
ClassXLS
))
continue
;
// walk the type strings in TypeString[]
// walk the type strings in TypeString[]
for
(
int
type
=
0
;
type
<
TypeStringCount
;
++
type
)
{
for
(
int
type
=
0
;
type
<
TypeStringCount
;
++
type
)
{
// skip types not selected: go from type to row number to type bit
// skip types not selected: go from type to row number to type bit
...
@@ -303,8 +307,8 @@ void AddTabledBuiltin(TString& decls, const BuiltInFunction& function)
...
@@ -303,8 +307,8 @@ void AddTabledBuiltin(TString& decls, const BuiltInFunction& function)
if
((
function
.
classes
&
ClassV3
)
&&
(
type
&
TypeStringColumnMask
)
!=
2
)
if
((
function
.
classes
&
ClassV3
)
&&
(
type
&
TypeStringColumnMask
)
!=
2
)
continue
;
continue
;
// skip replication of all scalars between the varying arg set and the fixed args
// skip replication of all
arg
scalars between the varying arg set and the fixed args
if
(
fixed
==
1
&&
type
==
(
type
&
TypeStringScalarMask
))
if
(
fixed
==
1
&&
type
==
(
type
&
TypeStringScalarMask
)
&&
(
function
.
classes
&
ClassXLS
)
==
0
)
continue
;
continue
;
// skip scalars when we are told to
// skip scalars when we are told to
...
@@ -336,7 +340,8 @@ void AddTabledBuiltin(TString& decls, const BuiltInFunction& function)
...
@@ -336,7 +340,8 @@ void AddTabledBuiltin(TString& decls, const BuiltInFunction& function)
}
}
if
((
function
.
classes
&
ClassLB
)
&&
arg
==
function
.
numArguments
-
1
)
if
((
function
.
classes
&
ClassLB
)
&&
arg
==
function
.
numArguments
-
1
)
decls
.
append
(
TypeString
[
type
&
TypeStringColumnMask
]);
decls
.
append
(
TypeString
[
type
&
TypeStringColumnMask
]);
else
if
(
fixed
&&
((
arg
==
function
.
numArguments
-
1
&&
(
function
.
classes
&
(
ClassLS
|
ClassLS2
)))
||
else
if
(
fixed
&&
((
arg
==
function
.
numArguments
-
1
&&
(
function
.
classes
&
(
ClassLS
|
ClassXLS
|
ClassLS2
)))
||
(
arg
==
function
.
numArguments
-
2
&&
(
function
.
classes
&
ClassLS2
))
||
(
arg
==
function
.
numArguments
-
2
&&
(
function
.
classes
&
ClassLS2
))
||
(
arg
==
0
&&
(
function
.
classes
&
(
ClassFS
|
ClassFS2
)))
||
(
arg
==
0
&&
(
function
.
classes
&
(
ClassFS
|
ClassFS2
)))
||
(
arg
==
1
&&
(
function
.
classes
&
ClassFS2
))))
(
arg
==
1
&&
(
function
.
classes
&
ClassFS2
))))
...
...
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