Skip to content

Commit 7b4fc28

Browse files
committed
Replace sw::Resource with sw::WaitGroup
sw::Resource is only used by the Renderer class and the functionality used is simply one of a WaitGroup. The sync variables has been changed from a Resource to a WaitGroup and the Resource class has been removed. Bug b/133127573 Change-Id: Ic6843be44fcf57f7ac7bef6f3a14726f94761863 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/31689 Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Tested-by: Alexis Hétu <sugoi@google.com> Presubmit-Ready: Alexis Hétu <sugoi@google.com> Reviewed-by: Nicolas Capens <nicolascapens@google.com>
1 parent 8a2d011 commit 7b4fc28

File tree

9 files changed

+6
-240
lines changed

9 files changed

+6
-240
lines changed

CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 2.8)
1+
cmake_minimum_required(VERSION 2.8)
22

33
project(SwiftShader C CXX)
44

@@ -1653,8 +1653,6 @@ file(GLOB_RECURSE VULKAN_LIST
16531653
${SOURCE_DIR}/System/Math.hpp
16541654
${SOURCE_DIR}/System/Memory.cpp
16551655
${SOURCE_DIR}/System/Memory.hpp
1656-
${SOURCE_DIR}/System/Resource.cpp
1657-
${SOURCE_DIR}/System/Resource.hpp
16581656
${SOURCE_DIR}/System/Socket.cpp
16591657
${SOURCE_DIR}/System/Socket.hpp
16601658
${SOURCE_DIR}/System/Synchronization.hpp

src/Android.bp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,6 @@ cc_defaults {
652652
"System/Half.cpp",
653653
"System/Math.cpp",
654654
"System/Memory.cpp",
655-
"System/Resource.cpp",
656655
"System/Socket.cpp",
657656
"System/Timer.cpp",
658657
"System/DebugAndroid.cpp",

src/Device/Renderer.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include "Pipeline/Constants.hpp"
2323
#include "System/CPUID.hpp"
2424
#include "System/Memory.hpp"
25-
#include "System/Resource.hpp"
2625
#include "System/Half.hpp"
2726
#include "System/Math.hpp"
2827
#include "System/Timer.hpp"
@@ -249,16 +248,12 @@ namespace sw
249248

250249
swiftConfig = new SwiftConfig(disableServer);
251250
updateConfiguration(true);
252-
253-
sync = new Resource(0);
254251
}
255252

256253
Renderer::~Renderer()
257254
{
258-
sync->lock(EXCLUSIVE);
259-
sync->destruct();
255+
sync.wait();
260256
terminateThreads();
261-
sync->unlock();
262257

263258
delete resumeApp;
264259
resumeApp = nullptr;
@@ -318,7 +313,7 @@ namespace sw
318313
return;
319314
}
320315

321-
sync->lock(sw::PRIVATE);
316+
sync.add();
322317

323318
if(update)
324319
{
@@ -810,8 +805,7 @@ namespace sw
810805

811806
void Renderer::synchronize()
812807
{
813-
sync->lock(sw::PUBLIC);
814-
sync->unlock();
808+
sync.wait();
815809
}
816810

817811
void Renderer::finishRendering(Task &pixelTask)
@@ -884,7 +878,7 @@ namespace sw
884878
draw.events = nullptr;
885879
}
886880

887-
sync->unlock();
881+
sync.done();
888882

889883
draw.references = -1;
890884
resumeApp->signal();

src/Device/Renderer.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ namespace sw
300300
SwiftConfig *swiftConfig;
301301

302302
std::list<vk::Query*> queries;
303-
Resource *sync;
303+
WaitGroup sync;
304304

305305
VertexProcessor::State vertexState;
306306
SetupProcessor::State setupState;

src/System/BUILD.gn

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ swiftshader_source_set("System") {
2828
"Math.hpp",
2929
"Memory.cpp",
3030
"Memory.hpp",
31-
"Resource.cpp",
32-
"Resource.hpp",
3331
"Socket.cpp",
3432
"Socket.hpp",
3533
"Thread.hpp",

src/System/Resource.cpp

Lines changed: 0 additions & 108 deletions
This file was deleted.

src/System/Resource.hpp

Lines changed: 0 additions & 107 deletions
This file was deleted.

src/Vulkan/vulkan.vcxproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ IF EXIST "$(SolutionDir)..\deqp\build\external\vulkancts\modules\vulkan\" (copy
178178
<ClCompile Include="..\System\Half.cpp" />
179179
<ClCompile Include="..\System\Math.cpp" />
180180
<ClCompile Include="..\System\Memory.cpp" />
181-
<ClCompile Include="..\System\Resource.cpp" />
182181
<ClCompile Include="..\System\Socket.cpp" />
183182
<ClCompile Include="..\System\Timer.cpp" />
184183
<ClCompile Include="..\WSI\VkSurfaceKHR.cpp" />
@@ -274,7 +273,6 @@ IF EXIST "$(SolutionDir)..\deqp\build\external\vulkancts\modules\vulkan\" (copy
274273
<ClInclude Include="..\System\Half.hpp" />
275274
<ClInclude Include="..\System\Math.hpp" />
276275
<ClInclude Include="..\System\Memory.hpp" />
277-
<ClInclude Include="..\System\Resource.hpp" />
278276
<ClInclude Include="..\System\SharedLibrary.hpp" />
279277
<ClInclude Include="..\System\Socket.hpp" />
280278
<ClInclude Include="..\System\Synchronization.hpp" />

src/Vulkan/vulkan.vcxproj.filters

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,6 @@
150150
<ClCompile Include="..\System\Memory.cpp">
151151
<Filter>Source Files\System</Filter>
152152
</ClCompile>
153-
<ClCompile Include="..\System\Resource.cpp">
154-
<Filter>Source Files\System</Filter>
155-
</ClCompile>
156153
<ClCompile Include="..\System\Socket.cpp">
157154
<Filter>Source Files\System</Filter>
158155
</ClCompile>
@@ -488,9 +485,6 @@
488485
<ClInclude Include="..\System\Memory.hpp">
489486
<Filter>Header Files\System</Filter>
490487
</ClInclude>
491-
<ClInclude Include="..\System\Resource.hpp">
492-
<Filter>Header Files\System</Filter>
493-
</ClInclude>
494488
<ClInclude Include="..\System\SharedLibrary.hpp">
495489
<Filter>Header Files\System</Filter>
496490
</ClInclude>

0 commit comments

Comments
 (0)