Skip to content

Commit 423c96f

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/dev'
2 parents 82ac143 + e5f0e9f commit 423c96f

File tree

8 files changed

+92
-105
lines changed

8 files changed

+92
-105
lines changed

Source/Interface/Application/Modules/Latency Remove/LatencyRemove.cpp

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

Source/Interface/Application/Modules/Movie Record/MovieRecord.cpp

Lines changed: 53 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,6 @@ namespace
230230
{
231231
const char* Names[] =
232232
{
233-
"ViewRender",
234233
"PushYUV",
235234
"PushRGB",
236235
"Encode",
@@ -240,7 +239,6 @@ namespace
240239
{
241240
enum Type
242241
{
243-
ViewRender,
244242
PushYUV,
245243
PushRGB,
246244
Encode,
@@ -778,22 +776,41 @@ namespace
778776
(
779777
/*
780778
Once shared with D3D11, it is interpreted as
781-
DXGI_FORMAT_B8G8R8A8_UNORM
779+
DXGI_FORMAT_B8G8R8A8_UNORM.
780+
781+
Previously "CreateOffscreenPlainSurface" but that function
782+
produced black output for some users.
783+
784+
According to MSDN (https://msdn.microsoft.com/en-us/library/windows/desktop/ff476531(v=vs.85).aspx)
785+
the flags for the texture needs to be RENDER_TARGET which I guess the previous function didn't set.
786+
MSDN also mentions an non-existent SHADER_RESOURCE flag which seems safe to omit.
787+
788+
This change was first made in:
789+
https://github.com/crashfort/SourceDemoRender/commit/eaabd701ce413cc372aeabe57755ce37e4bf741c
782790
*/
783-
device->CreateOffscreenPlainSurface
791+
device->CreateTexture
784792
(
785793
width,
786794
height,
795+
1,
796+
D3DUSAGE_RENDERTARGET,
787797
D3DFMT_A8R8G8B8,
788798
D3DPOOL_DEFAULT,
789-
Surface.GetAddressOf(),
799+
Texture.GetAddressOf(),
790800
&SharedHandle
791801
),
792-
"Could not create D3D9 shared surface"
802+
"Could not create D3D9 shared texture"
803+
);
804+
805+
SDR::Error::MS::ThrowIfFailed
806+
(
807+
Texture->GetSurfaceLevel(0, Surface.GetAddressOf()),
808+
"Could not get D3D9 surface from texture"
793809
);
794810
}
795811

796812
HANDLE SharedHandle = nullptr;
813+
Microsoft::WRL::ComPtr<IDirect3DTexture9> Texture;
797814
Microsoft::WRL::ComPtr<IDirect3DSurface9> Surface;
798815
};
799816

@@ -1145,33 +1162,41 @@ namespace
11451162

11461163
struct ConversionRuleData
11471164
{
1165+
using FactoryType = std::function<std::unique_ptr<ConversionBase>()>;
1166+
11481167
ConversionRuleData
11491168
(
11501169
AVPixelFormat format,
11511170
const char* shader,
1152-
bool yuv
1171+
const FactoryType& factory
11531172
) :
11541173
Format(format),
11551174
ShaderName(shader),
1156-
IsYUV(yuv)
1175+
Factory(factory)
11571176
{
11581177

11591178
}
11601179

11611180
AVPixelFormat Format;
11621181
const char* ShaderName;
1163-
bool IsYUV;
1182+
FactoryType Factory;
11641183
};
11651184

1166-
ConversionRuleData table[] =
1185+
auto yuvfactory = []()
11671186
{
1168-
ConversionRuleData(AV_PIX_FMT_YUV420P, "YUV420", true),
1169-
ConversionRuleData(AV_PIX_FMT_YUV444P, "YUV444", true),
1187+
return std::make_unique<ConversionYUV>();
1188+
};
11701189

1171-
/*
1172-
libx264rgb
1173-
*/
1174-
ConversionRuleData(AV_PIX_FMT_BGR0, "BGR0", false),
1190+
auto bgr0factory = []()
1191+
{
1192+
return std::make_unique<ConversionBGR0>();
1193+
};
1194+
1195+
ConversionRuleData table[] =
1196+
{
1197+
ConversionRuleData(AV_PIX_FMT_YUV420P, "YUV420", yuvfactory),
1198+
ConversionRuleData(AV_PIX_FMT_YUV444P, "YUV444", yuvfactory),
1199+
ConversionRuleData(AV_PIX_FMT_BGR0, "BGR0", bgr0factory),
11751200
};
11761201

11771202
ConversionRuleData* found = nullptr;
@@ -1180,8 +1205,6 @@ namespace
11801205
{
11811206
if (entry.Format == reference->format)
11821207
{
1183-
OpenShader(device, entry.ShaderName, ConversionShader.GetAddressOf());
1184-
11851208
found = &entry;
11861209
break;
11871210
}
@@ -1193,16 +1216,9 @@ namespace
11931216
SDR::Error::Make("No conversion rule found for %s", name);
11941217
}
11951218

1196-
if (found->IsYUV)
1197-
{
1198-
ConversionPtr = std::make_unique<ConversionYUV>();
1199-
}
1200-
1201-
else
1202-
{
1203-
ConversionPtr = std::make_unique<ConversionBGR0>();
1204-
}
1219+
OpenShader(device, found->ShaderName, ConversionShader.GetAddressOf());
12051220

1221+
ConversionPtr = found->Factory();
12061222
ConversionPtr->Create(device, reference);
12071223
}
12081224

@@ -1649,6 +1665,10 @@ namespace
16491665

16501666
if (dopasses)
16511667
{
1668+
/*
1669+
Don't risk running out of memory. Just let the encoding
1670+
finish so we start fresh with no buffered frames.
1671+
*/
16521672
if (MovieData::WouldNewFrameOverflow())
16531673
{
16541674
while (BufferedFrames)
@@ -1657,8 +1677,6 @@ namespace
16571677
}
16581678
}
16591679

1660-
Profile::ScopedEntry e1(Profile::Types::ViewRender);
1661-
16621680
auto& stream = movie.VideoStreams[0];
16631681

16641682
if (stream->FirstFrame)
@@ -1818,7 +1836,7 @@ namespace
18181836
if (_strcmpi(newstr, preset) == 0)
18191837
{
18201838
Warning("SDR: Slow encoder preset chosen, this might not work very well for realtime\n");
1821-
return;
1839+
break;
18221840
}
18231841
}
18241842
}
@@ -1993,6 +2011,11 @@ namespace
19932011
);
19942012
}
19952013

