add ForceDiscreteGPU.c

This commit is contained in:
hyzboy 2020-01-13 14:48:45 +08:00
parent 148372a601
commit 5d496298bc
5 changed files with 23 additions and 1 deletions

3
.gitmodules vendored
View File

@ -19,3 +19,6 @@
[submodule "CMPlatform"]
path = CMPlatform
url = https://github.com/hyzboy/CMPlatform
[submodule "CMAssetsManage"]
path = CMAssetsManage
url = https://github.com/hyzboy/CMAssetsManage.git

1
CMAssetsManage Submodule

@ -0,0 +1 @@
Subproject commit a03628acf307e07d383d8ab41c2a9ca73a052fb3

View File

@ -23,6 +23,7 @@ BEGIN_SHADER_NAMESPACE
namespace
{
}//namespace
bool ShaderMaker::Check()

View File

@ -56,7 +56,14 @@ SOURCE_GROUP("Header Files" FILES ${RENDER_DEVICE_VULKAN_HEADER})
SOURCE_GROUP("Source Files" FILES ${RENDER_DEVICE_VULKAN_SOURCE})
SOURCE_GROUP("POD Source Files" FILES ${RENDER_DEVICE_VULKAN_POD_SOURCE})
add_cm_library(ULRE.RenderDevice.Vulkan "ULRE" ${RENDER_DEVICE_VULKAN_HEADER}
OPTION(FORCE_DISCETE_GPU "Force Discrete GPU" OFF)
IF(FORCE_DISCETE_GPU)
SET(RENDER_DEVICE_SOURCE ForceDiscreteGPU.c)
ENDIF()
add_cm_library(ULRE.RenderDevice.Vulkan "ULRE" ${RENDER_DEVICE_SOURCE}
${RENDER_DEVICE_VULKAN_HEADER}
${RENDER_DEVICE_VULKAN_SOURCE}
${RENDER_DEVICE_VULKAN_POD_SOURCE}

View File

@ -0,0 +1,10 @@
#include<windows.h>
// http://developer.download.nvidia.com/devzone/devcenter/gamegraphics/files/OptimusRenderingPolicies.pdf
// The following line is to favor the high performance NVIDIA GPU if there are multiple GPUs
// Has to be .exe module to be correctly detected.
extern __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
// And the AMD equivalent
// Also has to be .exe module to be correctly detected.
extern __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 0x00000001;