Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
swiftshader
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
swiftshader
Commits
7381c994
Commit
7381c994
authored
May 06, 2014
by
Nicolas Capens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Defer worker thread creation until the first draw call.
crbug.com/336438
parent
5a35426e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
17 deletions
+12
-17
Renderer.cpp
src/Renderer/Renderer.cpp
+11
-15
Renderer.hpp
src/Renderer/Renderer.hpp
+1
-2
No files found.
src/Renderer/Renderer.cpp
View file @
7381c994
...
@@ -183,8 +183,6 @@ namespace sw
...
@@ -183,8 +183,6 @@ namespace sw
delete
drawCall
[
draw
];
delete
drawCall
[
draw
];
}
}
deleteBatches
();
delete
swiftConfig
;
delete
swiftConfig
;
}
}
...
@@ -1831,14 +1829,10 @@ namespace sw
...
@@ -1831,14 +1829,10 @@ namespace sw
Clipper
::
CLIP_FINITE
;
// FIXME: xyz finite
Clipper
::
CLIP_FINITE
;
// FIXME: xyz finite
}
}
void
Renderer
::
initializeThreads
(
int
threads
)
void
Renderer
::
initializeThreads
()
{
{
terminateThreads
();
unitCount
=
ceilPow2
(
threadCount
);
deleteBatches
();
clusterCount
=
ceilPow2
(
threadCount
);
threadCount
=
threads
;
unitCount
=
ceilPow2
(
threads
);
clusterCount
=
ceilPow2
(
threads
);
for
(
int
i
=
0
;
i
<
unitCount
;
i
++
)
for
(
int
i
=
0
;
i
<
unitCount
;
i
++
)
{
{
...
@@ -1894,10 +1888,7 @@ namespace sw
...
@@ -1894,10 +1888,7 @@ namespace sw
deallocate
(
vertexTask
[
thread
]);
deallocate
(
vertexTask
[
thread
]);
vertexTask
[
thread
]
=
0
;
vertexTask
[
thread
]
=
0
;
}
}
}
void
Renderer
::
deleteBatches
()
{
for
(
int
i
=
0
;
i
<
16
;
i
++
)
for
(
int
i
=
0
;
i
<
16
;
i
++
)
{
{
deallocate
(
triangleBatch
[
i
]);
deallocate
(
triangleBatch
[
i
]);
...
@@ -2504,9 +2495,9 @@ namespace sw
...
@@ -2504,9 +2495,9 @@ namespace sw
switch
(
configuration
.
threadCount
)
switch
(
configuration
.
threadCount
)
{
{
case
-
1
:
initializeThreads
(
CPUID
::
coreCount
()
);
break
;
case
-
1
:
threadCount
=
CPUID
::
coreCount
(
);
break
;
case
0
:
initializeThreads
(
CPUID
::
processAffinity
()
);
break
;
case
0
:
threadCount
=
CPUID
::
processAffinity
(
);
break
;
default
:
initializeThreads
(
configuration
.
threadCount
)
;
break
;
default
:
threadCount
=
configuration
.
threadCount
;
break
;
}
}
CPUID
::
setEnableSSE4_1
(
configuration
.
enableSSE4_1
);
CPUID
::
setEnableSSE4_1
(
configuration
.
enableSSE4_1
);
...
@@ -2531,5 +2522,10 @@ namespace sw
...
@@ -2531,5 +2522,10 @@ namespace sw
maxPrimitives
=
configuration
.
maxPrimitives
;
maxPrimitives
=
configuration
.
maxPrimitives
;
#endif
#endif
}
}
if
(
!
initialUpdate
&&
!
worker
[
0
])
{
initializeThreads
();
}
}
}
}
}
src/Renderer/Renderer.hpp
View file @
7381c994
...
@@ -359,9 +359,8 @@ namespace sw
...
@@ -359,9 +359,8 @@ namespace sw
void
updateClipper
();
void
updateClipper
();
void
updateConfiguration
(
bool
initialUpdate
=
false
);
void
updateConfiguration
(
bool
initialUpdate
=
false
);
static
unsigned
int
computeClipFlags
(
const
float4
&
v
,
const
DrawData
&
data
);
static
unsigned
int
computeClipFlags
(
const
float4
&
v
,
const
DrawData
&
data
);
void
initializeThreads
(
int
threadCount
);
void
initializeThreads
();
void
terminateThreads
();
void
terminateThreads
();
void
deleteBatches
();
void
loadConstants
(
const
VertexShader
*
vertexShader
);
void
loadConstants
(
const
VertexShader
*
vertexShader
);
void
loadConstants
(
const
PixelShader
*
pixelShader
);
void
loadConstants
(
const
PixelShader
*
pixelShader
);
...
...
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