2014+
/*
2015+
Destroy any deferred D3D11 resources created by above functions.
2016+
*/
2017+
movie.VideoStreamShared.DirectX11.Context->Flush();
2018+
19962019
for (auto& stream : tempstreams)
19972020
{
19982021
auto name = BuildVideoStreamName(sdrpath, filename, stream.get());

Source/Interface/Application/Modules/Player Hide/PlayerHide.cpp

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

Source/Interface/PluginInterface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ namespace
167167

168168
enum
169169
{
170-
PluginVersion = 13,
170+
PluginVersion = 14,
171171
};
172172
};
173173

Source/Main/Precompiled Header/PrecompiledHeader.hpp

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,49 @@
66

77
#define WIN32_LEAN_AND_MEAN
88
#define VC_EXTRALEAN
9-
#define NOATOM
9+
10+
/*
11+
Order like in Windows.h
12+
*/
13+
1014
#define NOGDICAPMASKS
15+
#define NOVIRTUALKEYCODES
16+
//#define NOWINMESSAGES
17+
#define NOWINSTYLES
18+
#define NOSYSMETRICS
19+
#define NOMENUS
20+
#define NOICONS
21+
#define NOKEYSTATES
22+
#define NOSYSCOMMANDS
23+
#define NORASTEROPS
24+
#define NOSHOWWINDOW
25+
#define OEMRESOURCE
26+
#define NOATOM
27+
#define NOCLIPBOARD
28+
#define NOCOLOR
29+
//#define NOCTLMGR
30+
#define NODRAWTEXT
31+
//#define NOGDI
32+
#define NOKERNEL
33+
//#define NOUSER
34+
#define NONLS
35+
#define NOMB
36+
#define NOMEMMGR
1137
#define NOMETAFILE
12-
#define NOBITMAP
1338
#define NOMINMAX
39+
//#define NOMSG
1440
#define NOOPENFILE
15-
#define NORASTEROPS
1641
#define NOSCROLL
42+
#define NOSERVICE
1743
#define NOSOUND
18-
#define NOSYSMETRICS
1944
#define NOTEXTMETRIC
2045
#define NOWH
46+
#define NOWINOFFSETS
2147
#define NOCOMM
2248
#define NOKANJI
23-
#define NOCRYPT
49+
#define NOHELP
50+
#define NOPROFILER
51+
#define NODEFERWINDOWPOS
2452
#define NOMCX
2553

