Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Suyu
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
many-archive
Suyu
Commits
c96da976
There was an error fetching the commit references. Please try again later.
Commit
c96da976
authored
6 years ago
by
bunnei
Browse files
Options
Downloads
Patches
Plain Diff
gl_shader_decompiler: Implement predicate NotEqualWithNan.
parent
50ef2beb
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/video_core/engines/shader_bytecode.h
+1
-0
1 addition, 0 deletions
src/video_core/engines/shader_bytecode.h
src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+23
-17
23 additions, 17 deletions
src/video_core/renderer_opengl/gl_shader_decompiler.cpp
with
24 additions
and
17 deletions
src/video_core/engines/shader_bytecode.h
+
1
−
0
View file @
c96da976
...
@@ -142,6 +142,7 @@ enum class PredCondition : u64 {
...
@@ -142,6 +142,7 @@ enum class PredCondition : u64 {
GreaterThan
=
4
,
GreaterThan
=
4
,
NotEqual
=
5
,
NotEqual
=
5
,
GreaterEqual
=
6
,
GreaterEqual
=
6
,
NotEqualWithNan
=
13
,
// TODO(Subv): Other condition types
// TODO(Subv): Other condition types
};
};
...
...
This diff is collapsed.
Click to expand it.
src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+
23
−
17
View file @
c96da976
...
@@ -719,21 +719,31 @@ private:
...
@@ -719,21 +719,31 @@ private:
/**
/**
* Returns the comparison string to use to compare two values in the 'set' family of
* Returns the comparison string to use to compare two values in the 'set' family of
* instructions.
* instructions.
* @params condition The condition used in the 'set'-family instruction.
* @param condition The condition used in the 'set'-family instruction.
* @param op_a First operand to use for the comparison.
* @param op_b Second operand to use for the comparison.
* @returns String corresponding to the GLSL operator that matches the desired comparison.
* @returns String corresponding to the GLSL operator that matches the desired comparison.
*/
*/
std
::
string
GetPredicateComparison
(
Tegra
::
Shader
::
PredCondition
condition
)
const
{
std
::
string
GetPredicateComparison
(
Tegra
::
Shader
::
PredCondition
condition
,
const
std
::
string
&
op_a
,
const
std
::
string
&
op_b
)
const
{
using
Tegra
::
Shader
::
PredCondition
;
using
Tegra
::
Shader
::
PredCondition
;
static
const
std
::
unordered_map
<
PredCondition
,
const
char
*>
PredicateComparisonStrings
=
{
static
const
std
::
unordered_map
<
PredCondition
,
const
char
*>
PredicateComparisonStrings
=
{
{
PredCondition
::
LessThan
,
"<"
},
{
PredCondition
::
Equal
,
"=="
},
{
PredCondition
::
LessThan
,
"<"
},
{
PredCondition
::
Equal
,
"=="
},
{
PredCondition
::
LessEqual
,
"<="
},
{
PredCondition
::
GreaterThan
,
">"
},
{
PredCondition
::
LessEqual
,
"<="
},
{
PredCondition
::
GreaterThan
,
">"
},
{
PredCondition
::
NotEqual
,
"!="
},
{
PredCondition
::
GreaterEqual
,
">="
},
{
PredCondition
::
NotEqual
,
"!="
},
{
PredCondition
::
GreaterEqual
,
">="
},
{
PredCondition
::
NotEqualWithNan
,
"!="
},
};
};
auto
comparison
=
PredicateComparisonStrings
.
find
(
condition
);
const
auto
&
comparison
{
PredicateComparisonStrings
.
find
(
condition
)
}
;
ASSERT_MSG
(
comparison
!=
PredicateComparisonStrings
.
end
(),
ASSERT_MSG
(
comparison
!=
PredicateComparisonStrings
.
end
(),
"Unknown predicate comparison operation"
);
"Unknown predicate comparison operation"
);
return
comparison
->
second
;
std
::
string
predicate
{
'('
+
op_a
+
") "
+
comparison
->
second
+
" ("
+
op_b
+
')'
};
if
(
condition
==
PredCondition
::
NotEqualWithNan
)
{
predicate
+=
" || isnan("
+
op_a
+
") || isnan("
+
op_b
+
')'
;
}
return
predicate
;
}
}
/**
/**
...
@@ -1415,10 +1425,9 @@ private:
...
@@ -1415,10 +1425,9 @@ private:
std
::
string
second_pred
=
std
::
string
second_pred
=
GetPredicateCondition
(
instr
.
fsetp
.
pred39
,
instr
.
fsetp
.
neg_pred
!=
0
);
GetPredicateCondition
(
instr
.
fsetp
.
pred39
,
instr
.
fsetp
.
neg_pred
!=
0
);
std
::
string
comparator
=
GetPredicateComparison
(
instr
.
fsetp
.
cond
);
std
::
string
combiner
=
GetPredicateCombiner
(
instr
.
fsetp
.
op
);
std
::
string
combiner
=
GetPredicateCombiner
(
instr
.
fsetp
.
op
);
std
::
string
predicate
=
'('
+
op_a
+
") "
+
comparator
+
" ("
+
op_b
+
')'
;
std
::
string
predicate
=
GetPredicateComparison
(
instr
.
fsetp
.
cond
,
op_a
,
op_b
)
;
// Set the primary predicate to the result of Predicate OP SecondPredicate
// Set the primary predicate to the result of Predicate OP SecondPredicate
SetPredicate
(
instr
.
fsetp
.
pred3
,
SetPredicate
(
instr
.
fsetp
.
pred3
,
'('
+
predicate
+
") "
+
combiner
+
" ("
+
second_pred
+
')'
);
'('
+
predicate
+
") "
+
combiner
+
" ("
+
second_pred
+
')'
);
...
@@ -1453,10 +1462,9 @@ private:
...
@@ -1453,10 +1462,9 @@ private:
std
::
string
second_pred
=
std
::
string
second_pred
=
GetPredicateCondition
(
instr
.
isetp
.
pred39
,
instr
.
isetp
.
neg_pred
!=
0
);
GetPredicateCondition
(
instr
.
isetp
.
pred39
,
instr
.
isetp
.
neg_pred
!=
0
);
std
::
string
comparator
=
GetPredicateComparison
(
instr
.
isetp
.
cond
);
std
::
string
combiner
=
GetPredicateCombiner
(
instr
.
isetp
.
op
);
std
::
string
combiner
=
GetPredicateCombiner
(
instr
.
isetp
.
op
);
std
::
string
predicate
=
'('
+
op_a
+
") "
+
comparator
+
" ("
+
op_b
+
')'
;
std
::
string
predicate
=
GetPredicateComparison
(
instr
.
isetp
.
cond
,
op_a
,
op_b
)
;
// Set the primary predicate to the result of Predicate OP SecondPredicate
// Set the primary predicate to the result of Predicate OP SecondPredicate
SetPredicate
(
instr
.
isetp
.
pred3
,
SetPredicate
(
instr
.
isetp
.
pred3
,
'('
+
predicate
+
") "
+
combiner
+
" ("
+
second_pred
+
')'
);
'('
+
predicate
+
") "
+
combiner
+
" ("
+
second_pred
+
')'
);
...
@@ -1503,11 +1511,10 @@ private:
...
@@ -1503,11 +1511,10 @@ private:
std
::
string
second_pred
=
std
::
string
second_pred
=
GetPredicateCondition
(
instr
.
fset
.
pred39
,
instr
.
fset
.
neg_pred
!=
0
);
GetPredicateCondition
(
instr
.
fset
.
pred39
,
instr
.
fset
.
neg_pred
!=
0
);
std
::
string
comparator
=
GetPredicateComparison
(
instr
.
fset
.
cond
);
std
::
string
combiner
=
GetPredicateCombiner
(
instr
.
fset
.
op
);
std
::
string
combiner
=
GetPredicateCombiner
(
instr
.
fset
.
op
);
std
::
string
predicate
=
"((
(
"
+
op_a
+
") "
+
comparator
+
" ("
+
op_b
+
")) "
+
std
::
string
predicate
=
"(("
+
GetPredicateComparison
(
instr
.
fset
.
cond
,
op_a
,
op_b
)
+
combiner
+
" ("
+
second_pred
+
"))"
;
") "
+
combiner
+
" ("
+
second_pred
+
"))"
;
if
(
instr
.
fset
.
bf
)
{
if
(
instr
.
fset
.
bf
)
{
regs
.
SetRegisterToFloat
(
instr
.
gpr0
,
0
,
predicate
+
" ? 1.0 : 0.0"
,
1
,
1
);
regs
.
SetRegisterToFloat
(
instr
.
gpr0
,
0
,
predicate
+
" ? 1.0 : 0.0"
,
1
,
1
);
...
@@ -1538,11 +1545,10 @@ private:
...
@@ -1538,11 +1545,10 @@ private:
std
::
string
second_pred
=
std
::
string
second_pred
=
GetPredicateCondition
(
instr
.
iset
.
pred39
,
instr
.
iset
.
neg_pred
!=
0
);
GetPredicateCondition
(
instr
.
iset
.
pred39
,
instr
.
iset
.
neg_pred
!=
0
);
std
::
string
comparator
=
GetPredicateComparison
(
instr
.
iset
.
cond
);
std
::
string
combiner
=
GetPredicateCombiner
(
instr
.
iset
.
op
);
std
::
string
combiner
=
GetPredicateCombiner
(
instr
.
iset
.
op
);
std
::
string
predicate
=
"((
(
"
+
op_a
+
") "
+
comparator
+
" ("
+
op_b
+
")) "
+
std
::
string
predicate
=
"(("
+
GetPredicateComparison
(
instr
.
iset
.
cond
,
op_a
,
op_b
)
+
combiner
+
" ("
+
second_pred
+
"))"
;
") "
+
combiner
+
" ("
+
second_pred
+
"))"
;
if
(
instr
.
iset
.
bf
)
{
if
(
instr
.
iset
.
bf
)
{
regs
.
SetRegisterToFloat
(
instr
.
gpr0
,
0
,
predicate
+
" ? 1.0 : 0.0"
,
1
,
1
);
regs
.
SetRegisterToFloat
(
instr
.
gpr0
,
0
,
predicate
+
" ? 1.0 : 0.0"
,
1
,
1
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment