Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
GamebabyRockSun_QQ
GRSD3D12Sample
提交
b5af17d4
G
GRSD3D12Sample
项目概览
GamebabyRockSun_QQ
/
GRSD3D12Sample
大约 1 年 前同步成功
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
1
Wiki
分析
仓库
DevOps
项目成员
Pages
G
GRSD3D12Sample
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
1
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b5af17d4
编写于
11月 29, 2019
作者:
GamebabyRockSun_QQ
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加多线程多显卡渲染示例程序,带水彩画效果和高斯模糊后处理,高斯模糊微软版是简化版,没有渲染两遍
上级
eed0455d
变更
15
展开全部
隐藏空白更改
内联
并排
Showing
15 changed file
with
5717 addition
and
38 deletion
+5717
-38
10-PixelShaderTips/10-PixelShaderTips.cpp
10-PixelShaderTips/10-PixelShaderTips.cpp
+0
-1
10-PixelShaderTips/Shader/10-PixelShaderTips.hlsl
10-PixelShaderTips/Shader/10-PixelShaderTips.hlsl
+18
-7
11-MultiThreadAndAdapter/11-MultiThreadAndAdapter.cpp
11-MultiThreadAndAdapter/11-MultiThreadAndAdapter.cpp
+2339
-0
11-MultiThreadAndAdapter/11-MultiThreadAndAdapter.vcxproj
11-MultiThreadAndAdapter/11-MultiThreadAndAdapter.vcxproj
+200
-0
11-MultiThreadAndAdapter/11-MultiThreadAndAdapter.vcxproj.filters
...ThreadAndAdapter/11-MultiThreadAndAdapter.vcxproj.filters
+54
-0
11-MultiThreadAndAdapter/11-MultiThreadAndAdapter.vcxproj.user
...ltiThreadAndAdapter/11-MultiThreadAndAdapter.vcxproj.user
+4
-0
11-MultiThreadAndAdapter/11-MultiThreadAndAdapter_OLD.cpp
11-MultiThreadAndAdapter/11-MultiThreadAndAdapter_OLD.cpp
+2675
-0
11-MultiThreadAndAdapter/Shader/11-DoNothingPS.hlsl
11-MultiThreadAndAdapter/Shader/11-DoNothingPS.hlsl
+13
-0
11-MultiThreadAndAdapter/Shader/11-GaussianBlurPS.hlsl
11-MultiThreadAndAdapter/Shader/11-GaussianBlurPS.hlsl
+54
-0
11-MultiThreadAndAdapter/Shader/11-MultiThreadAndAdapter.hlsl
...ultiThreadAndAdapter/Shader/11-MultiThreadAndAdapter.hlsl
+28
-0
11-MultiThreadAndAdapter/Shader/11-QuadVS.hlsl
11-MultiThreadAndAdapter/Shader/11-QuadVS.hlsl
+15
-0
11-MultiThreadAndAdapter/Shader/11-WaterColourPS.hlsl
11-MultiThreadAndAdapter/Shader/11-WaterColourPS.hlsl
+55
-0
11-MultiThreadAndAdapter/Shader/blurShaders_MS.hlsl
11-MultiThreadAndAdapter/Shader/blurShaders_MS.hlsl
+143
-0
7-D3D12MultiAdapter/7-D3D12MultiAdapter.cpp
7-D3D12MultiAdapter/7-D3D12MultiAdapter.cpp
+77
-30
D3D12 Tutorials.sln
D3D12 Tutorials.sln
+42
-0
未找到文件。
10-PixelShaderTips/10-PixelShaderTips.cpp
浏览文件 @
b5af17d4
...
...
@@ -214,7 +214,6 @@ TCHAR g_pszAppPath[MAX_PATH] = {};
UINT
g_nFunNO
=
0
;
//当前使用效果函数的序号(按空格键循环切换)
UINT
g_nMaxFunNO
=
12
;
//总的效果函数个数
float
g_fQuatLevel
=
2.0
f
;
//量化bit数,取值2-6
float
g_fWaterPower
=
40.0
f
;
//表示水彩扩展力度,单位为像素
...
...
10-PixelShaderTips/Shader/10-PixelShaderTips.hlsl
浏览文件 @
b5af17d4
...
...
@@ -199,9 +199,9 @@ float4 SobelAnisotropyContour(float2 v2UV, float2 v2TexSize)
);
float4
c4Color1
=
Do_Filter
(
mxOperators1
,
v2PixelSite
,
v2TexSize
,
g_texture
);
//
float4 c4Color2 = Do_Filter(mxOperators2, v2PixelSite, v2TexSize, g_texture);
float4
c4Color2
=
Do_Filter
(
mxOperators2
,
v2PixelSite
,
v2TexSize
,
g_texture
);
//
c4Color1 += c4Color2;
c4Color1
+=
c4Color2
;
////计算颜色溢色的简单方法
//float fMaxColorComponent
...
...
@@ -215,11 +215,22 @@ float4 SobelAnisotropyContour(float2 v2UV, float2 v2TexSize)
// , c4Color1.z))
// ,0.0f);
//c4Color1 = (c4Color1 - float4(fMinColorComponent
// , fMinColorComponent
// , fMinColorComponent
// , fMinColorComponent))
// /(fMaxColorComponent- fMinColorComponent);
//if (fMaxColorComponent - fMinColorComponent > 1.0f)
//{
// c4Color1 = (c4Color1 - float4(fMinColorComponent
// , fMinColorComponent
// , fMinColorComponent
// , fMinColorComponent))
// / (fMaxColorComponent - fMinColorComponent);
//}
//else if( fMinColorComponent < 1.0f )
//{
// c4Color1 = (c4Color1 - float4(fMinColorComponent
// , fMinColorComponent
// , fMinColorComponent
// , fMinColorComponent));
//}
float
fDeltaGray
=
0
.
3
f
*
c4Color1
.
x
+
0
.
59
*
c4Color1
.
y
+
0
.
11
*
c4Color1
.
z
;
...
...
11-MultiThreadAndAdapter/11-MultiThreadAndAdapter.cpp
0 → 100644
浏览文件 @
b5af17d4
此差异已折叠。
点击以展开。
11-MultiThreadAndAdapter/11-MultiThreadAndAdapter.vcxproj
0 → 100644
浏览文件 @
b5af17d4
<?xml version="1.0" encoding="utf-8"?>
<Project
DefaultTargets=
"Build"
xmlns=
"http://schemas.microsoft.com/developer/msbuild/2003"
>
<ItemGroup
Label=
"ProjectConfigurations"
>
<ProjectConfiguration
Include=
"Debug|Win32"
>
<Configuration>
Debug
</Configuration>
<Platform>
Win32
</Platform>
</ProjectConfiguration>
<ProjectConfiguration
Include=
"Release|Win32"
>
<Configuration>
Release
</Configuration>
<Platform>
Win32
</Platform>
</ProjectConfiguration>
<ProjectConfiguration
Include=
"Debug|x64"
>
<Configuration>
Debug
</Configuration>
<Platform>
x64
</Platform>
</ProjectConfiguration>
<ProjectConfiguration
Include=
"Release|x64"
>
<Configuration>
Release
</Configuration>
<Platform>
x64
</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup
Label=
"Globals"
>
<VCProjectVersion>
16.0
</VCProjectVersion>
<ProjectGuid>
{3F5D89CA-5D3A-45A8-AB4B-055E617E626A}
</ProjectGuid>
<Keyword>
Win32Proj
</Keyword>
<RootNamespace>
My11MultiThreadAndAdapter
</RootNamespace>
<WindowsTargetPlatformVersion>
10.0
</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import
Project=
"$(VCTargetsPath)\Microsoft.Cpp.Default.props"
/>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
Label=
"Configuration"
>
<ConfigurationType>
Application
</ConfigurationType>
<UseDebugLibraries>
true
</UseDebugLibraries>
<PlatformToolset>
v142
</PlatformToolset>
<CharacterSet>
Unicode
</CharacterSet>
</PropertyGroup>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
Label=
"Configuration"
>
<ConfigurationType>
Application
</ConfigurationType>
<UseDebugLibraries>
false
</UseDebugLibraries>
<PlatformToolset>
v142
</PlatformToolset>
<WholeProgramOptimization>
true
</WholeProgramOptimization>
<CharacterSet>
Unicode
</CharacterSet>
</PropertyGroup>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
Label=
"Configuration"
>
<ConfigurationType>
Application
</ConfigurationType>
<UseDebugLibraries>
true
</UseDebugLibraries>
<PlatformToolset>
v142
</PlatformToolset>
<CharacterSet>
Unicode
</CharacterSet>
</PropertyGroup>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
Label=
"Configuration"
>
<ConfigurationType>
Application
</ConfigurationType>
<UseDebugLibraries>
false
</UseDebugLibraries>
<PlatformToolset>
v142
</PlatformToolset>
<WholeProgramOptimization>
true
</WholeProgramOptimization>
<CharacterSet>
Unicode
</CharacterSet>
</PropertyGroup>
<Import
Project=
"$(VCTargetsPath)\Microsoft.Cpp.props"
/>
<ImportGroup
Label=
"ExtensionSettings"
>
</ImportGroup>
<ImportGroup
Label=
"Shared"
>
</ImportGroup>
<ImportGroup
Label=
"PropertySheets"
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
<Import
Project=
"$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
Condition=
"exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
Label=
"LocalAppDataPlatform"
/>
</ImportGroup>
<ImportGroup
Label=
"PropertySheets"
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
<Import
Project=
"$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
Condition=
"exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
Label=
"LocalAppDataPlatform"
/>
</ImportGroup>
<ImportGroup
Label=
"PropertySheets"
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
<Import
Project=
"$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
Condition=
"exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
Label=
"LocalAppDataPlatform"
/>
</ImportGroup>
<ImportGroup
Label=
"PropertySheets"
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
>
<Import
Project=
"$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
Condition=
"exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
Label=
"LocalAppDataPlatform"
/>
</ImportGroup>
<PropertyGroup
Label=
"UserMacros"
/>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
<LinkIncremental>
true
</LinkIncremental>
<OutDir>
$(SolutionDir)$(Configuration)\$(Platform)\
</OutDir>
<IntDir>
$(Configuration)\$(Platform)\
</IntDir>
</PropertyGroup>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
<LinkIncremental>
true
</LinkIncremental>
</PropertyGroup>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
<LinkIncremental>
false
</LinkIncremental>
</PropertyGroup>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
>
<LinkIncremental>
false
</LinkIncremental>
<OutDir>
$(SolutionDir)$(Configuration)\$(Platform)\
</OutDir>
<IntDir>
$(Configuration)\$(Platform)\
</IntDir>
</PropertyGroup>
<ItemDefinitionGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
<ClCompile>
<WarningLevel>
Level3
</WarningLevel>
<Optimization>
Disabled
</Optimization>
<SDLCheck>
true
</SDLCheck>
<PreprocessorDefinitions>
_DEBUG;_WINDOWS;%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<ConformanceMode>
true
</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>
Windows
</SubSystem>
<GenerateDebugInformation>
true
</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
<ClCompile>
<WarningLevel>
Level3
</WarningLevel>
<Optimization>
Disabled
</Optimization>
<SDLCheck>
true
</SDLCheck>
<PreprocessorDefinitions>
WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<ConformanceMode>
true
</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>
Windows
</SubSystem>
<GenerateDebugInformation>
true
</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
<ClCompile>
<WarningLevel>
Level3
</WarningLevel>
<Optimization>
MaxSpeed
</Optimization>
<FunctionLevelLinking>
true
</FunctionLevelLinking>
<IntrinsicFunctions>
true
</IntrinsicFunctions>
<SDLCheck>
true
</SDLCheck>
<PreprocessorDefinitions>
WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<ConformanceMode>
true
</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>
Windows
</SubSystem>
<EnableCOMDATFolding>
true
</EnableCOMDATFolding>
<OptimizeReferences>
true
</OptimizeReferences>
<GenerateDebugInformation>
true
</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
>
<ClCompile>
<WarningLevel>
Level3
</WarningLevel>
<Optimization>
MaxSpeed
</Optimization>
<FunctionLevelLinking>
true
</FunctionLevelLinking>
<IntrinsicFunctions>
true
</IntrinsicFunctions>
<SDLCheck>
true
</SDLCheck>
<PreprocessorDefinitions>
NDEBUG;_WINDOWS;%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<ConformanceMode>
true
</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>
Windows
</SubSystem>
<EnableCOMDATFolding>
true
</EnableCOMDATFolding>
<OptimizeReferences>
true
</OptimizeReferences>
<GenerateDebugInformation>
true
</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile
Include=
"..\WindowsCommons\DDSTextureLoader12.cpp"
/>
<ClCompile
Include=
"11-MultiThreadAndAdapter.cpp"
>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
true
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
>
true
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
true
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
true
</ExcludedFromBuild>
</ClCompile>
<ClCompile
Include=
"11-MultiThreadAndAdapter_OLD.cpp"
>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
false
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
>
false
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
false
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
false
</ExcludedFromBuild>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude
Include=
"..\WindowsCommons\DDSTextureLoader12.h"
/>
</ItemGroup>
<ItemGroup>
<None
Include=
"Shader\11-MultiThreadAndAdapter.hlsl"
>
<FileType>
Document
</FileType>
</None>
</ItemGroup>
<ItemGroup>
<None
Include=
"Shader\11-WaterColourPS.hlsl"
>
<FileType>
Document
</FileType>
</None>
</ItemGroup>
<ItemGroup>
<None
Include=
"Shader\11-QuadVS.hlsl"
>
<FileType>
Document
</FileType>
</None>
</ItemGroup>
<ItemGroup>
<None
Include=
"Shader\11-GaussianBlurPS.hlsl"
>
<FileType>
Document
</FileType>
</None>
</ItemGroup>
<ItemGroup>
<None
Include=
"Shader\11-DoNothingPS.hlsl"
>
<FileType>
Document
</FileType>
</None>
</ItemGroup>
<ItemGroup>
<None
Include=
"Shader\blurShaders_MS.hlsl"
>
<FileType>
Document
</FileType>
</None>
</ItemGroup>
<Import
Project=
"$(VCTargetsPath)\Microsoft.Cpp.targets"
/>
<ImportGroup
Label=
"ExtensionTargets"
>
</ImportGroup>
</Project>
\ No newline at end of file
11-MultiThreadAndAdapter/11-MultiThreadAndAdapter.vcxproj.filters
0 → 100644
浏览文件 @
b5af17d4
<?xml version="1.0" encoding="utf-8"?>
<Project
ToolsVersion=
"4.0"
xmlns=
"http://schemas.microsoft.com/developer/msbuild/2003"
>
<ItemGroup>
<Filter
Include=
"源文件"
>
<UniqueIdentifier>
{4FC737F1-C7A5-4376-A066-2A32D752A2FF}
</UniqueIdentifier>
<Extensions>
cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
</Extensions>
</Filter>
<Filter
Include=
"头文件"
>
<UniqueIdentifier>
{93995380-89BD-4b04-88EB-625FBE52EBFB}
</UniqueIdentifier>
<Extensions>
h;hh;hpp;hxx;hm;inl;inc;ipp;xsd
</Extensions>
</Filter>
<Filter
Include=
"资源文件"
>
<UniqueIdentifier>
{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
</UniqueIdentifier>
<Extensions>
rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
</Extensions>
</Filter>
<Filter
Include=
"Shader"
>
<UniqueIdentifier>
{430d2d2c-34ac-47c3-9d09-88fe3c1ad96f}
</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile
Include=
"..\WindowsCommons\DDSTextureLoader12.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
<ClCompile
Include=
"11-MultiThreadAndAdapter_OLD.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
<ClCompile
Include=
"11-MultiThreadAndAdapter.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude
Include=
"..\WindowsCommons\DDSTextureLoader12.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None
Include=
"Shader\11-MultiThreadAndAdapter.hlsl"
>
<Filter>
Shader
</Filter>
</None>
<None
Include=
"Shader\11-QuadVS.hlsl"
>
<Filter>
Shader
</Filter>
</None>
<None
Include=
"Shader\11-WaterColourPS.hlsl"
>
<Filter>
Shader
</Filter>
</None>
<None
Include=
"Shader\blurShaders_MS.hlsl"
/>
<None
Include=
"Shader\11-DoNothingPS.hlsl"
>
<Filter>
Shader
</Filter>
</None>
<None
Include=
"Shader\11-GaussianBlurPS.hlsl"
>
<Filter>
Shader
</Filter>
</None>
</ItemGroup>
</Project>
\ No newline at end of file
11-MultiThreadAndAdapter/11-MultiThreadAndAdapter.vcxproj.user
0 → 100644
浏览文件 @
b5af17d4
<?xml version="1.0" encoding="utf-8"?>
<Project
ToolsVersion=
"Current"
xmlns=
"http://schemas.microsoft.com/developer/msbuild/2003"
>
<PropertyGroup
/>
</Project>
\ No newline at end of file
11-MultiThreadAndAdapter/11-MultiThreadAndAdapter_OLD.cpp
0 → 100644
浏览文件 @
b5af17d4
此差异已折叠。
点击以展开。
11-MultiThreadAndAdapter/Shader/11-DoNothingPS.hlsl
0 → 100644
浏览文件 @
b5af17d4
struct
PSInput
{
float4
m_v4Pos
:
SV_POSITION
;
float2
m_v2UV
:
TEXCOORD0
;
};
Texture2D
g_texture
:
register
(
t0
);
SamplerState
g_sampler
:
register
(
s0
);
float4
PSMain
(
PSInput
input
)
:
SV_TARGET
{
return
g_texture
.
Sample
(
g_sampler
,
input
.
m_v2UV
);
}
11-MultiThreadAndAdapter/Shader/11-GaussianBlurPS.hlsl
0 → 100644
浏览文件 @
b5af17d4
struct
PSInput
{
float4
m_v4Pos
:
SV_POSITION
;
float2
m_v2UV
:
TEXCOORD0
;
};
Texture2D
g_texture
:
register
(
t0
);
SamplerState
g_sampler
:
register
(
s0
);
float4
Do_Filter
(
float3x3
mxFilter
,
float2
v2UV
,
float2
v2TexSize
,
Texture2D
t2dTexture
)
{
//根据滤波矩阵计算“九宫格”形式像素的滤波结果的函数
float2
v2aUVDelta
[
3
][
3
]
=
{
{
float2
(
-
1
.
0
f
,
-
1
.
0
f
),
float2
(
0
.
0
f
,
-
1
.
0
f
),
float2
(
1
.
0
f
,
-
1
.
0
f
)
},
{
float2
(
-
1
.
0
f
,
0
.
0
f
),
float2
(
0
.
0
f
,
0
.
0
f
),
float2
(
1
.
0
f
,
0
.
0
f
)
},
{
float2
(
-
1
.
0
f
,
1
.
0
f
),
float2
(
0
.
0
f
,
1
.
0
f
),
float2
(
1
.
0
f
,
1
.
0
f
)
},
};
float4
c4Color
=
float4
(
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
);
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
for
(
int
j
=
0
;
j
<
3
;
j
++
)
{
//计算采样点,得到当前像素附件的像素点的坐标(上下左右,八方)
float2
v2NearbySite
=
v2UV
+
v2aUVDelta
[
i
][
j
];
float2
v2NearbyUV
=
float2
(
v2NearbySite
.
x
/
v2TexSize
.
x
,
v2NearbySite
.
y
/
v2TexSize
.
y
);
c4Color
+=
(
t2dTexture
.
Sample
(
g_sampler
,
v2NearbyUV
)
*
mxFilter
[
i
][
j
]);
}
}
return
c4Color
;
}
float4
GaussianFlur
(
float2
v2UV
)
{
//高斯模糊
float2
v2TexSize
;
//读取纹理像素尺寸
g_texture
.
GetDimensions
(
v2TexSize
.
x
,
v2TexSize
.
y
);
float2
v2PixelSite
=
float2
(
v2UV
.
x
*
v2TexSize
.
x
,
v2UV
.
y
*
v2TexSize
.
y
);
float3x3
mxOperators
=
float3x3
(
1
.
0
f
/
16
.
0
f
,
2
.
0
f
/
16
.
0
f
,
1
.
0
f
/
16
.
0
f
,
2
.
0
f
/
16
.
0
f
,
4
.
0
f
/
16
.
0
f
,
2
.
0
f
/
16
.
0
f
,
1
.
0
f
/
16
.
0
f
,
2
.
0
f
/
16
.
0
f
,
1
.
0
f
/
16
.
0
f
);
return
Do_Filter
(
mxOperators
,
v2PixelSite
,
v2TexSize
,
g_texture
);
}
float4
PSMain
(
PSInput
input
)
:
SV_TARGET
{
return
GaussianFlur
(
input
.
m_v2UV
);;
}
11-MultiThreadAndAdapter/Shader/11-MultiThreadAndAdapter.hlsl
0 → 100644
浏览文件 @
b5af17d4
struct
PSInput
{
float4
m_v4Position
:
SV_POSITION
;
float2
m_v2UV
:
TEXCOORD
;
};
cbuffer
MVPBuffer
:
register
(
b0
)
{
float4x4
m_MVP
;
};
Texture2D
g_texture
:
register
(
t0
);
SamplerState
g_sampler
:
register
(
s0
);
PSInput
VSMain
(
float4
v4Position
:
POSITION
,
float2
v2UV
:
TEXCOORD
,
float3
v3Normal
:
NORMAL
)
{
PSInput
stResult
;
stResult
.
m_v4Position
=
mul
(
v4Position
,
m_MVP
);
stResult
.
m_v2UV
=
v2UV
;
return
stResult
;
}
float4
PSMain
(
PSInput
stPSInput
)
:
SV_TARGET
{
return
g_texture
.
Sample
(
g_sampler
,
stPSInput
.
m_v2UV
);
}
11-MultiThreadAndAdapter/Shader/11-QuadVS.hlsl
0 → 100644
浏览文件 @
b5af17d4
//ˮʻЧShader
struct
PSInput
{
float4
m_v4Pos
:
SV_POSITION
;
float2
m_v2UV
:
TEXCOORD0
;
};
PSInput
VSMain
(
float4
v4Pos
:
POSITION
,
float2
v2UV
:
TEXCOORD0
)
{
PSInput
stResult
;
stResult
.
m_v4Pos
=
v4Pos
;
stResult
.
m_v2UV
=
v2UV
;
return
stResult
;
}
\ No newline at end of file
11-MultiThreadAndAdapter/Shader/11-WaterColourPS.hlsl
0 → 100644
浏览文件 @
b5af17d4
//水彩画效果Shader
struct
PSInput
{
float4
m_v4Pos
:
SV_POSITION
;
float2
m_v2UV
:
TEXCOORD0
;
};
cbuffer
PerObjBuffer
:
register
(
b0
)
{
uint
g_nFun
;
float
g_fQuatLevel
=
2
.
0
f
;
//量化bit数,取值2-6
float
g_fWaterPower
=
40
.
0
f
;
//表示水彩扩展力度,单位为像素
};
Texture2D
g_texture
:
register
(
t0
);
Texture2D
g_texNoise
:
register
(
t1
);
//噪声纹理
SamplerState
g_sampler
:
register
(
s0
);
float4
Quant
(
float4
c4Color
,
float
n
)
{
c4Color
.
x
=
int
(
c4Color
.
x
*
255
/
n
)
*
n
/
255
;
c4Color
.
y
=
int
(
c4Color
.
y
*
255
/
n
)
*
n
/
255
;
c4Color
.
z
=
int
(
c4Color
.
z
*
255
/
n
)
*
n
/
255
;
return
c4Color
;
}
float4
Watercolour
(
float2
v2UV
,
float2
v2TexSize
)
{
float4
c4NoiseColor
=
g_fWaterPower
*
g_texNoise
.
Sample
(
g_sampler
,
v2UV
);
float2
v2NewUV
=
float2
(
v2UV
.
x
+
c4NoiseColor
.
x
/
v2TexSize
.
x
,
v2UV
.
y
+
c4NoiseColor
.
y
/
v2TexSize
.
y
);
float4
c4Color
=
g_texture
.
Sample
(
g_sampler
,
v2NewUV
);
return
Quant
(
c4Color
,
255
/
pow
(
2
,
g_fQuatLevel
));
}
float4
PSMain
(
PSInput
input
)
:
SV_TARGET
{
float4
c4PixelColor
;
float2
v2TexSize
;
//读取纹理像素尺寸
g_texture
.
GetDimensions
(
v2TexSize
.
x
,
v2TexSize
.
y
);
if
(
1
==
g_nFun
)
{
//水彩画效果
c4PixelColor
=
Watercolour
(
input
.
m_v2UV
,
v2TexSize
);
}
else
{
//默认原图
c4PixelColor
=
g_texture
.
Sample
(
g_sampler
,
input
.
m_v2UV
);
}
return
c4PixelColor
;
}
11-MultiThreadAndAdapter/Shader/blurShaders_MS.hlsl
0 → 100644
浏览文件 @
b5af17d4
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
//这个Shader改编自微软官方D3D12示例,删除了不必要的VS函数,以及啰嗦的为测试性能而编造的假循环
struct
PSInput
{
float4
m_v4Position
:
SV_POSITION
;
float2
m_v2UV
:
TEXCOORD
;
};
static
const
float
KernelOffsets
[
3
]
=
{
0
.
0
f
,
1
.
3846153846
f
,
3
.
2307692308
f
};
static
const
float
BlurWeights
[
3
]
=
{
0
.
2270270270
f
,
0
.
3162162162
f
,
0
.
0702702703
f
};
// The input texture to blur.
Texture2D
g_Texture
:
register
(
t0
);
SamplerState
g_LinearSampler
:
register
(
s0
);
//把两个方向的模糊组合到一起计算
//正确的做法是垂直-水平两个方向分开各模糊一次,
//那样后处理需要两遍Pass,程序就过于啰嗦和复杂,不适合作为例子教程了
float4
PSSimpleBlur
(
PSInput
input
)
:
SV_TARGET
{
float3
textureColor
=
float3
(
1
.
0
f
,
0
.
0
f
,
0
.
0
f
);
float2
m_v2UV
=
input
.
m_v2UV
;
float2
v2TexSize
;
//读取纹理像素尺寸
g_Texture
.
GetDimensions
(
v2TexSize
.
x
,
v2TexSize
.
y
);
textureColor
=
g_Texture
.
Sample
(
g_LinearSampler
,
m_v2UV
).
xyz
*
BlurWeights
[
0
];
for
(
int
i
=
1
;
i
<
3
;
i
++
)
{
float2
normalizedOffset
=
float2
(
KernelOffsets
[
i
],
0
.
0
f
)
/
v2TexSize
.
x
;
textureColor
+=
g_Texture
.
Sample
(
g_LinearSampler
,
m_v2UV
+
normalizedOffset
).
xyz
*
BlurWeights
[
i
];
textureColor
+=
g_Texture
.
Sample
(
g_LinearSampler
,
m_v2UV
-
normalizedOffset
).
xyz
*
BlurWeights
[
i
];
normalizedOffset
=
float2
(
0
.
0
f
,
KernelOffsets
[
i
])
/
v2TexSize
.
y
;
textureColor
+=
g_Texture
.
Sample
(
g_LinearSampler
,
m_v2UV
+
normalizedOffset
).
xyz
*
BlurWeights
[
i
];
textureColor
+=
g_Texture
.
Sample
(
g_LinearSampler
,
m_v2UV
-
normalizedOffset
).
xyz
*
BlurWeights
[
i
];
}
textureColor
/=
1
.
8
f
;
return
float4
(
textureColor
,
1
.
0
);
}
// Simple gaussian blur in the vertical direction.
float4
PSSimpleBlurV
(
PSInput
input
)
:
SV_TARGET
{
float3
textureColor
=
float3
(
1
.
0
f
,
0
.
0
f
,
0
.
0
f
);
float2
m_v2UV
=
input
.
m_v2UV
;
float2
v2TexSize
;
//读取纹理像素尺寸
g_Texture
.
GetDimensions
(
v2TexSize
.
x
,
v2TexSize
.
y
);
textureColor
=
g_Texture
.
Sample
(
g_LinearSampler
,
m_v2UV
).
xyz
*
BlurWeights
[
0
];
for
(
int
i
=
1
;
i
<
3
;
i
++
)
{
float2
normalizedOffset
=
float2
(
0
.
0
f
,
KernelOffsets
[
i
])
/
v2TexSize
.
y
;
textureColor
+=
g_Texture
.
Sample
(
g_LinearSampler
,
m_v2UV
+
normalizedOffset
).
xyz
*
BlurWeights
[
i
];
textureColor
+=
g_Texture
.
Sample
(
g_LinearSampler
,
m_v2UV
-
normalizedOffset
).
xyz
*
BlurWeights
[
i
];
}
return
float4
(
textureColor
,
1
.
0
);
}
// Simple gaussian blur in the horizontal direction.
float4
PSSimpleBlurU
(
PSInput
input
)
:
SV_TARGET
{
float3
textureColor
=
float3
(
1
.
0
f
,
0
.
0
f
,
0
.
0
f
);
float2
m_v2UV
=
input
.
m_v2UV
;
float2
v2TexSize
;
//读取纹理像素尺寸
g_Texture
.
GetDimensions
(
v2TexSize
.
x
,
v2TexSize
.
y
);
textureColor
=
g_Texture
.
Sample
(
g_LinearSampler
,
m_v2UV
).
xyz
*
BlurWeights
[
0
];
for
(
int
i
=
1
;
i
<
3
;
i
++
)
{
float2
normalizedOffset
=
float2
(
KernelOffsets
[
i
],
0
.
0
f
)
/
v2TexSize
.
x
;
textureColor
+=
g_Texture
.
Sample
(
g_LinearSampler
,
m_v2UV
+
normalizedOffset
).
xyz
*
BlurWeights
[
i
];
textureColor
+=
g_Texture
.
Sample
(
g_LinearSampler
,
m_v2UV
-
normalizedOffset
).
xyz
*
BlurWeights
[
i
];
}
return
float4
(
textureColor
,
1
.
0
);
}
/////-----------------------------------------------------------------------------------
//void main()
//{
// vec4 textureColor;
// vec4 outColor;
// vec4 U;
// vec4 V;
//
// if (PixFormat == 1000.0f)
// {
// //RGB32
// textureColor = vec4(texture2D(textureUniformRGBA, textureCoordinate));
// textureColor.a = textureColor.a * RGB_Alpha;
// }
// else
// {
// //YUV420 TO RGB32
// textureColor = vec4((texture2D(textureUniformY, textureCoordinate).r - 16. / 255.) * 1.164);
// U = vec4(texture2D(textureUniformU, textureCoordinate).r - 128. / 255.);
// V = vec4(texture2D(textureUniformV, textureCoordinate).r - 128. / 255.);
// textureColor += V * vec4(1.596, -0.813, 0, 0);
// textureColor += U * vec4(0, -0.392, 2.017, 0);
// textureColor.a = RGB_Alpha;
// }
// if (1 == dark)
// {
// float brightness = 0.45f;
// //模糊
// vec2 firstOffset = vec2(1.3846153846 * texelWidthOffset, 1.3846153846 * texelHeightOffset) * blurSize;
// vec2 secondOffset = vec2(3.2307692308 * texelWidthOffset, 3.2307692308 * texelHeightOffset) * blurSize;
//
// centerTextureCoordinate = textureCoordinate;
// oneStepLeftTextureCoordinate = textureCoordinate - firstOffset;
// twoStepsLeftTextureCoordinate = textureCoordinate - secondOffset;
// oneStepRightTextureCoordinate = textureCoordinate + firstOffset;
// twoStepsRightTextureCoordinate = textureCoordinate + secondOffset;
//
// vec4 fragmentColor = texture2D(textureUniformRGBA, centerTextureCoordinate) * 0.2270270270;
// fragmentColor += texture2D(textureUniformRGBA, oneStepLeftTextureCoordinate) * 0.3162162162;
// fragmentColor += texture2D(textureUniformRGBA, oneStepRightTextureCoordinate) * 0.3162162162;
// fragmentColor += texture2D(textureUniformRGBA, twoStepsLeftTextureCoordinate) * 0.0702702703; /
// fragmentColor += texture2D(textureUniformRGBA, twoStepsRightTextureCoordinate) * 0.0702702703;
//
// //加暗
// textureColor = vec4((fragmentColor.rgb * vec3(brightness)), fragmentColor.a);
// //最后画面
// gl_FragColor = textureColor;
//
// }
//}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
\ No newline at end of file
7-D3D12MultiAdapter/7-D3D12MultiAdapter.cpp
浏览文件 @
b5af17d4
...
...
@@ -247,6 +247,7 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR l
const
float
arf4ClearColor
[
4
]
=
{
0.2
f
,
0.5
f
,
1.0
f
,
1.0
f
};
ComPtr
<
IDXGIFactory5
>
pIDXGIFactory5
;
ComPtr
<
IDXGIFactory6
>
pIDXGIFactory6
;
ComPtr
<
IDXGISwapChain1
>
pISwapChain1
;
ComPtr
<
IDXGISwapChain3
>
pISwapChain3
;
...
...
@@ -336,6 +337,9 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR l
GRS_SET_DXGI_DEBUGNAME_COMPTR
(
pIDXGIFactory5
);
// 关闭ALT+ENTER键切换全屏的功能,因为我们没有实现OnSize处理,所以先关闭
GRS_THROW_IF_FAILED
(
pIDXGIFactory5
->
MakeWindowAssociation
(
hWnd
,
DXGI_MWA_NO_ALT_ENTER
));
//获取IDXGIFactory6接口
GRS_THROW_IF_FAILED
(
pIDXGIFactory5
.
As
(
&
pIDXGIFactory6
));
GRS_SET_DXGI_DEBUGNAME_COMPTR
(
pIDXGIFactory6
);
}
// 枚举适配器创建设备
...
...
@@ -343,39 +347,70 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR l
//,它里面用的就是序号0默认是集显1是独显然后按主次创建
D3D12_FEATURE_DATA_ARCHITECTURE
stArchitecture
=
{};
DXGI_ADAPTER_DESC1
stAdapterDesc
=
{};
IDXGIAdapter1
*
pIAdapterTmp
=
nullptr
;
ID3D12Device4
*
pID3DDeviceTmp
=
nullptr
;
IDXGIOutput
*
pIOutput
=
nullptr
;
HRESULT
hrEnumOutput
=
S_OK
;
for
(
UINT
nAdapterIndex
=
0
;
DXGI_ERROR_NOT_FOUND
!=
pIDXGIFactory5
->
EnumAdapters1
(
nAdapterIndex
,
&
pIAdapterTmp
);
++
nAdapterIndex
)
UINT
i
=
0
;
for
(
i
=
0
;
(
i
<
nMaxGPUParams
)
&&
SUCCEEDED
(
pIDXGIFactory6
->
EnumAdapterByGpuPreference
(
i
,
DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE
,
IID_PPV_ARGS
(
&
pIAdapterTmp
)));
++
i
)
{
DXGI_ADAPTER_DESC1
stAdapterDesc
=
{}
;
pIAdapterTmp
->
GetDesc1
(
&
stAdapterDesc
);
ZeroMemory
(
&
stAdapterDesc
,
sizeof
(
DXGI_ADAPTER_DESC1
))
;
GRS_THROW_IF_FAILED
(
pIAdapterTmp
->
GetDesc1
(
&
stAdapterDesc
)
);
if
(
stAdapterDesc
.
Flags
&
DXGI_ADAPTER_FLAG_SOFTWARE
)
{
//跳过软件虚拟适配器设备
GRS_SAFE_RELEASE
(
pIAdapterTmp
);
{
//跳过软件虚拟适配器设备
,
//注释这个if判断,可以使用一个真实GPU和一个虚拟软适配器来看双GPU的示例
continue
;
}
//第一种方法,通过判定那个显卡带有输出
hrEnumOutput
=
pIAdapterTmp
->
EnumOutputs
(
0
,
&
pIOutput
);
if
(
SUCCEEDED
(
hrEnumOutput
)
&&
nullptr
!=
pIOutput
)
{
//该适配器带有显示输出,通常是集显(针对笔记本的情况)
//我们将集显称为Main Device,因为用它来后处理和最终输出
if
(
i
==
nIDGPUMain
)
{
GRS_THROW_IF_FAILED
(
D3D12CreateDevice
(
pIAdapterTmp
,
D3D_FEATURE_LEVEL_12_1
,
IID_PPV_ARGS
(
&
stGPUParams
[
nIDGPUMain
].
m_pID3DDevice
)));
}
else
{
//不带显示输出的,通常是独显(针对笔记本的情况)
//我们用独显来完成主场景渲染,当然它就是渲染到纹理,后面会看到我们使用的是共享显存的纹理
GRS_THROW_IF_FAILED
(
D3D12CreateDevice
(
pIAdapterTmp
,
D3D_FEATURE_LEVEL_12_1
,
IID_PPV_ARGS
(
&
stGPUParams
[
nIDGPUSecondary
].
m_pID3DDevice
)));
{
GRS_THROW_IF_FAILED
(
D3D12CreateDevice
(
pIAdapterTmp
,
D3D_FEATURE_LEVEL_12_1
,
IID_PPV_ARGS
(
&
stGPUParams
[
nIDGPUSecondary
].
m_pID3DDevice
)));
}
GRS_SAFE_RELEASE
(
pIOutput
);
//for ( UINT nAdapterIndex = 0; DXGI_ERROR_NOT_FOUND != pIDXGIFactory5->EnumAdapters1(nAdapterIndex, &pIAdapterTmp); ++ nAdapterIndex)
//{
//
// pIAdapterTmp->GetDesc1(&stAdapterDesc);
// if (stAdapterDesc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE)
// {//跳过软件虚拟适配器设备
// GRS_SAFE_RELEASE(pIAdapterTmp);
// continue;
// }
// //第一种方法,通过判定那个显卡带有输出
// hrEnumOutput = pIAdapterTmp->EnumOutputs(0, &pIOutput);
// if ( SUCCEEDED(hrEnumOutput) && nullptr != pIOutput)
// {//该适配器带有显示输出,通常是集显(针对笔记本的情况)
// //我们将集显称为Main Device,因为用它来后处理和最终输出
// GRS_THROW_IF_FAILED(D3D12CreateDevice(pIAdapterTmp
// , D3D_FEATURE_LEVEL_12_1
// , IID_PPV_ARGS(&stGPUParams[nIDGPUMain].m_pID3DDevice)));
// }
// else
// {//不带显示输出的,通常是独显(针对笔记本的情况)
// //我们用独显来完成主场景渲染,当然它就是渲染到纹理,后面会看到我们使用的是共享显存的纹理
// GRS_THROW_IF_FAILED(D3D12CreateDevice(pIAdapterTmp, D3D_FEATURE_LEVEL_12_1, IID_PPV_ARGS(&stGPUParams[nIDGPUSecondary].m_pID3DDevice)));
// }
//
// GRS_SAFE_RELEASE(pIOutput);
//第二种判定主次显卡的方法,就是看谁是UMA的谁不是,这个在之前的教程示例中已经详细讲解过
...
...
@@ -416,8 +451,10 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR l
}
//---------------------------------------------------------------------------------------------
if
(
nullptr
==
stGPUParams
[
nIDGPUMain
].
m_pID3DDevice
.
Get
()
||
nullptr
==
stGPUParams
[
nIDGPUSecondary
].
m_pID3DDevice
.
Get
()
)
if
(
nullptr
==
stGPUParams
[
nIDGPUMain
].
m_pID3DDevice
.
Get
()
||
nullptr
==
stGPUParams
[
nIDGPUSecondary
].
m_pID3DDevice
.
Get
()
)
{
// 可怜的机器上居然没有两个以上的显卡 还是先退出了事 当然你可以使用软适配器凑活看下例子
OutputDebugString
(
_T
(
"
\n
机器中显卡数量不足两个,示例程序退出!
\n
"
));
throw
CGRSCOMException
(
E_FAIL
);
}
...
...
@@ -577,7 +614,7 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR l
,
IID_PPV_ARGS
(
&
stGPUParams
[
iGPUIndex
].
m_pICmdList
)));
if
(
SUCCEEDED
(
StringCchPrintfW
(
pszDebugName
,
MAX_PATH
,
L"stGPUParams[%u].m_pICmdList
%s[%u]
"
,
iGPUIndex
)))
if
(
SUCCEEDED
(
StringCchPrintfW
(
pszDebugName
,
MAX_PATH
,
L"stGPUParams[%u].m_pICmdList"
,
iGPUIndex
)))
{
stGPUParams
[
iGPUIndex
].
m_pICmdList
->
SetName
(
pszDebugName
);
}
...
...
@@ -737,7 +774,8 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR l
// 检测是否支持V1.1版本的根签名
stFeatureData
.
HighestVersion
=
D3D_ROOT_SIGNATURE_VERSION_1_1
;
if
(
FAILED
(
stGPUParams
[
nIDGPUMain
].
m_pID3DDevice
->
CheckFeatureSupport
(
D3D12_FEATURE_ROOT_SIGNATURE
,
&
stFeatureData
,
sizeof
(
stFeatureData
))))
if
(
FAILED
(
stGPUParams
[
nIDGPUMain
].
m_pID3DDevice
->
CheckFeatureSupport
(
D3D12_FEATURE_ROOT_SIGNATURE
,
&
stFeatureData
,
sizeof
(
stFeatureData
))))
{
stFeatureData
.
HighestVersion
=
D3D_ROOT_SIGNATURE_VERSION_1_0
;
}
...
...
@@ -1368,16 +1406,21 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR l
stGPUParams
[
nIDGPUMain
].
m_pIDHRTV
->
GetCPUDescriptorHandleForHeapStart
()
,
nCurrentFrameIndex
,
stGPUParams
[
nIDGPUMain
].
m_nszRTV
);
CD3DX12_CPU_DESCRIPTOR_HANDLE
dsvHandle
(
stGPUParams
[
nIDGPUMain
].
m_pIDHDSVTex
->
GetCPUDescriptorHandleForHeapStart
());
stGPUParams
[
nIDGPUMain
].
m_pICmdList
->
OMSetRenderTargets
(
1
,
&
rtvHandle
,
false
,
&
dsvHandle
);
stGPUParams
[
nIDGPUMain
].
m_pICmdList
->
ClearRenderTargetView
(
rtvHandle
,
arf4ClearColor
,
0
,
nullptr
);
stGPUParams
[
nIDGPUMain
].
m_pICmdList
->
ClearDepthStencilView
(
dsvHandle
,
D3D12_CLEAR_FLAG_DEPTH
,
1.0
f
,
0
,
0
,
nullptr
);
CD3DX12_CPU_DESCRIPTOR_HANDLE
dsvHandle
(
stGPUParams
[
nIDGPUMain
].
m_pIDHDSVTex
->
GetCPUDescriptorHandleForHeapStart
());
stGPUParams
[
nIDGPUMain
].
m_pICmdList
->
OMSetRenderTargets
(
1
,
&
rtvHandle
,
false
,
&
dsvHandle
);
stGPUParams
[
nIDGPUMain
].
m_pICmdList
->
ClearRenderTargetView
(
rtvHandle
,
arf4ClearColor
,
0
,
nullptr
);
stGPUParams
[
nIDGPUMain
].
m_pICmdList
->
ClearDepthStencilView
(
dsvHandle
,
D3D12_CLEAR_FLAG_DEPTH
,
1.0
f
,
0
,
0
,
nullptr
);
//执行实际的物体绘制渲染,Draw Call!
for
(
int
i
=
0
;
i
<
nMaxObject
;
i
++
)
{
ID3D12DescriptorHeap
*
ppHeapsSkybox
[]
=
{
stModuleParams
[
i
].
pISRVCBVHp
.
Get
(),
stModuleParams
[
i
].
pISampleHp
.
Get
()
};
ID3D12DescriptorHeap
*
ppHeapsSkybox
[]
=
{
stModuleParams
[
i
].
pISRVCBVHp
.
Get
(),
stModuleParams
[
i
].
pISampleHp
.
Get
()
};
stGPUParams
[
nIDGPUMain
].
m_pICmdList
->
SetDescriptorHeaps
(
_countof
(
ppHeapsSkybox
),
ppHeapsSkybox
);
stGPUParams
[
nIDGPUMain
].
m_pICmdList
->
ExecuteBundle
(
stModuleParams
[
i
].
pIBundle
.
Get
());
}
...
...
@@ -1392,11 +1435,14 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR l
}
{
// 第一步:在主显卡的主命令队列上执行主命令列表
ID3D12CommandList
*
ppRenderCommandLists
[]
=
{
stGPUParams
[
nIDGPUMain
].
m_pICmdList
.
Get
()
};
stGPUParams
[
nIDGPUMain
].
m_pICmdQueue
->
ExecuteCommandLists
(
_countof
(
ppRenderCommandLists
),
ppRenderCommandLists
);
ID3D12CommandList
*
ppRenderCommandLists
[]
=
{
stGPUParams
[
nIDGPUMain
].
m_pICmdList
.
Get
()
};
stGPUParams
[
nIDGPUMain
].
m_pICmdQueue
->
ExecuteCommandLists
(
_countof
(
ppRenderCommandLists
),
ppRenderCommandLists
);
n64CurrentFenceValue
=
n64FenceValue
;
GRS_THROW_IF_FAILED
(
stGPUParams
[
nIDGPUMain
].
m_pICmdQueue
->
Signal
(
stGPUParams
[
nIDGPUMain
].
m_pIFence
.
Get
(),
n64CurrentFenceValue
));
GRS_THROW_IF_FAILED
(
stGPUParams
[
nIDGPUMain
].
m_pICmdQueue
->
Signal
(
stGPUParams
[
nIDGPUMain
].
m_pIFence
.
Get
(),
n64CurrentFenceValue
));
n64FenceValue
++
;
}
...
...
@@ -1405,7 +1451,8 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR l
if
(
bCrossAdapterTextureSupport
)
{
// 如果适配器支持跨适配器行主纹理,只需将该纹理复制到跨适配器纹理中。
pICmdListCopy
->
CopyResource
(
stGPUParams
[
nIDGPUMain
].
m_pICrossAdapterResPerFrame
[
nCurrentFrameIndex
].
Get
()
pICmdListCopy
->
CopyResource
(
stGPUParams
[
nIDGPUMain
].
m_pICrossAdapterResPerFrame
[
nCurrentFrameIndex
].
Get
()
,
stGPUParams
[
nIDGPUMain
].
m_pIRTRes
[
nCurrentFrameIndex
].
Get
());
}
else
...
...
D3D12 Tutorials.sln
浏览文件 @
b5af17d4
...
...
@@ -23,6 +23,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "9-RenderToTexture", "9-D3D1
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "10-PixelShaderTips", "10-PixelShaderTips\10-PixelTips.vcxproj", "{8EA5A86B-350C-43E7-BAA5-76D678FFAADF}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "11-MultiThreadAndAdapter", "11-MultiThreadAndAdapter\11-MultiThreadAndAdapter.vcxproj", "{3F5D89CA-5D3A-45A8-AB4B-055E617E626A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "12-D2DWriteOnD3D12", "12-D2DWriteOnD3D12\12-D2DWriteOnD3D12.vcxproj", "{77323B42-FD6B-4FD1-9B9E-31A84D0DB35E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "13-ShowGIFAndResourceStatus", "13-ShowGIFAndResourceStatus\13-ShowGIFAndResourceStatus.vcxproj", "{B3D520CA-D4E5-4513-8664-4EAC26C10650}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
...
...
@@ -153,6 +159,42 @@ Global
{8EA5A86B-350C-43E7-BAA5-76D678FFAADF}.Release|x64.Build.0 = Release|x64
{8EA5A86B-350C-43E7-BAA5-76D678FFAADF}.Release|x86.ActiveCfg = Release|Win32
{8EA5A86B-350C-43E7-BAA5-76D678FFAADF}.Release|x86.Build.0 = Release|Win32
{3F5D89CA-5D3A-45A8-AB4B-055E617E626A}.Debug|x64.ActiveCfg = Debug|x64
{3F5D89CA-5D3A-45A8-AB4B-055E617E626A}.Debug|x64.Build.0 = Debug|x64
{3F5D89CA-5D3A-45A8-AB4B-055E617E626A}.Debug|x86.ActiveCfg = Debug|Win32
{3F5D89CA-5D3A-45A8-AB4B-055E617E626A}.Debug|x86.Build.0 = Debug|Win32
{3F5D89CA-5D3A-45A8-AB4B-055E617E626A}.Profile|x64.ActiveCfg = Release|x64
{3F5D89CA-5D3A-45A8-AB4B-055E617E626A}.Profile|x64.Build.0 = Release|x64
{3F5D89CA-5D3A-45A8-AB4B-055E617E626A}.Profile|x86.ActiveCfg = Release|Win32
{3F5D89CA-5D3A-45A8-AB4B-055E617E626A}.Profile|x86.Build.0 = Release|Win32
{3F5D89CA-5D3A-45A8-AB4B-055E617E626A}.Release|x64.ActiveCfg = Release|x64
{3F5D89CA-5D3A-45A8-AB4B-055E617E626A}.Release|x64.Build.0 = Release|x64
{3F5D89CA-5D3A-45A8-AB4B-055E617E626A}.Release|x86.ActiveCfg = Release|Win32
{3F5D89CA-5D3A-45A8-AB4B-055E617E626A}.Release|x86.Build.0 = Release|Win32
{77323B42-FD6B-4FD1-9B9E-31A84D0DB35E}.Debug|x64.ActiveCfg = Debug|x64
{77323B42-FD6B-4FD1-9B9E-31A84D0DB35E}.Debug|x64.Build.0 = Debug|x64
{77323B42-FD6B-4FD1-9B9E-31A84D0DB35E}.Debug|x86.ActiveCfg = Debug|Win32
{77323B42-FD6B-4FD1-9B9E-31A84D0DB35E}.Debug|x86.Build.0 = Debug|Win32
{77323B42-FD6B-4FD1-9B9E-31A84D0DB35E}.Profile|x64.ActiveCfg = Release|x64
{77323B42-FD6B-4FD1-9B9E-31A84D0DB35E}.Profile|x64.Build.0 = Release|x64
{77323B42-FD6B-4FD1-9B9E-31A84D0DB35E}.Profile|x86.ActiveCfg = Release|Win32
{77323B42-FD6B-4FD1-9B9E-31A84D0DB35E}.Profile|x86.Build.0 = Release|Win32
{77323B42-FD6B-4FD1-9B9E-31A84D0DB35E}.Release|x64.ActiveCfg = Release|x64
{77323B42-FD6B-4FD1-9B9E-31A84D0DB35E}.Release|x64.Build.0 = Release|x64
{77323B42-FD6B-4FD1-9B9E-31A84D0DB35E}.Release|x86.ActiveCfg = Release|Win32
{77323B42-FD6B-4FD1-9B9E-31A84D0DB35E}.Release|x86.Build.0 = Release|Win32
{B3D520CA-D4E5-4513-8664-4EAC26C10650}.Debug|x64.ActiveCfg = Debug|x64
{B3D520CA-D4E5-4513-8664-4EAC26C10650}.Debug|x64.Build.0 = Debug|x64
{B3D520CA-D4E5-4513-8664-4EAC26C10650}.Debug|x86.ActiveCfg = Debug|Win32
{B3D520CA-D4E5-4513-8664-4EAC26C10650}.Debug|x86.Build.0 = Debug|Win32
{B3D520CA-D4E5-4513-8664-4EAC26C10650}.Profile|x64.ActiveCfg = Release|x64
{B3D520CA-D4E5-4513-8664-4EAC26C10650}.Profile|x64.Build.0 = Release|x64
{B3D520CA-D4E5-4513-8664-4EAC26C10650}.Profile|x86.ActiveCfg = Release|Win32
{B3D520CA-D4E5-4513-8664-4EAC26C10650}.Profile|x86.Build.0 = Release|Win32
{B3D520CA-D4E5-4513-8664-4EAC26C10650}.Release|x64.ActiveCfg = Release|x64
{B3D520CA-D4E5-4513-8664-4EAC26C10650}.Release|x64.Build.0 = Release|x64
{B3D520CA-D4E5-4513-8664-4EAC26C10650}.Release|x86.ActiveCfg = Release|Win32
{B3D520CA-D4E5-4513-8664-4EAC26C10650}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录