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
3f2daa89
Commit
3f2daa89
authored
Aug 07, 2013
by
Al Patrick
Committed by
Shannon Woods
Sep 10, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Presort reverse mapping of ProgramBinary::mSemanticIndex.
parent
b11713fb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
13 deletions
+18
-13
ProgramBinary.cpp
src/libGLESv2/ProgramBinary.cpp
+16
-13
ProgramBinary.h
src/libGLESv2/ProgramBinary.h
+2
-0
No files found.
src/libGLESv2/ProgramBinary.cpp
View file @
3f2daa89
...
@@ -1660,6 +1660,8 @@ bool ProgramBinary::load(InfoLog &infoLog, const void *binary, GLsizei length)
...
@@ -1660,6 +1660,8 @@ bool ProgramBinary::load(InfoLog &infoLog, const void *binary, GLsizei length)
stream
.
read
(
&
mSemanticIndex
[
i
]);
stream
.
read
(
&
mSemanticIndex
[
i
]);
}
}
initAttributesByLayout
();
for
(
unsigned
int
i
=
0
;
i
<
MAX_TEXTURE_IMAGE_UNITS
;
++
i
)
for
(
unsigned
int
i
=
0
;
i
<
MAX_TEXTURE_IMAGE_UNITS
;
++
i
)
{
{
stream
.
read
(
&
mSamplersPS
[
i
].
active
);
stream
.
read
(
&
mSamplersPS
[
i
].
active
);
...
@@ -2162,6 +2164,8 @@ bool ProgramBinary::linkAttributes(InfoLog &infoLog, const AttributeBindings &at
...
@@ -2162,6 +2164,8 @@ bool ProgramBinary::linkAttributes(InfoLog &infoLog, const AttributeBindings &at
}
}
}
}
initAttributesByLayout
();
return
true
;
return
true
;
}
}
...
@@ -3212,12 +3216,6 @@ struct AttributeSorter
...
@@ -3212,12 +3216,6 @@ struct AttributeSorter
AttributeSorter
(
const
int
(
&
semanticIndices
)[
MAX_VERTEX_ATTRIBS
])
AttributeSorter
(
const
int
(
&
semanticIndices
)[
MAX_VERTEX_ATTRIBS
])
:
originalIndices
(
semanticIndices
)
:
originalIndices
(
semanticIndices
)
{
{
for
(
int
i
=
0
;
i
<
MAX_VERTEX_ATTRIBS
;
i
++
)
{
indices
[
i
]
=
i
;
}
std
::
sort
(
&
indices
[
0
],
&
indices
[
MAX_VERTEX_ATTRIBS
],
*
this
);
}
}
bool
operator
()(
int
a
,
int
b
)
bool
operator
()(
int
a
,
int
b
)
...
@@ -3225,27 +3223,32 @@ struct AttributeSorter
...
@@ -3225,27 +3223,32 @@ struct AttributeSorter
return
originalIndices
[
a
]
==
-
1
?
false
:
originalIndices
[
a
]
<
originalIndices
[
b
];
return
originalIndices
[
a
]
==
-
1
?
false
:
originalIndices
[
a
]
<
originalIndices
[
b
];
}
}
int
indices
[
MAX_VERTEX_ATTRIBS
];
const
int
(
&
originalIndices
)[
MAX_VERTEX_ATTRIBS
];
const
int
(
&
originalIndices
)[
MAX_VERTEX_ATTRIBS
];
};
};
void
ProgramBinary
::
sortAttributesByLayout
(
rx
::
TranslatedAttribute
attributes
[
MAX_VERTEX_ATTRIBS
],
int
sortedSemanticIndices
[
MAX_VERTEX_ATTRIBS
])
const
void
ProgramBinary
::
initAttributesByLayout
()
{
{
AttributeSorter
sorter
(
mSemanticIndex
);
for
(
int
i
=
0
;
i
<
MAX_VERTEX_ATTRIBS
;
i
++
)
{
mAttributesByLayout
[
i
]
=
i
;
}
std
::
sort
(
&
mAttributesByLayout
[
0
],
&
mAttributesByLayout
[
MAX_VERTEX_ATTRIBS
],
AttributeSorter
(
mSemanticIndex
));
}
int
oldIndices
[
MAX_VERTEX_ATTRIBS
];
void
ProgramBinary
::
sortAttributesByLayout
(
rx
::
TranslatedAttribute
attributes
[
MAX_VERTEX_ATTRIBS
],
int
sortedSemanticIndices
[
MAX_VERTEX_ATTRIBS
])
const
{
rx
::
TranslatedAttribute
oldTranslatedAttributes
[
MAX_VERTEX_ATTRIBS
];
rx
::
TranslatedAttribute
oldTranslatedAttributes
[
MAX_VERTEX_ATTRIBS
];
for
(
int
i
=
0
;
i
<
MAX_VERTEX_ATTRIBS
;
i
++
)
for
(
int
i
=
0
;
i
<
MAX_VERTEX_ATTRIBS
;
i
++
)
{
{
oldIndices
[
i
]
=
mSemanticIndex
[
i
];
oldTranslatedAttributes
[
i
]
=
attributes
[
i
];
oldTranslatedAttributes
[
i
]
=
attributes
[
i
];
}
}
for
(
int
i
=
0
;
i
<
MAX_VERTEX_ATTRIBS
;
i
++
)
for
(
int
i
=
0
;
i
<
MAX_VERTEX_ATTRIBS
;
i
++
)
{
{
int
oldIndex
=
sorter
.
indices
[
i
];
int
oldIndex
=
mAttributesByLayout
[
i
];
sortedSemanticIndices
[
i
]
=
oldIndices
[
oldIndex
];
sortedSemanticIndices
[
i
]
=
mSemanticIndex
[
oldIndex
];
attributes
[
i
]
=
oldTranslatedAttributes
[
oldIndex
];
attributes
[
i
]
=
oldTranslatedAttributes
[
oldIndex
];
}
}
}
}
...
...
src/libGLESv2/ProgramBinary.h
View file @
3f2daa89
...
@@ -140,6 +140,7 @@ class ProgramBinary : public RefCountObject
...
@@ -140,6 +140,7 @@ class ProgramBinary : public RefCountObject
unsigned
int
getSerial
()
const
;
unsigned
int
getSerial
()
const
;
int
getShaderVersion
()
const
;
int
getShaderVersion
()
const
;
void
initAttributesByLayout
();
void
sortAttributesByLayout
(
rx
::
TranslatedAttribute
attributes
[
gl
::
MAX_VERTEX_ATTRIBS
],
int
sortedSemanticIndices
[
MAX_VERTEX_ATTRIBS
])
const
;
void
sortAttributesByLayout
(
rx
::
TranslatedAttribute
attributes
[
gl
::
MAX_VERTEX_ATTRIBS
],
int
sortedSemanticIndices
[
MAX_VERTEX_ATTRIBS
])
const
;
static
std
::
string
decorateAttribute
(
const
std
::
string
&
name
);
// Prepend an underscore
static
std
::
string
decorateAttribute
(
const
std
::
string
&
name
);
// Prepend an underscore
...
@@ -195,6 +196,7 @@ class ProgramBinary : public RefCountObject
...
@@ -195,6 +196,7 @@ class ProgramBinary : public RefCountObject
sh
::
Attribute
mLinkedAttribute
[
MAX_VERTEX_ATTRIBS
];
sh
::
Attribute
mLinkedAttribute
[
MAX_VERTEX_ATTRIBS
];
int
mSemanticIndex
[
MAX_VERTEX_ATTRIBS
];
int
mSemanticIndex
[
MAX_VERTEX_ATTRIBS
];
int
mAttributesByLayout
[
MAX_VERTEX_ATTRIBS
];
struct
Sampler
struct
Sampler
{
{
...
...
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