From 62615c601ef77926369f480cf0e0106074b0882b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 2 Sep 2017 13:49:07 -0400 Subject: [PATCH 1/2] AsyncShaderCompiler: Forward arguments to the specified type's constructor in CreateWorkItem() As this just hands off the arguments to another type's constructor, perfect forwarding should be used here to preserve any potential move semantics. --- Source/Core/VideoCommon/AsyncShaderCompiler.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Core/VideoCommon/AsyncShaderCompiler.h b/Source/Core/VideoCommon/AsyncShaderCompiler.h index fb117dab28..fc0bca8d72 100644 --- a/Source/Core/VideoCommon/AsyncShaderCompiler.h +++ b/Source/Core/VideoCommon/AsyncShaderCompiler.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include "Common/CommonTypes.h" @@ -36,9 +37,9 @@ public: virtual ~AsyncShaderCompiler(); template - static WorkItemPtr CreateWorkItem(Params... params) + static WorkItemPtr CreateWorkItem(Params&&... params) { - return std::unique_ptr(new T(params...)); + return std::unique_ptr(new T(std::forward(params)...)); } void QueueWorkItem(WorkItemPtr item); From 6f97e3faa644c810a5d9155d74c98b02f4865a65 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 2 Sep 2017 14:07:57 -0400 Subject: [PATCH 2/2] AsyncShaderCompiler: use std::make_unique in CreateWorkItem() Same behavior, simpler code. --- Source/Core/VideoCommon/AsyncShaderCompiler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/VideoCommon/AsyncShaderCompiler.h b/Source/Core/VideoCommon/AsyncShaderCompiler.h index fc0bca8d72..fabe264025 100644 --- a/Source/Core/VideoCommon/AsyncShaderCompiler.h +++ b/Source/Core/VideoCommon/AsyncShaderCompiler.h @@ -39,7 +39,7 @@ public: template static WorkItemPtr CreateWorkItem(Params&&... params) { - return std::unique_ptr(new T(std::forward(params)...)); + return std::make_unique(std::forward(params)...); } void QueueWorkItem(WorkItemPtr item);