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
998dd9ff
Commit
998dd9ff
authored
Mar 16, 2010
by
daniel@transgaming.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factor out all operators that are invalid for ES2.
TRAC #11347 Signed-off-by: Daniel Koch git-svn-id:
https://angleproject.googlecode.com/svn/trunk@20
736b8ea6-26fd-11df-bfd4-992fa37f6226
parent
41430498
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
10 additions
and
257 deletions
+10
-257
Initialize.cpp
Compiler/Initialize.cpp
+4
-16
Intermediate.cpp
Compiler/Intermediate.cpp
+0
-86
OutputHLSL.cpp
Compiler/OutputHLSL.cpp
+0
-22
ShaderLang.h
Compiler/ShaderLang.h
+0
-4
glslang.y
Compiler/glslang.y
+2
-73
intermOut.cpp
Compiler/intermOut.cpp
+0
-24
intermediate.h
Compiler/intermediate.h
+4
-32
No files found.
Compiler/Initialize.cpp
View file @
998dd9ff
...
@@ -513,7 +513,6 @@ void IdentifyBuiltIns(EShLanguage language, TSymbolTable& symbolTable)
...
@@ -513,7 +513,6 @@ void IdentifyBuiltIns(EShLanguage language, TSymbolTable& symbolTable)
symbolTable
.
relateToOperator
(
"not"
,
EOpVectorLogicalNot
);
symbolTable
.
relateToOperator
(
"not"
,
EOpVectorLogicalNot
);
symbolTable
.
relateToOperator
(
"matrixCompMult"
,
EOpMul
);
symbolTable
.
relateToOperator
(
"matrixCompMult"
,
EOpMul
);
symbolTable
.
relateToOperator
(
"mod"
,
EOpMod
);
symbolTable
.
relateToOperator
(
"equal"
,
EOpVectorEqual
);
symbolTable
.
relateToOperator
(
"equal"
,
EOpVectorEqual
);
symbolTable
.
relateToOperator
(
"notEqual"
,
EOpVectorNotEqual
);
symbolTable
.
relateToOperator
(
"notEqual"
,
EOpVectorNotEqual
);
...
@@ -544,6 +543,7 @@ void IdentifyBuiltIns(EShLanguage language, TSymbolTable& symbolTable)
...
@@ -544,6 +543,7 @@ void IdentifyBuiltIns(EShLanguage language, TSymbolTable& symbolTable)
symbolTable
.
relateToOperator
(
"floor"
,
EOpFloor
);
symbolTable
.
relateToOperator
(
"floor"
,
EOpFloor
);
symbolTable
.
relateToOperator
(
"ceil"
,
EOpCeil
);
symbolTable
.
relateToOperator
(
"ceil"
,
EOpCeil
);
symbolTable
.
relateToOperator
(
"fract"
,
EOpFract
);
symbolTable
.
relateToOperator
(
"fract"
,
EOpFract
);
symbolTable
.
relateToOperator
(
"mod"
,
EOpMod
);
symbolTable
.
relateToOperator
(
"min"
,
EOpMin
);
symbolTable
.
relateToOperator
(
"min"
,
EOpMin
);
symbolTable
.
relateToOperator
(
"max"
,
EOpMax
);
symbolTable
.
relateToOperator
(
"max"
,
EOpMax
);
symbolTable
.
relateToOperator
(
"clamp"
,
EOpClamp
);
symbolTable
.
relateToOperator
(
"clamp"
,
EOpClamp
);
...
@@ -568,21 +568,9 @@ void IdentifyBuiltIns(EShLanguage language, TSymbolTable& symbolTable)
...
@@ -568,21 +568,9 @@ void IdentifyBuiltIns(EShLanguage language, TSymbolTable& symbolTable)
case
EShLangVertex
:
case
EShLangVertex
:
break
;
break
;
case
EShLangFragment
:
case
EShLangFragment
:
// symbolTable.relateToOperator("dFdx", EOpDPdx);
// symbolTable.relateToOperator("dFdx", EOpDPdx); // OES_standard_derivatives extension
// symbolTable.relateToOperator("dFdy", EOpDPdy);
// symbolTable.relateToOperator("dFdy", EOpDPdy); // OES_standard_derivatives extension
// symbolTable.relateToOperator("fwidth", EOpFwidth);
// symbolTable.relateToOperator("fwidth", EOpFwidth); // OES_standard_derivatives extension
break
;
case
EShLangPack
:
case
EShLangUnpack
:
symbolTable
.
relateToOperator
(
"itof"
,
EOpItof
);
symbolTable
.
relateToOperator
(
"ftoi"
,
EOpFtoi
);
symbolTable
.
relateToOperator
(
"skipPixels"
,
EOpSkipPixels
);
symbolTable
.
relateToOperator
(
"readInput"
,
EOpReadInput
);
symbolTable
.
relateToOperator
(
"writePixel"
,
EOpWritePixel
);
symbolTable
.
relateToOperator
(
"bitmapLSB"
,
EOpBitmapLsb
);
symbolTable
.
relateToOperator
(
"bitmapMSB"
,
EOpBitmapMsb
);
symbolTable
.
relateToOperator
(
"writeOutput"
,
EOpWriteOutput
);
symbolTable
.
relateToOperator
(
"readPixel"
,
EOpReadPixel
);
break
;
break
;
default
:
assert
(
false
&&
"Language not supported"
);
default
:
assert
(
false
&&
"Language not supported"
);
}
}
...
...
Compiler/Intermediate.cpp
View file @
998dd9ff
...
@@ -679,12 +679,6 @@ bool TIntermOperator::modifiesState() const
...
@@ -679,12 +679,6 @@ bool TIntermOperator::modifiesState() const
case
EOpMatrixTimesScalarAssign
:
case
EOpMatrixTimesScalarAssign
:
case
EOpMatrixTimesMatrixAssign
:
case
EOpMatrixTimesMatrixAssign
:
case
EOpDivAssign
:
case
EOpDivAssign
:
case
EOpModAssign
:
case
EOpAndAssign
:
case
EOpInclusiveOrAssign
:
case
EOpExclusiveOrAssign
:
case
EOpLeftShiftAssign
:
case
EOpRightShiftAssign
:
return
true
;
return
true
;
default
:
default
:
return
false
;
return
false
;
...
@@ -731,10 +725,6 @@ bool TIntermUnary::promote(TInfoSink&)
...
@@ -731,10 +725,6 @@ bool TIntermUnary::promote(TInfoSink&)
if
(
operand
->
getBasicType
()
!=
EbtBool
)
if
(
operand
->
getBasicType
()
!=
EbtBool
)
return
false
;
return
false
;
break
;
break
;
case
EOpBitwiseNot
:
if
(
operand
->
getBasicType
()
!=
EbtInt
)
return
false
;
break
;
case
EOpNegative
:
case
EOpNegative
:
case
EOpPostIncrement
:
case
EOpPostIncrement
:
case
EOpPostDecrement
:
case
EOpPostDecrement
:
...
@@ -847,28 +837,6 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
...
@@ -847,28 +837,6 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
break
;
break
;
//
//
// Check for integer only operands.
//
case
EOpMod
:
case
EOpRightShift
:
case
EOpLeftShift
:
case
EOpAnd
:
case
EOpInclusiveOr
:
case
EOpExclusiveOr
:
if
(
left
->
getBasicType
()
!=
EbtInt
||
right
->
getBasicType
()
!=
EbtInt
)
return
false
;
break
;
case
EOpModAssign
:
case
EOpAndAssign
:
case
EOpInclusiveOrAssign
:
case
EOpExclusiveOrAssign
:
case
EOpLeftShiftAssign
:
case
EOpRightShiftAssign
:
if
(
left
->
getBasicType
()
!=
EbtInt
||
right
->
getBasicType
()
!=
EbtInt
)
return
false
;
// fall through
//
// Everything else should have matching types
// Everything else should have matching types
//
//
default
:
default
:
...
@@ -957,11 +925,9 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
...
@@ -957,11 +925,9 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
case
EOpAdd
:
case
EOpAdd
:
case
EOpSub
:
case
EOpSub
:
case
EOpDiv
:
case
EOpDiv
:
case
EOpMod
:
case
EOpAddAssign
:
case
EOpAddAssign
:
case
EOpSubAssign
:
case
EOpSubAssign
:
case
EOpDivAssign
:
case
EOpDivAssign
:
case
EOpModAssign
:
if
(
left
->
isMatrix
()
&&
right
->
isVector
()
||
if
(
left
->
isMatrix
()
&&
right
->
isVector
()
||
left
->
isVector
()
&&
right
->
isMatrix
()
||
left
->
isVector
()
&&
right
->
isMatrix
()
||
left
->
getBasicType
()
!=
right
->
getBasicType
())
left
->
getBasicType
()
!=
right
->
getBasicType
())
...
@@ -996,12 +962,6 @@ default:
...
@@ -996,12 +962,6 @@ default:
case
EOpSubAssign
:
case
EOpSubAssign
:
case
EOpMulAssign
:
case
EOpMulAssign
:
case
EOpDivAssign
:
case
EOpDivAssign
:
case
EOpModAssign
:
case
EOpAndAssign
:
case
EOpInclusiveOrAssign
:
case
EOpExclusiveOrAssign
:
case
EOpLeftShiftAssign
:
case
EOpRightShiftAssign
:
if
(
getType
()
!=
left
->
getType
())
if
(
getType
()
!=
left
->
getType
())
return
false
;
return
false
;
break
;
break
;
...
@@ -1200,52 +1160,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
...
@@ -1200,52 +1160,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
}
}
break
;
break
;
case
EOpMod
:
tempConstArray
=
new
constUnion
[
objectSize
];
{
// support MSVC++6.0
for
(
int
i
=
0
;
i
<
objectSize
;
i
++
)
tempConstArray
[
i
]
=
unionArray
[
i
]
%
rightUnionArray
[
i
];
}
break
;
case
EOpRightShift
:
tempConstArray
=
new
constUnion
[
objectSize
];
{
// support MSVC++6.0
for
(
int
i
=
0
;
i
<
objectSize
;
i
++
)
tempConstArray
[
i
]
=
unionArray
[
i
]
>>
rightUnionArray
[
i
];
}
break
;
case
EOpLeftShift
:
tempConstArray
=
new
constUnion
[
objectSize
];
{
// support MSVC++6.0
for
(
int
i
=
0
;
i
<
objectSize
;
i
++
)
tempConstArray
[
i
]
=
unionArray
[
i
]
<<
rightUnionArray
[
i
];
}
break
;
case
EOpAnd
:
tempConstArray
=
new
constUnion
[
objectSize
];
{
// support MSVC++6.0
for
(
int
i
=
0
;
i
<
objectSize
;
i
++
)
tempConstArray
[
i
]
=
unionArray
[
i
]
&
rightUnionArray
[
i
];
}
break
;
case
EOpInclusiveOr
:
tempConstArray
=
new
constUnion
[
objectSize
];
{
// support MSVC++6.0
for
(
int
i
=
0
;
i
<
objectSize
;
i
++
)
tempConstArray
[
i
]
=
unionArray
[
i
]
|
rightUnionArray
[
i
];
}
break
;
case
EOpExclusiveOr
:
tempConstArray
=
new
constUnion
[
objectSize
];
{
// support MSVC++6.0
for
(
int
i
=
0
;
i
<
objectSize
;
i
++
)
tempConstArray
[
i
]
=
unionArray
[
i
]
^
rightUnionArray
[
i
];
}
break
;
case
EOpLogicalAnd
:
// this code is written for possible future use, will not get executed currently
case
EOpLogicalAnd
:
// this code is written for possible future use, will not get executed currently
tempConstArray
=
new
constUnion
[
objectSize
];
tempConstArray
=
new
constUnion
[
objectSize
];
{
// support MSVC++6.0
{
// support MSVC++6.0
...
...
Compiler/OutputHLSL.cpp
View file @
998dd9ff
...
@@ -406,12 +406,6 @@ bool OutputHLSL::visitBinary(Visit visit, TIntermBinary *node)
...
@@ -406,12 +406,6 @@ bool OutputHLSL::visitBinary(Visit visit, TIntermBinary *node)
case
EOpMatrixTimesScalarAssign
:
UNIMPLEMENTED
();
/* FIXME */
out
<<
"matrix scale second child into first child"
;
break
;
case
EOpMatrixTimesScalarAssign
:
UNIMPLEMENTED
();
/* FIXME */
out
<<
"matrix scale second child into first child"
;
break
;
case
EOpMatrixTimesMatrixAssign
:
UNIMPLEMENTED
();
/* FIXME */
out
<<
"matrix mult second child into first child"
;
break
;
case
EOpMatrixTimesMatrixAssign
:
UNIMPLEMENTED
();
/* FIXME */
out
<<
"matrix mult second child into first child"
;
break
;
case
EOpDivAssign
:
outputTriplet
(
visit
,
NULL
,
" /= "
,
NULL
);
break
;
case
EOpDivAssign
:
outputTriplet
(
visit
,
NULL
,
" /= "
,
NULL
);
break
;
case
EOpModAssign
:
UNIMPLEMENTED
();
/* FIXME */
out
<<
"mod second child into first child"
;
break
;
case
EOpAndAssign
:
UNIMPLEMENTED
();
/* FIXME */
out
<<
"and second child into first child"
;
break
;
case
EOpInclusiveOrAssign
:
UNIMPLEMENTED
();
/* FIXME */
out
<<
"or second child into first child"
;
break
;
case
EOpExclusiveOrAssign
:
UNIMPLEMENTED
();
/* FIXME */
out
<<
"exclusive or second child into first child"
;
break
;
case
EOpLeftShiftAssign
:
UNIMPLEMENTED
();
/* FIXME */
out
<<
"left shift second child into first child"
;
break
;
case
EOpRightShiftAssign
:
UNIMPLEMENTED
();
/* FIXME */
out
<<
"right shift second child into first child"
;
break
;
case
EOpIndexDirect
:
outputTriplet
(
visit
,
NULL
,
"["
,
"]"
);
break
;
case
EOpIndexDirect
:
outputTriplet
(
visit
,
NULL
,
"["
,
"]"
);
break
;
case
EOpIndexIndirect
:
outputTriplet
(
visit
,
NULL
,
"["
,
"]"
);
break
;
case
EOpIndexIndirect
:
outputTriplet
(
visit
,
NULL
,
"["
,
"]"
);
break
;
case
EOpIndexDirectStruct
:
outputTriplet
(
visit
,
NULL
,
"."
,
NULL
);
break
;
case
EOpIndexDirectStruct
:
outputTriplet
(
visit
,
NULL
,
"."
,
NULL
);
break
;
...
@@ -455,12 +449,6 @@ bool OutputHLSL::visitBinary(Visit visit, TIntermBinary *node)
...
@@ -455,12 +449,6 @@ bool OutputHLSL::visitBinary(Visit visit, TIntermBinary *node)
case
EOpSub
:
outputTriplet
(
visit
,
"("
,
" - "
,
")"
);
break
;
case
EOpSub
:
outputTriplet
(
visit
,
"("
,
" - "
,
")"
);
break
;
case
EOpMul
:
outputTriplet
(
visit
,
"("
,
" * "
,
")"
);
break
;
case
EOpMul
:
outputTriplet
(
visit
,
"("
,
" * "
,
")"
);
break
;
case
EOpDiv
:
outputTriplet
(
visit
,
"("
,
" / "
,
")"
);
break
;
case
EOpDiv
:
outputTriplet
(
visit
,
"("
,
" / "
,
")"
);
break
;
case
EOpMod
:
UNIMPLEMENTED
();
/* FIXME */
out
<<
"mod"
;
break
;
case
EOpRightShift
:
UNIMPLEMENTED
();
/* FIXME */
out
<<
"right-shift"
;
break
;
case
EOpLeftShift
:
UNIMPLEMENTED
();
/* FIXME */
out
<<
"left-shift"
;
break
;
case
EOpAnd
:
UNIMPLEMENTED
();
/* FIXME */
out
<<
"bitwise and"
;
break
;
case
EOpInclusiveOr
:
UNIMPLEMENTED
();
/* FIXME */
out
<<
"inclusive-or"
;
break
;
case
EOpExclusiveOr
:
UNIMPLEMENTED
();
/* FIXME */
out
<<
"exclusive-or"
;
break
;
case
EOpEqual
:
outputTriplet
(
visit
,
"("
,
" == "
,
")"
);
break
;
case
EOpEqual
:
outputTriplet
(
visit
,
"("
,
" == "
,
")"
);
break
;
case
EOpNotEqual
:
outputTriplet
(
visit
,
"("
,
" != "
,
")"
);
break
;
case
EOpNotEqual
:
outputTriplet
(
visit
,
"("
,
" != "
,
")"
);
break
;
case
EOpLessThan
:
outputTriplet
(
visit
,
"("
,
" < "
,
")"
);
break
;
case
EOpLessThan
:
outputTriplet
(
visit
,
"("
,
" < "
,
")"
);
break
;
...
@@ -490,7 +478,6 @@ bool OutputHLSL::visitUnary(Visit visit, TIntermUnary *node)
...
@@ -490,7 +478,6 @@ bool OutputHLSL::visitUnary(Visit visit, TIntermUnary *node)
case
EOpNegative
:
outputTriplet
(
visit
,
"(-"
,
NULL
,
")"
);
break
;
case
EOpNegative
:
outputTriplet
(
visit
,
"(-"
,
NULL
,
")"
);
break
;
case
EOpVectorLogicalNot
:
outputTriplet
(
visit
,
"(!"
,
NULL
,
")"
);
break
;
case
EOpVectorLogicalNot
:
outputTriplet
(
visit
,
"(!"
,
NULL
,
")"
);
break
;
case
EOpLogicalNot
:
outputTriplet
(
visit
,
"(!"
,
NULL
,
")"
);
break
;
case
EOpLogicalNot
:
outputTriplet
(
visit
,
"(!"
,
NULL
,
")"
);
break
;
case
EOpBitwiseNot
:
outputTriplet
(
visit
,
"(~"
,
NULL
,
")"
);
break
;
case
EOpPostIncrement
:
outputTriplet
(
visit
,
"("
,
NULL
,
"++)"
);
break
;
case
EOpPostIncrement
:
outputTriplet
(
visit
,
"("
,
NULL
,
"++)"
);
break
;
case
EOpPostDecrement
:
outputTriplet
(
visit
,
"("
,
NULL
,
"--)"
);
break
;
case
EOpPostDecrement
:
outputTriplet
(
visit
,
"("
,
NULL
,
"--)"
);
break
;
case
EOpPreIncrement
:
outputTriplet
(
visit
,
"(++"
,
NULL
,
")"
);
break
;
case
EOpPreIncrement
:
outputTriplet
(
visit
,
"(++"
,
NULL
,
")"
);
break
;
...
@@ -881,15 +868,6 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
...
@@ -881,15 +868,6 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
case
EOpReflect
:
outputTriplet
(
visit
,
"reflect("
,
", "
,
")"
);
break
;
case
EOpReflect
:
outputTriplet
(
visit
,
"reflect("
,
", "
,
")"
);
break
;
case
EOpRefract
:
outputTriplet
(
visit
,
"refract("
,
", "
,
")"
);
break
;
case
EOpRefract
:
outputTriplet
(
visit
,
"refract("
,
", "
,
")"
);
break
;
case
EOpMul
:
outputTriplet
(
visit
,
"("
,
" * "
,
")"
);
break
;
case
EOpMul
:
outputTriplet
(
visit
,
"("
,
" * "
,
")"
);
break
;
case
EOpItof
:
UNIMPLEMENTED
();
/* FIXME */
out
<<
"itof"
;
break
;
case
EOpFtoi
:
UNIMPLEMENTED
();
/* FIXME */
out
<<
"ftoi"
;
break
;
case
EOpSkipPixels
:
UNIMPLEMENTED
();
/* FIXME */
out
<<
"skipPixels"
;
break
;
case
EOpReadInput
:
UNIMPLEMENTED
();
/* FIXME */
out
<<
"readInput"
;
break
;
case
EOpWritePixel
:
UNIMPLEMENTED
();
/* FIXME */
out
<<
"writePixel"
;
break
;
case
EOpBitmapLsb
:
UNIMPLEMENTED
();
/* FIXME */
out
<<
"bitmapLSB"
;
break
;
case
EOpBitmapMsb
:
UNIMPLEMENTED
();
/* FIXME */
out
<<
"bitmapMSB"
;
break
;
case
EOpWriteOutput
:
UNIMPLEMENTED
();
/* FIXME */
out
<<
"writeOutput"
;
break
;
case
EOpReadPixel
:
UNIMPLEMENTED
();
/* FIXME */
out
<<
"readPixel"
;
break
;
default
:
UNREACHABLE
();
default
:
UNREACHABLE
();
}
}
...
...
Compiler/ShaderLang.h
View file @
998dd9ff
...
@@ -38,8 +38,6 @@ int __fastcall ShFinalize();
...
@@ -38,8 +38,6 @@ int __fastcall ShFinalize();
typedef
enum
{
typedef
enum
{
EShLangVertex
,
EShLangVertex
,
EShLangFragment
,
EShLangFragment
,
EShLangPack
,
EShLangUnpack
,
EShLangCount
,
EShLangCount
,
}
EShLanguage
;
}
EShLanguage
;
...
@@ -48,8 +46,6 @@ typedef enum {
...
@@ -48,8 +46,6 @@ typedef enum {
//
//
typedef
enum
{
typedef
enum
{
EShExVertexFragment
,
EShExVertexFragment
,
EShExPackFragment
,
EShExUnpackFragment
,
EShExFragment
EShExFragment
}
EShExecutable
;
}
EShExecutable
;
...
...
Compiler/glslang.y
View file @
998dd9ff
...
@@ -474,16 +474,8 @@ function_call
...
@@ -474,16 +474,8 @@ function_call
TFunction* fnCall = $1.function;
TFunction* fnCall = $1.function;
TOperator op = fnCall->getBuiltInOp();
TOperator op = fnCall->getBuiltInOp();
if (op == EOpArrayLength) {
if (op != EOpNull)
if ($1.intermNode->getAsTyped() == 0 || $1.intermNode->getAsTyped()->getType().getArraySize() == 0) {
{
parseContext.error($1.line, "", fnCall->getName().c_str(), "array must be declared with a size before using this method");
parseContext.recover();
}
constUnion *unionArray = new constUnion[1];
unionArray->setIConst($1.intermNode->getAsTyped()->getType().getArraySize());
$$ = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), $1.line);
} else if (op != EOpNull) {
//
//
// Then this should be a constructor.
// Then this should be a constructor.
// Don't go through the symbol table for constructors.
// Don't go through the symbol table for constructors.
...
@@ -744,7 +736,6 @@ unary_expression
...
@@ -744,7 +736,6 @@ unary_expression
switch($1.op) {
switch($1.op) {
case EOpNegative: errorOp = "-"; break;
case EOpNegative: errorOp = "-"; break;
case EOpLogicalNot: errorOp = "!"; break;
case EOpLogicalNot: errorOp = "!"; break;
case EOpBitwiseNot: errorOp = "~"; break;
default: break;
default: break;
}
}
parseContext.unaryOpError($1.line, errorOp, $2->getCompleteString());
parseContext.unaryOpError($1.line, errorOp, $2->getCompleteString());
...
@@ -761,8 +752,6 @@ unary_operator
...
@@ -761,8 +752,6 @@ unary_operator
: PLUS { $$.line = $1.line; $$.op = EOpNull; }
: PLUS { $$.line = $1.line; $$.op = EOpNull; }
| DASH { $$.line = $1.line; $$.op = EOpNegative; }
| DASH { $$.line = $1.line; $$.op = EOpNegative; }
| BANG { $$.line = $1.line; $$.op = EOpLogicalNot; }
| BANG { $$.line = $1.line; $$.op = EOpLogicalNot; }
| TILDE { PACK_UNPACK_ONLY("~", $1.line);
$$.line = $1.line; $$.op = EOpBitwiseNot; }
;
;
// Grammar Note: No '*' or '&' unary ops. Pointers are not supported.
// Grammar Note: No '*' or '&' unary ops. Pointers are not supported.
...
@@ -786,15 +775,6 @@ multiplicative_expression
...
@@ -786,15 +775,6 @@ multiplicative_expression
$$ = $1;
$$ = $1;
}
}
}
}
| multiplicative_expression PERCENT unary_expression {
PACK_UNPACK_ONLY("%", $2.line);
$$ = parseContext.intermediate.addBinaryMath(EOpMod, $1, $3, $2.line, parseContext.symbolTable);
if ($$ == 0) {
parseContext.binaryOpError($2.line, "%", $1->getCompleteString(), $3->getCompleteString());
parseContext.recover();
$$ = $1;
}
}
;
;
additive_expression
additive_expression
...
@@ -819,24 +799,6 @@ additive_expression
...
@@ -819,24 +799,6 @@ additive_expression
shift_expression
shift_expression
: additive_expression { $$ = $1; }
: additive_expression { $$ = $1; }
| shift_expression LEFT_OP additive_expression {
PACK_UNPACK_ONLY("<<", $2.line);
$$ = parseContext.intermediate.addBinaryMath(EOpLeftShift, $1, $3, $2.line, parseContext.symbolTable);
if ($$ == 0) {
parseContext.binaryOpError($2.line, "<<", $1->getCompleteString(), $3->getCompleteString());
parseContext.recover();
$$ = $1;
}
}
| shift_expression RIGHT_OP additive_expression {
PACK_UNPACK_ONLY(">>", $2.line);
$$ = parseContext.intermediate.addBinaryMath(EOpRightShift, $1, $3, $2.line, parseContext.symbolTable);
if ($$ == 0) {
parseContext.binaryOpError($2.line, ">>", $1->getCompleteString(), $3->getCompleteString());
parseContext.recover();
$$ = $1;
}
}
;
;
relational_expression
relational_expression
...
@@ -911,41 +873,14 @@ equality_expression
...
@@ -911,41 +873,14 @@ equality_expression
and_expression
and_expression
: equality_expression { $$ = $1; }
: equality_expression { $$ = $1; }
| and_expression AMPERSAND equality_expression {
PACK_UNPACK_ONLY("&", $2.line);
$$ = parseContext.intermediate.addBinaryMath(EOpAnd, $1, $3, $2.line, parseContext.symbolTable);
if ($$ == 0) {
parseContext.binaryOpError($2.line, "&", $1->getCompleteString(), $3->getCompleteString());
parseContext.recover();
$$ = $1;
}
}
;
;
exclusive_or_expression
exclusive_or_expression
: and_expression { $$ = $1; }
: and_expression { $$ = $1; }
| exclusive_or_expression CARET and_expression {
PACK_UNPACK_ONLY("^", $2.line);
$$ = parseContext.intermediate.addBinaryMath(EOpExclusiveOr, $1, $3, $2.line, parseContext.symbolTable);
if ($$ == 0) {
parseContext.binaryOpError($2.line, "^", $1->getCompleteString(), $3->getCompleteString());
parseContext.recover();
$$ = $1;
}
}
;
;
inclusive_or_expression
inclusive_or_expression
: exclusive_or_expression { $$ = $1; }
: exclusive_or_expression { $$ = $1; }
| inclusive_or_expression VERTICAL_BAR exclusive_or_expression {
PACK_UNPACK_ONLY("|", $2.line);
$$ = parseContext.intermediate.addBinaryMath(EOpInclusiveOr, $1, $3, $2.line, parseContext.symbolTable);
if ($$ == 0) {
parseContext.binaryOpError($2.line, "|", $1->getCompleteString(), $3->getCompleteString());
parseContext.recover();
$$ = $1;
}
}
;
;
logical_and_expression
logical_and_expression
...
@@ -1027,14 +962,8 @@ assignment_operator
...
@@ -1027,14 +962,8 @@ assignment_operator
: EQUAL { $$.line = $1.line; $$.op = EOpAssign; }
: EQUAL { $$.line = $1.line; $$.op = EOpAssign; }
| MUL_ASSIGN { FRAG_VERT_ONLY("*=", $1.line); $$.line = $1.line; $$.op = EOpMulAssign; }
| MUL_ASSIGN { FRAG_VERT_ONLY("*=", $1.line); $$.line = $1.line; $$.op = EOpMulAssign; }
| DIV_ASSIGN { FRAG_VERT_ONLY("/=", $1.line); $$.line = $1.line; $$.op = EOpDivAssign; }
| DIV_ASSIGN { FRAG_VERT_ONLY("/=", $1.line); $$.line = $1.line; $$.op = EOpDivAssign; }
| MOD_ASSIGN { PACK_UNPACK_ONLY("%=", $1.line); $$.line = $1.line; $$.op = EOpModAssign; }
| ADD_ASSIGN { $$.line = $1.line; $$.op = EOpAddAssign; }
| ADD_ASSIGN { $$.line = $1.line; $$.op = EOpAddAssign; }
| SUB_ASSIGN { $$.line = $1.line; $$.op = EOpSubAssign; }
| SUB_ASSIGN { $$.line = $1.line; $$.op = EOpSubAssign; }
| LEFT_ASSIGN { PACK_UNPACK_ONLY("<<=", $1.line); $$.line = $1.line; $$.op = EOpLeftShiftAssign; }
| RIGHT_ASSIGN { PACK_UNPACK_ONLY("<<=", $1.line); $$.line = $1.line; $$.op = EOpRightShiftAssign; }
| AND_ASSIGN { PACK_UNPACK_ONLY("&=", $1.line); $$.line = $1.line; $$.op = EOpAndAssign; }
| XOR_ASSIGN { PACK_UNPACK_ONLY("^=", $1.line); $$.line = $1.line; $$.op = EOpExclusiveOrAssign; }
| OR_ASSIGN { PACK_UNPACK_ONLY("|=", $1.line); $$.line = $1.line; $$.op = EOpInclusiveOrAssign; }
;
;
expression
expression
...
...
Compiler/intermOut.cpp
View file @
998dd9ff
...
@@ -105,13 +105,6 @@ bool TOutputTraverser::visitBinary(Visit visit, TIntermBinary* node)
...
@@ -105,13 +105,6 @@ bool TOutputTraverser::visitBinary(Visit visit, TIntermBinary* node)
case
EOpMatrixTimesScalarAssign
:
out
.
debug
<<
"matrix scale second child into first child"
;
break
;
case
EOpMatrixTimesScalarAssign
:
out
.
debug
<<
"matrix scale second child into first child"
;
break
;
case
EOpMatrixTimesMatrixAssign
:
out
.
debug
<<
"matrix mult second child into first child"
;
break
;
case
EOpMatrixTimesMatrixAssign
:
out
.
debug
<<
"matrix mult second child into first child"
;
break
;
case
EOpDivAssign
:
out
.
debug
<<
"divide second child into first child"
;
break
;
case
EOpDivAssign
:
out
.
debug
<<
"divide second child into first child"
;
break
;
case
EOpModAssign
:
out
.
debug
<<
"mod second child into first child"
;
break
;
case
EOpAndAssign
:
out
.
debug
<<
"and second child into first child"
;
break
;
case
EOpInclusiveOrAssign
:
out
.
debug
<<
"or second child into first child"
;
break
;
case
EOpExclusiveOrAssign
:
out
.
debug
<<
"exclusive or second child into first child"
;
break
;
case
EOpLeftShiftAssign
:
out
.
debug
<<
"left shift second child into first child"
;
break
;
case
EOpRightShiftAssign
:
out
.
debug
<<
"right shift second child into first child"
;
break
;
case
EOpIndexDirect
:
out
.
debug
<<
"direct index"
;
break
;
case
EOpIndexDirect
:
out
.
debug
<<
"direct index"
;
break
;
case
EOpIndexIndirect
:
out
.
debug
<<
"indirect index"
;
break
;
case
EOpIndexIndirect
:
out
.
debug
<<
"indirect index"
;
break
;
case
EOpIndexDirectStruct
:
out
.
debug
<<
"direct index for structure"
;
break
;
case
EOpIndexDirectStruct
:
out
.
debug
<<
"direct index for structure"
;
break
;
...
@@ -121,12 +114,6 @@ bool TOutputTraverser::visitBinary(Visit visit, TIntermBinary* node)
...
@@ -121,12 +114,6 @@ bool TOutputTraverser::visitBinary(Visit visit, TIntermBinary* node)
case
EOpSub
:
out
.
debug
<<
"subtract"
;
break
;
case
EOpSub
:
out
.
debug
<<
"subtract"
;
break
;
case
EOpMul
:
out
.
debug
<<
"component-wise multiply"
;
break
;
case
EOpMul
:
out
.
debug
<<
"component-wise multiply"
;
break
;
case
EOpDiv
:
out
.
debug
<<
"divide"
;
break
;
case
EOpDiv
:
out
.
debug
<<
"divide"
;
break
;
case
EOpMod
:
out
.
debug
<<
"mod"
;
break
;
case
EOpRightShift
:
out
.
debug
<<
"right-shift"
;
break
;
case
EOpLeftShift
:
out
.
debug
<<
"left-shift"
;
break
;
case
EOpAnd
:
out
.
debug
<<
"bitwise and"
;
break
;
case
EOpInclusiveOr
:
out
.
debug
<<
"inclusive-or"
;
break
;
case
EOpExclusiveOr
:
out
.
debug
<<
"exclusive-or"
;
break
;
case
EOpEqual
:
out
.
debug
<<
"Compare Equal"
;
break
;
case
EOpEqual
:
out
.
debug
<<
"Compare Equal"
;
break
;
case
EOpNotEqual
:
out
.
debug
<<
"Compare Not Equal"
;
break
;
case
EOpNotEqual
:
out
.
debug
<<
"Compare Not Equal"
;
break
;
case
EOpLessThan
:
out
.
debug
<<
"Compare Less Than"
;
break
;
case
EOpLessThan
:
out
.
debug
<<
"Compare Less Than"
;
break
;
...
@@ -163,7 +150,6 @@ bool TOutputTraverser::visitUnary(Visit visit, TIntermUnary* node)
...
@@ -163,7 +150,6 @@ bool TOutputTraverser::visitUnary(Visit visit, TIntermUnary* node)
case
EOpNegative
:
out
.
debug
<<
"Negate value"
;
break
;
case
EOpNegative
:
out
.
debug
<<
"Negate value"
;
break
;
case
EOpVectorLogicalNot
:
case
EOpVectorLogicalNot
:
case
EOpLogicalNot
:
out
.
debug
<<
"Negate conditional"
;
break
;
case
EOpLogicalNot
:
out
.
debug
<<
"Negate conditional"
;
break
;
case
EOpBitwiseNot
:
out
.
debug
<<
"Bitwise not"
;
break
;
case
EOpPostIncrement
:
out
.
debug
<<
"Post-Increment"
;
break
;
case
EOpPostIncrement
:
out
.
debug
<<
"Post-Increment"
;
break
;
case
EOpPostDecrement
:
out
.
debug
<<
"Post-Decrement"
;
break
;
case
EOpPostDecrement
:
out
.
debug
<<
"Post-Decrement"
;
break
;
...
@@ -280,16 +266,6 @@ bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate* node)
...
@@ -280,16 +266,6 @@ bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate* node)
case
EOpRefract
:
out
.
debug
<<
"refract"
;
break
;
case
EOpRefract
:
out
.
debug
<<
"refract"
;
break
;
case
EOpMul
:
out
.
debug
<<
"component-wise multiply"
;
break
;
case
EOpMul
:
out
.
debug
<<
"component-wise multiply"
;
break
;
case
EOpItof
:
out
.
debug
<<
"itof"
;
break
;
case
EOpFtoi
:
out
.
debug
<<
"ftoi"
;
break
;
case
EOpSkipPixels
:
out
.
debug
<<
"skipPixels"
;
break
;
case
EOpReadInput
:
out
.
debug
<<
"readInput"
;
break
;
case
EOpWritePixel
:
out
.
debug
<<
"writePixel"
;
break
;
case
EOpBitmapLsb
:
out
.
debug
<<
"bitmapLSB"
;
break
;
case
EOpBitmapMsb
:
out
.
debug
<<
"bitmapMSB"
;
break
;
case
EOpWriteOutput
:
out
.
debug
<<
"writeOutput"
;
break
;
case
EOpReadPixel
:
out
.
debug
<<
"readPixel"
;
break
;
default
:
out
.
debug
.
message
(
EPrefixError
,
"Bad aggregation op"
);
default
:
out
.
debug
.
message
(
EPrefixError
,
"Bad aggregation op"
);
}
}
...
...
Compiler/intermediate.h
View file @
998dd9ff
...
@@ -38,7 +38,6 @@ enum TOperator {
...
@@ -38,7 +38,6 @@ enum TOperator {
EOpNegative
,
EOpNegative
,
EOpLogicalNot
,
EOpLogicalNot
,
EOpVectorLogicalNot
,
EOpVectorLogicalNot
,
EOpBitwiseNot
,
EOpPostIncrement
,
EOpPostIncrement
,
EOpPostDecrement
,
EOpPostDecrement
,
...
@@ -60,12 +59,6 @@ enum TOperator {
...
@@ -60,12 +59,6 @@ enum TOperator {
EOpSub
,
EOpSub
,
EOpMul
,
EOpMul
,
EOpDiv
,
EOpDiv
,
EOpMod
,
EOpRightShift
,
EOpLeftShift
,
EOpAnd
,
EOpInclusiveOr
,
EOpExclusiveOr
,
EOpEqual
,
EOpEqual
,
EOpNotEqual
,
EOpNotEqual
,
EOpVectorEqual
,
EOpVectorEqual
,
...
@@ -117,6 +110,7 @@ enum TOperator {
...
@@ -117,6 +110,7 @@ enum TOperator {
EOpFloor
,
EOpFloor
,
EOpCeil
,
EOpCeil
,
EOpFract
,
EOpFract
,
EOpMod
,
EOpMin
,
EOpMin
,
EOpMax
,
EOpMax
,
EOpClamp
,
EOpClamp
,
...
@@ -133,25 +127,15 @@ enum TOperator {
...
@@ -133,25 +127,15 @@ enum TOperator {
EOpReflect
,
EOpReflect
,
EOpRefract
,
EOpRefract
,
// EOpDPdx, // Fragment only
// EOpDPdx, // Fragment only
, OES_standard_derivatives extension
// EOpDPdy, // Fragment only
// EOpDPdy, // Fragment only
, OES_standard_derivatives extension
// EOpFwidth, // Fragment only
// EOpFwidth, // Fragment only
, OES_standard_derivatives extension
EOpMatrixTimesMatrix
,
EOpMatrixTimesMatrix
,
EOpAny
,
EOpAny
,
EOpAll
,
EOpAll
,
EOpItof
,
// pack/unpack only
EOpFtoi
,
// pack/unpack only
EOpSkipPixels
,
// pack/unpack only
EOpReadInput
,
// unpack only
EOpWritePixel
,
// unpack only
EOpBitmapLsb
,
// unpack only
EOpBitmapMsb
,
// unpack only
EOpWriteOutput
,
// pack only
EOpReadPixel
,
// pack only
//
//
// Branch
// Branch
//
//
...
@@ -196,18 +180,6 @@ enum TOperator {
...
@@ -196,18 +180,6 @@ enum TOperator {
EOpMatrixTimesScalarAssign
,
EOpMatrixTimesScalarAssign
,
EOpMatrixTimesMatrixAssign
,
EOpMatrixTimesMatrixAssign
,
EOpDivAssign
,
EOpDivAssign
,
EOpModAssign
,
EOpAndAssign
,
EOpInclusiveOrAssign
,
EOpExclusiveOrAssign
,
EOpLeftShiftAssign
,
EOpRightShiftAssign
,
//
// Array operators
//
EOpArrayLength
,
};
};
class
TIntermTraverser
;
class
TIntermTraverser
;
...
...
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