Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
angle
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
angle
Commits
9754ff4e
Commit
9754ff4e
authored
Aug 19, 2013
by
Zhenyao Mo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support precision for sampler types.
BUG= R=alokp@chromium.org Review URL:
https://codereview.appspot.com/12833045
parent
a6829d57
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
6 deletions
+20
-6
Compiler.cpp
src/compiler/Compiler.cpp
+12
-0
SymbolTable.h
src/compiler/SymbolTable.h
+8
-6
No files found.
src/compiler/Compiler.cpp
View file @
9754ff4e
...
...
@@ -231,6 +231,11 @@ bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources &resources)
floatingPoint
.
matrix
=
false
;
floatingPoint
.
array
=
false
;
TPublicType
sampler
;
sampler
.
size
=
1
;
sampler
.
matrix
=
false
;
sampler
.
array
=
false
;
switch
(
shaderType
)
{
case
SH_FRAGMENT_SHADER
:
...
...
@@ -242,6 +247,13 @@ bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources &resources)
break
;
default
:
assert
(
false
&&
"Language not supported"
);
}
// We set defaults for all the sampler types, even those that are
// only available if an extension exists.
for
(
int
samplerType
=
EbtGuardSamplerBegin
+
1
;
samplerType
<
EbtGuardSamplerEnd
;
++
samplerType
)
{
sampler
.
type
=
static_cast
<
TBasicType
>
(
samplerType
);
symbolTable
.
setDefaultPrecision
(
sampler
,
EbpLow
);
}
InsertBuiltInFunctions
(
shaderType
,
shaderSpec
,
resources
,
symbolTable
);
...
...
src/compiler/SymbolTable.h
View file @
9754ff4e
...
...
@@ -337,10 +337,8 @@ public:
void
dump
(
TInfoSink
&
infoSink
)
const
;
bool
setDefaultPrecision
(
const
TPublicType
&
type
,
TPrecision
prec
)
{
if
(
IsSampler
(
type
.
type
))
return
true
;
// Skip sampler types for the time being
if
(
type
.
type
!=
EbtFloat
&&
type
.
type
!=
EbtInt
)
return
false
;
// Only set default precision for int/float
if
(
!
supportsPrecision
(
type
.
type
))
return
false
;
if
(
type
.
size
!=
1
||
type
.
matrix
||
type
.
array
)
return
false
;
// Not allowed to set for aggregate types
int
indexOfLastElement
=
static_cast
<
int
>
(
precisionStack
.
size
())
-
1
;
...
...
@@ -350,9 +348,8 @@ public:
// Searches down the precisionStack for a precision qualifier for the specified TBasicType
TPrecision
getDefaultPrecision
(
TBasicType
type
)
{
if
(
type
!=
EbtFloat
&&
type
!=
EbtInt
)
if
(
!
supportsPrecision
(
type
)
)
return
EbpUndefined
;
int
level
=
static_cast
<
int
>
(
precisionStack
.
size
())
-
1
;
assert
(
level
>=
0
);
// Just to be safe. Should not happen.
PrecisionStackLevel
::
iterator
it
;
...
...
@@ -371,6 +368,11 @@ public:
private
:
int
currentLevel
()
const
{
return
static_cast
<
int
>
(
table
.
size
())
-
1
;
}
bool
supportsPrecision
(
TBasicType
type
)
{
// Only supports precision for int, float, and sampler types.
return
type
==
EbtFloat
||
type
==
EbtInt
||
IsSampler
(
type
);
}
int
uniqueId
;
// for unique identification in code generation
std
::
vector
<
TSymbolTableLevel
*>
table
;
typedef
TMap
<
TBasicType
,
TPrecision
>
PrecisionStackLevel
;
...
...
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