2654
#include <Windows.h>

Source/SourceDemoRender.vcxproj

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
<PrecompiledHeader>Use</PrecompiledHeader>
105105
<WarningLevel>Level3</WarningLevel>
106106
<Optimization>Disabled</Optimization>
107-
<PreprocessorDefinitions>WIN32;NOMINMAX;WIN32_LEAN_AND_MEAN;_DEBUG;_WINDOWS;_USRDLL;SOURCEDEMORENDER_EXPORTS;_NO_ASYNCRTIMP;_NO_PPLXIMP;SDR_SINGLEPLAYER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
107+
<PreprocessorDefinitions>WIN32;NOMINMAX;WIN32_LEAN_AND_MEAN;_DEBUG;_WINDOWS;_USRDLL;_NO_ASYNCRTIMP;_NO_PPLXIMP;SDR_SINGLEPLAYER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
108108
<AdditionalIncludeDirectories>$(SDR_2013SDK_SP)common\;$(SDR_2013SDK_SP)public\;$(SDR_2013SDK_SP)public\tier0\;$(SDR_2013SDK_SP)public\tier1\;$(SDR_2013SDK_SP)game\client\;$(SDR_2013SDK_SP)game\server\;$(ProjectDir);$(ProjectDir)Main\Precompiled Header\;$(SDR_RWQUEUE_INCLUDE);$(ProjectDir)3rd Party Libraries\MinHook\include\;$(SDR_FFMPEG_ROOT)include\;$(SDR_RESTSDK_ROOT)Release\include\;$(DXSDK_DIR)Include\;$(SDR_RAPIDJSON_INCLUDE);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
109109
<PrecompiledHeaderFile>PrecompiledHeader.hpp</PrecompiledHeaderFile>
110110
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
@@ -124,7 +124,7 @@
124124
<PrecompiledHeader>Use</PrecompiledHeader>
125125
<WarningLevel>Level3</WarningLevel>
126126
<Optimization>Disabled</Optimization>
127-
<PreprocessorDefinitions>WIN32;NOMINMAX;WIN32_LEAN_AND_MEAN;_DEBUG;_WINDOWS;_USRDLL;SOURCEDEMORENDER_EXPORTS;_NO_ASYNCRTIMP;_NO_PPLXIMP;SDR_MULTIPLAYER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
127+
<PreprocessorDefinitions>WIN32;NOMINMAX;WIN32_LEAN_AND_MEAN;_DEBUG;_WINDOWS;_USRDLL;_NO_ASYNCRTIMP;_NO_PPLXIMP;SDR_MULTIPLAYER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
128128
<AdditionalIncludeDirectories>$(SDR_2013SDK_MP)common\;$(SDR_2013SDK_MP)public\;$(SDR_2013SDK_MP)public\tier0\;$(SDR_2013SDK_MP)public\tier1\;$(SDR_2013SDK_MP)game\client\;$(SDR_2013SDK_MP)game\server\;$(ProjectDir);$(ProjectDir)Main\Precompiled Header\;$(SDR_RWQUEUE_INCLUDE);$(ProjectDir)3rd Party Libraries\MinHook\include\;$(SDR_FFMPEG_ROOT)include\;$(SDR_RESTSDK_ROOT)Release\include\;$(DXSDK_DIR)Include\;$(SDR_RAPIDJSON_INCLUDE);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
129129
<PrecompiledHeaderFile>PrecompiledHeader.hpp</PrecompiledHeaderFile>
130130
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
@@ -146,7 +146,7 @@
146146
<Optimization>MaxSpeed</Optimization>
147147
<FunctionLevelLinking>true</FunctionLevelLinking>
148148
<IntrinsicFunctions>true</IntrinsicFunctions>
149-
<PreprocessorDefinitions>WIN32;NOMINMAX;WIN32_LEAN_AND_MEAN;NDEBUG;_WINDOWS;_USRDLL;SOURCEDEMORENDER_EXPORTS;_NO_ASYNCRTIMP;_NO_PPLXIMP;SDR_SINGLEPLAYER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
149+
<PreprocessorDefinitions>WIN32;NOMINMAX;WIN32_LEAN_AND_MEAN;NDEBUG;_WINDOWS;_USRDLL;_NO_ASYNCRTIMP;_NO_PPLXIMP;SDR_SINGLEPLAYER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
150150
<AdditionalIncludeDirectories>$(SDR_2013SDK_SP)common\;$(SDR_2013SDK_SP)public\;$(SDR_2013SDK_SP)public\tier0\;$(SDR_2013SDK_SP)public\tier1\;$(SDR_2013SDK_SP)game\client\;$(SDR_2013SDK_SP)game\server\;$(ProjectDir);$(ProjectDir)Main\Precompiled Header\;$(SDR_RWQUEUE_INCLUDE);$(ProjectDir)3rd Party Libraries\MinHook\include\;$(SDR_FFMPEG_ROOT)include\;$(SDR_RESTSDK_ROOT)Release\include\;$(DXSDK_DIR)Include\;$(SDR_RAPIDJSON_INCLUDE);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
151151
<PrecompiledHeaderFile>PrecompiledHeader.hpp</PrecompiledHeaderFile>
152152
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -170,7 +170,7 @@
170170
<Optimization>MaxSpeed</Optimization>
171171
<FunctionLevelLinking>true</FunctionLevelLinking>
172172
<IntrinsicFunctions>true</IntrinsicFunctions>
173-
<PreprocessorDefinitions>WIN32;NOMINMAX;WIN32_LEAN_AND_MEAN;NDEBUG;_WINDOWS;_USRDLL;SOURCEDEMORENDER_EXPORTS;_NO_ASYNCRTIMP;_NO_PPLXIMP;SDR_MULTIPLAYER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
173+
<PreprocessorDefinitions>WIN32;NOMINMAX;WIN32_LEAN_AND_MEAN;NDEBUG;_WINDOWS;_USRDLL;_NO_ASYNCRTIMP;_NO_PPLXIMP;SDR_MULTIPLAYER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
174174
<AdditionalIncludeDirectories>$(SDR_2013SDK_MP)common\;$(SDR_2013SDK_MP)public\;$(SDR_2013SDK_MP)public\tier0\;$(SDR_2013SDK_MP)public\tier1\;$(SDR_2013SDK_MP)game\client\;$(SDR_2013SDK_MP)game\server\;$(ProjectDir);$(ProjectDir)Main\Precompiled Header\;$(SDR_RWQUEUE_INCLUDE);$(ProjectDir)3rd Party Libraries\MinHook\include\;$(SDR_FFMPEG_ROOT)include\;$(SDR_RESTSDK_ROOT)Release\include\;$(DXSDK_DIR)Include\;$(SDR_RAPIDJSON_INCLUDE);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
175175
<PrecompiledHeaderFile>PrecompiledHeader.hpp</PrecompiledHeaderFile>
176176
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -235,9 +235,7 @@
235235
</ClCompile>
236236
<ClCompile Include="Interface\Application\Application.cpp" />
237237
<ClCompile Include="Interface\Application\Modules\Engine Changes\EngineChanges.cpp" />
238-
<ClCompile Include="Interface\Application\Modules\Latency Remove\LatencyRemove.cpp" />
239238
<ClCompile Include="Interface\Application\Modules\Movie Record\MovieRecord.cpp" />
240-
<ClCompile Include="Interface\Application\Modules\Player Hide\PlayerHide.cpp" />
241239
<ClCompile Include="Interface\PluginInterface.cpp" />
242240
<ClCompile Include="Main\Precompiled Header\PrecompiledHeader.cpp">
243241
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug SP|Win32'">Create</PrecompiledHeader>

Source/SourceDemoRender.vcxproj.filters

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,6 @@
8686
<ClCompile Include="Interface\Application\Modules\Engine Changes\EngineChanges.cpp">
8787
<Filter>Source Files</Filter>
8888
</ClCompile>
89-
<ClCompile Include="Interface\Application\Modules\Latency Remove\LatencyRemove.cpp">
90-
<Filter>Source Files</Filter>
91-
</ClCompile>
92-
<ClCompile Include="Interface\Application\Modules\Player Hide\PlayerHide.cpp">
93-
<Filter>Source Files</Filter>
94-
</ClCompile>
9589
</ItemGroup>
9690
<ItemGroup>
9791
<FxCompile Include="Interface\Application\Modules\Movie Record\Shaders\Sampling.hlsl" />

Version/Latest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
13
1+
14

0 commit comments

Comments
 (0)