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
a612ed8e
Commit
a612ed8e
authored
Aug 15, 2013
by
Al Patrick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
InputLayoutCache only hashes input layout keys up to last used element.
R=geofflang@chromium.org Review URL:
https://codereview.appspot.com/12676043
parent
ba2cfe7c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
23 deletions
+49
-23
version.h
src/common/version.h
+1
-1
libEGL.vcxproj
src/libEGL/libEGL.vcxproj
+4
-4
libGLESv2.vcxproj
src/libGLESv2/libGLESv2.vcxproj
+4
-4
InputLayoutCache.cpp
src/libGLESv2/renderer/InputLayoutCache.cpp
+23
-12
InputLayoutCache.h
src/libGLESv2/renderer/InputLayoutCache.h
+17
-2
No files found.
src/common/version.h
View file @
a612ed8e
#define MAJOR_VERSION 1
#define MAJOR_VERSION 1
#define MINOR_VERSION 2
#define MINOR_VERSION 2
#define BUILD_VERSION 0
#define BUILD_VERSION 0
#define BUILD_REVISION 243
7
#define BUILD_REVISION 243
8
#define STRINGIFY(x) #x
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
#define MACRO_STRINGIFY(x) STRINGIFY(x)
...
...
src/libEGL/libEGL.vcxproj
View file @
a612ed8e
...
@@ -91,7 +91,7 @@
...
@@ -91,7 +91,7 @@
<WarningLevel>
Level4
</WarningLevel>
<WarningLevel>
Level4
</WarningLevel>
<TreatWarningAsError>
true
</TreatWarningAsError>
<TreatWarningAsError>
true
</TreatWarningAsError>
<DebugInformationFormat>
EditAndContinue
</DebugInformationFormat>
<DebugInformationFormat>
EditAndContinue
</DebugInformationFormat>
<DisableSpecificWarnings>
4100;4127;4189;4239;4244;4245;4512;4702;%(DisableSpecificWarnings)
</DisableSpecificWarnings>
<DisableSpecificWarnings>
4100;4127;4189;4239;4244;4245;4512;4702;
4996;
%(DisableSpecificWarnings)
</DisableSpecificWarnings>
</ClCompile>
</ClCompile>
<Link>
<Link>
<AdditionalDependencies>
d3d9.lib;%(AdditionalDependencies)
</AdditionalDependencies>
<AdditionalDependencies>
d3d9.lib;%(AdditionalDependencies)
</AdditionalDependencies>
...
@@ -124,7 +124,7 @@ copy "$(OutDir)libEGL.lib" "$(ProjectDir)..\..\lib\$(Configuration)\"
...
@@ -124,7 +124,7 @@ copy "$(OutDir)libEGL.lib" "$(ProjectDir)..\..\lib\$(Configuration)\"
<WarningLevel>
Level4
</WarningLevel>
<WarningLevel>
Level4
</WarningLevel>
<TreatWarningAsError>
true
</TreatWarningAsError>
<TreatWarningAsError>
true
</TreatWarningAsError>
<DebugInformationFormat>
ProgramDatabase
</DebugInformationFormat>
<DebugInformationFormat>
ProgramDatabase
</DebugInformationFormat>
<DisableSpecificWarnings>
4100;4127;4189;4239;4244;4245;4512;4702;%(DisableSpecificWarnings)
</DisableSpecificWarnings>
<DisableSpecificWarnings>
4100;4127;4189;4239;4244;4245;4512;4702;
4996;
%(DisableSpecificWarnings)
</DisableSpecificWarnings>
</ClCompile>
</ClCompile>
<Link>
<Link>
<AdditionalDependencies>
d3d9.lib;%(AdditionalDependencies)
</AdditionalDependencies>
<AdditionalDependencies>
d3d9.lib;%(AdditionalDependencies)
</AdditionalDependencies>
...
@@ -161,7 +161,7 @@ copy "$(OutDir)libEGL.lib" "$(ProjectDir)..\..\lib\$(Configuration)\"
...
@@ -161,7 +161,7 @@ copy "$(OutDir)libEGL.lib" "$(ProjectDir)..\..\lib\$(Configuration)\"
<PrecompiledHeader>
<PrecompiledHeader>
</PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>
Level4
</WarningLevel>
<WarningLevel>
Level4
</WarningLevel>
<DisableSpecificWarnings>
4100;4127;4189;4239;4244;4245;4512;4702;%(DisableSpecificWarnings)
</DisableSpecificWarnings>
<DisableSpecificWarnings>
4100;4127;4189;4239;4244;4245;4512;4702;
4996;
%(DisableSpecificWarnings)
</DisableSpecificWarnings>
<DebugInformationFormat>
ProgramDatabase
</DebugInformationFormat>
<DebugInformationFormat>
ProgramDatabase
</DebugInformationFormat>
<TreatWarningAsError>
true
</TreatWarningAsError>
<TreatWarningAsError>
true
</TreatWarningAsError>
</ClCompile>
</ClCompile>
...
@@ -197,7 +197,7 @@ copy "$(OutDir)libEGL.lib" "$(ProjectDir)..\..\lib\$(Configuration)\"
...
@@ -197,7 +197,7 @@ copy "$(OutDir)libEGL.lib" "$(ProjectDir)..\..\lib\$(Configuration)\"
<PrecompiledHeader>
<PrecompiledHeader>
</PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>
Level4
</WarningLevel>
<WarningLevel>
Level4
</WarningLevel>
<DisableSpecificWarnings>
4100;4127;4189;4239;4244;4245;4512;4702;%(DisableSpecificWarnings)
</DisableSpecificWarnings>
<DisableSpecificWarnings>
4100;4127;4189;4239;4244;4245;4512;4702;
4996;
%(DisableSpecificWarnings)
</DisableSpecificWarnings>
<DebugInformationFormat>
ProgramDatabase
</DebugInformationFormat>
<DebugInformationFormat>
ProgramDatabase
</DebugInformationFormat>
<TreatWarningAsError>
true
</TreatWarningAsError>
<TreatWarningAsError>
true
</TreatWarningAsError>
</ClCompile>
</ClCompile>
...
...
src/libGLESv2/libGLESv2.vcxproj
View file @
a612ed8e
...
@@ -93,7 +93,7 @@
...
@@ -93,7 +93,7 @@
<WarningLevel>
Level4
</WarningLevel>
<WarningLevel>
Level4
</WarningLevel>
<TreatWarningAsError>
true
</TreatWarningAsError>
<TreatWarningAsError>
true
</TreatWarningAsError>
<DebugInformationFormat>
EditAndContinue
</DebugInformationFormat>
<DebugInformationFormat>
EditAndContinue
</DebugInformationFormat>
<DisableSpecificWarnings>
4100;4127;4189;4239;4244;4245;4512;4702;%(DisableSpecificWarnings)
</DisableSpecificWarnings>
<DisableSpecificWarnings>
4100;4127;4189;4239;4244;4245;4512;4702;
4996;
%(DisableSpecificWarnings)
</DisableSpecificWarnings>
<PrecompiledHeaderFile>
precompiled.h
</PrecompiledHeaderFile>
<PrecompiledHeaderFile>
precompiled.h
</PrecompiledHeaderFile>
<AdditionalOptions>
$(ExternalCompilerOptions) %(AdditionalOptions)
</AdditionalOptions>
<AdditionalOptions>
$(ExternalCompilerOptions) %(AdditionalOptions)
</AdditionalOptions>
</ClCompile>
</ClCompile>
...
@@ -126,7 +126,7 @@ copy "$(OutDir)libGLESv2.lib" "$(ProjectDir)..\..\lib\$(Configuration)\"
...
@@ -126,7 +126,7 @@ copy "$(OutDir)libGLESv2.lib" "$(ProjectDir)..\..\lib\$(Configuration)\"
<WarningLevel>
Level4
</WarningLevel>
<WarningLevel>
Level4
</WarningLevel>
<TreatWarningAsError>
true
</TreatWarningAsError>
<TreatWarningAsError>
true
</TreatWarningAsError>
<DebugInformationFormat>
ProgramDatabase
</DebugInformationFormat>
<DebugInformationFormat>
ProgramDatabase
</DebugInformationFormat>
<DisableSpecificWarnings>
4100;4127;4189;4239;4244;4245;4512;4702;4718;%(DisableSpecificWarnings)
</DisableSpecificWarnings>
<DisableSpecificWarnings>
4100;4127;4189;4239;4244;4245;4512;4702;4718;
4996;
%(DisableSpecificWarnings)
</DisableSpecificWarnings>
<PrecompiledHeaderFile>
precompiled.h
</PrecompiledHeaderFile>
<PrecompiledHeaderFile>
precompiled.h
</PrecompiledHeaderFile>
<AdditionalOptions>
$(ExternalCompilerOptions) %(AdditionalOptions)
</AdditionalOptions>
<AdditionalOptions>
$(ExternalCompilerOptions) %(AdditionalOptions)
</AdditionalOptions>
</ClCompile>
</ClCompile>
...
@@ -164,7 +164,7 @@ copy "$(OutDir)libGLESv2.lib" "$(ProjectDir)..\..\lib\$(Configuration)\"
...
@@ -164,7 +164,7 @@ copy "$(OutDir)libGLESv2.lib" "$(ProjectDir)..\..\lib\$(Configuration)\"
<RuntimeLibrary>
MultiThreadedDebug
</RuntimeLibrary>
<RuntimeLibrary>
MultiThreadedDebug
</RuntimeLibrary>
<PrecompiledHeader>
Use
</PrecompiledHeader>
<PrecompiledHeader>
Use
</PrecompiledHeader>
<WarningLevel>
Level4
</WarningLevel>
<WarningLevel>
Level4
</WarningLevel>
<DisableSpecificWarnings>
4100;4127;4189;4239;4244;4245;4512;4702;4718;%(DisableSpecificWarnings)
</DisableSpecificWarnings>
<DisableSpecificWarnings>
4100;4127;4189;4239;4244;4245;4512;4702;4718;
4996;
%(DisableSpecificWarnings)
</DisableSpecificWarnings>
<DebugInformationFormat>
ProgramDatabase
</DebugInformationFormat>
<DebugInformationFormat>
ProgramDatabase
</DebugInformationFormat>
<TreatWarningAsError>
true
</TreatWarningAsError>
<TreatWarningAsError>
true
</TreatWarningAsError>
<PrecompiledHeaderFile>
precompiled.h
</PrecompiledHeaderFile>
<PrecompiledHeaderFile>
precompiled.h
</PrecompiledHeaderFile>
...
@@ -200,7 +200,7 @@ copy "$(OutDir)libGLESv2.lib" "$(ProjectDir)..\..\lib\$(Configuration)\"
...
@@ -200,7 +200,7 @@ copy "$(OutDir)libGLESv2.lib" "$(ProjectDir)..\..\lib\$(Configuration)\"
<RuntimeLibrary>
MultiThreaded
</RuntimeLibrary>
<RuntimeLibrary>
MultiThreaded
</RuntimeLibrary>
<PrecompiledHeader>
Use
</PrecompiledHeader>
<PrecompiledHeader>
Use
</PrecompiledHeader>
<WarningLevel>
Level4
</WarningLevel>
<WarningLevel>
Level4
</WarningLevel>
<DisableSpecificWarnings>
4100;4127;4189;4239;4244;4245;4512;4702;4718;%(DisableSpecificWarnings)
</DisableSpecificWarnings>
<DisableSpecificWarnings>
4100;4127;4189;4239;4244;4245;4512;4702;4718;
4996;
%(DisableSpecificWarnings)
</DisableSpecificWarnings>
<DebugInformationFormat>
ProgramDatabase
</DebugInformationFormat>
<DebugInformationFormat>
ProgramDatabase
</DebugInformationFormat>
<TreatWarningAsError>
true
</TreatWarningAsError>
<TreatWarningAsError>
true
</TreatWarningAsError>
<PrecompiledHeaderFile>
precompiled.h
</PrecompiledHeaderFile>
<PrecompiledHeaderFile>
precompiled.h
</PrecompiledHeaderFile>
...
...
src/libGLESv2/renderer/InputLayoutCache.cpp
View file @
a612ed8e
...
@@ -103,15 +103,15 @@ GLenum InputLayoutCache::applyVertexBuffers(TranslatedAttribute attributes[gl::M
...
@@ -103,15 +103,15 @@ GLenum InputLayoutCache::applyVertexBuffers(TranslatedAttribute attributes[gl::M
// Record the type of the associated vertex shader vector in our key
// Record the type of the associated vertex shader vector in our key
// This will prevent mismatched vertex shaders from using the same input layout
// This will prevent mismatched vertex shaders from using the same input layout
GLint
attributeSize
;
GLint
attributeSize
;
programBinary
->
getActiveAttribute
(
ilKey
.
elementCount
,
0
,
NULL
,
&
attributeSize
,
&
ilKey
.
glslElementType
[
ilKey
.
elementCount
]
,
NULL
);
programBinary
->
getActiveAttribute
(
ilKey
.
elementCount
,
0
,
NULL
,
&
attributeSize
,
&
ilKey
.
elements
[
ilKey
.
elementCount
].
glslElementType
,
NULL
);
ilKey
.
elements
[
ilKey
.
elementCount
].
SemanticName
=
semanticName
;
ilKey
.
elements
[
ilKey
.
elementCount
].
desc
.
SemanticName
=
semanticName
;
ilKey
.
elements
[
ilKey
.
elementCount
].
SemanticIndex
=
sortedSemanticIndices
[
i
];
ilKey
.
elements
[
ilKey
.
elementCount
].
desc
.
SemanticIndex
=
sortedSemanticIndices
[
i
];
ilKey
.
elements
[
ilKey
.
elementCount
].
Format
=
attributes
[
i
].
attribute
->
mArrayEnabled
?
vertexBuffer
->
getDXGIFormat
(
*
attributes
[
i
].
attribute
)
:
DXGI_FORMAT_R32G32B32A32_FLOAT
;
ilKey
.
elements
[
ilKey
.
elementCount
].
desc
.
Format
=
attributes
[
i
].
attribute
->
mArrayEnabled
?
vertexBuffer
->
getDXGIFormat
(
*
attributes
[
i
].
attribute
)
:
DXGI_FORMAT_R32G32B32A32_FLOAT
;
ilKey
.
elements
[
ilKey
.
elementCount
].
InputSlot
=
i
;
ilKey
.
elements
[
ilKey
.
elementCount
].
desc
.
InputSlot
=
i
;
ilKey
.
elements
[
ilKey
.
elementCount
].
AlignedByteOffset
=
0
;
ilKey
.
elements
[
ilKey
.
elementCount
].
desc
.
AlignedByteOffset
=
0
;
ilKey
.
elements
[
ilKey
.
elementCount
].
InputSlotClass
=
inputClass
;
ilKey
.
elements
[
ilKey
.
elementCount
].
desc
.
InputSlotClass
=
inputClass
;
ilKey
.
elements
[
ilKey
.
elementCount
].
InstanceDataStepRate
=
attributes
[
i
].
divisor
;
ilKey
.
elements
[
ilKey
.
elementCount
].
desc
.
InstanceDataStepRate
=
attributes
[
i
].
divisor
;
ilKey
.
elementCount
++
;
ilKey
.
elementCount
++
;
vertexBuffers
[
i
]
=
bufferStorage
?
bufferStorage
->
getBuffer
()
:
vertexBuffer
->
getBuffer
();
vertexBuffers
[
i
]
=
bufferStorage
?
bufferStorage
->
getBuffer
()
:
vertexBuffer
->
getBuffer
();
...
@@ -133,7 +133,13 @@ GLenum InputLayoutCache::applyVertexBuffers(TranslatedAttribute attributes[gl::M
...
@@ -133,7 +133,13 @@ GLenum InputLayoutCache::applyVertexBuffers(TranslatedAttribute attributes[gl::M
{
{
ShaderExecutable11
*
shader
=
ShaderExecutable11
::
makeShaderExecutable11
(
programBinary
->
getVertexExecutable
());
ShaderExecutable11
*
shader
=
ShaderExecutable11
::
makeShaderExecutable11
(
programBinary
->
getVertexExecutable
());
HRESULT
result
=
mDevice
->
CreateInputLayout
(
ilKey
.
elements
,
ilKey
.
elementCount
,
shader
->
getFunction
(),
shader
->
getLength
(),
&
inputLayout
);
D3D11_INPUT_ELEMENT_DESC
descs
[
gl
::
MAX_VERTEX_ATTRIBS
];
for
(
unsigned
int
j
=
0
;
j
<
ilKey
.
elementCount
;
++
j
)
{
descs
[
j
]
=
ilKey
.
elements
[
j
].
desc
;
}
HRESULT
result
=
mDevice
->
CreateInputLayout
(
descs
,
ilKey
.
elementCount
,
shader
->
getFunction
(),
shader
->
getLength
(),
&
inputLayout
);
if
(
FAILED
(
result
))
if
(
FAILED
(
result
))
{
{
ERR
(
"Failed to crate input layout, result: 0x%08x"
,
result
);
ERR
(
"Failed to crate input layout, result: 0x%08x"
,
result
);
...
@@ -190,13 +196,18 @@ std::size_t InputLayoutCache::hashInputLayout(const InputLayoutKey &inputLayout)
...
@@ -190,13 +196,18 @@ std::size_t InputLayoutCache::hashInputLayout(const InputLayoutKey &inputLayout)
static
const
unsigned
int
seed
=
0xDEADBEEF
;
static
const
unsigned
int
seed
=
0xDEADBEEF
;
std
::
size_t
hash
=
0
;
std
::
size_t
hash
=
0
;
MurmurHash3_x86_32
(
&
inputLayout
,
sizeof
(
InputLayoutKey
),
seed
,
&
hash
);
MurmurHash3_x86_32
(
inputLayout
.
begin
(),
inputLayout
.
end
()
-
inputLayout
.
begin
(
),
seed
,
&
hash
);
return
hash
;
return
hash
;
}
}
bool
InputLayoutCache
::
compareInputLayouts
(
const
InputLayoutKey
&
a
,
const
InputLayoutKey
&
b
)
bool
InputLayoutCache
::
compareInputLayouts
(
const
InputLayoutKey
&
a
,
const
InputLayoutKey
&
b
)
{
{
return
memcmp
(
&
a
,
&
b
,
sizeof
(
InputLayoutKey
))
==
0
;
if
(
a
.
elementCount
!=
b
.
elementCount
)
{
return
false
;
}
return
std
::
equal
(
a
.
begin
(),
a
.
end
(),
b
.
begin
());
}
}
}
}
src/libGLESv2/renderer/InputLayoutCache.h
View file @
a612ed8e
...
@@ -38,11 +38,26 @@ class InputLayoutCache
...
@@ -38,11 +38,26 @@ class InputLayoutCache
private
:
private
:
DISALLOW_COPY_AND_ASSIGN
(
InputLayoutCache
);
DISALLOW_COPY_AND_ASSIGN
(
InputLayoutCache
);
struct
InputLayoutElement
{
D3D11_INPUT_ELEMENT_DESC
desc
;
GLenum
glslElementType
;
};
struct
InputLayoutKey
struct
InputLayoutKey
{
{
unsigned
int
elementCount
;
unsigned
int
elementCount
;
D3D11_INPUT_ELEMENT_DESC
elements
[
gl
::
MAX_VERTEX_ATTRIBS
];
InputLayoutElement
elements
[
gl
::
MAX_VERTEX_ATTRIBS
];
GLenum
glslElementType
[
gl
::
MAX_VERTEX_ATTRIBS
];
const
char
*
begin
()
const
{
return
reinterpret_cast
<
const
char
*>
(
&
elementCount
);
}
const
char
*
end
()
const
{
return
reinterpret_cast
<
const
char
*>
(
&
elements
[
elementCount
]);
}
};
};
struct
InputLayoutCounterPair
struct
InputLayoutCounterPair
...
...
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