Skip to content

Commit

Permalink
extract process names, entry point dlls on win32.
Browse files Browse the repository at this point in the history
fixup ingame ui to group by process.
changed all win32 samples to run multibyte characters
  • Loading branch information
jonasmr committed Jan 1, 2016
1 parent e2ff40e commit 0ae9eee
Show file tree
Hide file tree
Showing 13 changed files with 385 additions and 93 deletions.
Binary file modified bin/microprofile-win32-cswitch_x64.exe
Binary file not shown.
Binary file modified bin/microprofile-win32-cswitch_x64.pdb
Binary file not shown.
Binary file modified bin/microprofile-win32-cswitch_x86.exe
Binary file not shown.
Binary file modified bin/microprofile-win32-cswitch_x86.pdb
Binary file not shown.
8 changes: 4 additions & 4 deletions demo/noui/noui.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,27 @@
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand Down
38 changes: 19 additions & 19 deletions demo/noui_d3d12/noui_d3d12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ inline void ThrowIfFailed(HRESULT hr)
}
}

inline void GetAssetsPath(_Out_writes_(pathSize) WCHAR* path, UINT pathSize)
inline void GetAssetsPath(_Out_writes_(pathSize) CHAR* path, UINT pathSize)
{
if (path == nullptr)
{
Expand All @@ -43,14 +43,14 @@ inline void GetAssetsPath(_Out_writes_(pathSize) WCHAR* path, UINT pathSize)
throw;
}

WCHAR* lastSlash = wcsrchr(path, L'\\');
CHAR* lastSlash = strrchr(path, L'\\');
if (lastSlash)
{
*(lastSlash + 1) = NULL;
}
}

inline HRESULT ReadDataFromFile(LPCWSTR filename, byte** data, UINT* size)
inline HRESULT ReadDataFromFile(LPWSTR filename, byte** data, UINT* size)
{
using namespace Microsoft::WRL;

Expand Down Expand Up @@ -113,11 +113,11 @@ inline HRESULT ReadDataFromFile(LPCWSTR filename, byte** data, UINT* size)
class DXSample
{
public:
DXSample(UINT width, UINT height, std::wstring name);
DXSample(UINT width, UINT height, std::string name);
virtual ~DXSample();

int Run(HINSTANCE hInstance, int nCmdShow);
void SetCustomWindowText(LPCWSTR text);
void SetCustomWindowText(LPCSTR text);

protected:
virtual void OnInit() = 0;
Expand All @@ -126,7 +126,7 @@ class DXSample
virtual void OnDestroy() = 0;
virtual bool OnEvent(MSG msg) = 0;

std::wstring GetAssetFullPath(LPCWSTR assetName);
std::string GetAssetFullPath(LPCSTR assetName);
void GetHardwareAdapter(_In_ IDXGIFactory4* pFactory, _Outptr_result_maybenull_ IDXGIAdapter1** ppAdapter);

static LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
Expand All @@ -146,23 +146,23 @@ class DXSample
void ParseCommandLineArgs();

// Root assets path.
std::wstring m_assetsPath;
std::string m_assetsPath;

// Window title.
std::wstring m_title;
std::string m_title;
};


DXSample::DXSample(UINT width, UINT height, std::wstring name) :
DXSample::DXSample(UINT width, UINT height, std::string name) :
m_width(width),
m_height(height),
m_useWarpDevice(false)
{
ParseCommandLineArgs();

m_title = name + (m_useWarpDevice ? L" (WARP)" : L"");
m_title = name + (m_useWarpDevice ? " (WARP)" : "");

WCHAR assetsPath[512];
CHAR assetsPath[512];
GetAssetsPath(assetsPath, _countof(assetsPath));
m_assetsPath = assetsPath;

Expand All @@ -185,15 +185,15 @@ int DXSample::Run(HINSTANCE hInstance, int nCmdShow)
windowClass.lpfnWndProc = WindowProc;
windowClass.hInstance = hInstance;
windowClass.hCursor = LoadCursor(NULL, IDC_ARROW);
windowClass.lpszClassName = L"WindowClass1";
windowClass.lpszClassName = "WindowClass1";
RegisterClassEx(&windowClass);

RECT windowRect = { 0, 0, static_cast<LONG>(m_width), static_cast<LONG>(m_height) };
AdjustWindowRect(&windowRect, WS_OVERLAPPEDWINDOW, FALSE);

// Create the window and store a handle to it.
m_hwnd = CreateWindowEx(NULL,
L"WindowClass1",
"WindowClass1",
m_title.c_str(),
WS_OVERLAPPEDWINDOW,
300,
Expand Down Expand Up @@ -247,7 +247,7 @@ int DXSample::Run(HINSTANCE hInstance, int nCmdShow)
}

// Helper function for resolving the full path of assets.
std::wstring DXSample::GetAssetFullPath(LPCWSTR assetName)
std::string DXSample::GetAssetFullPath(LPCSTR assetName)
{
return m_assetsPath + assetName;
}
Expand Down Expand Up @@ -283,9 +283,9 @@ void DXSample::GetHardwareAdapter(_In_ IDXGIFactory4* pFactory, _Outptr_result_m
}

// Helper function for setting the window's title text.
void DXSample::SetCustomWindowText(LPCWSTR text)
void DXSample::SetCustomWindowText(LPCSTR text)
{
std::wstring windowText = m_title + L": " + text;
std::string windowText = m_title + ": " + text;
SetWindowText(m_hwnd, windowText.c_str());
}

Expand Down Expand Up @@ -327,7 +327,7 @@ using namespace Microsoft::WRL;
class D3D12HelloTriangle : public DXSample
{
public:
D3D12HelloTriangle(UINT width, UINT height, std::wstring name);
D3D12HelloTriangle(UINT width, UINT height, std::string name);

protected:
virtual void OnInit();
Expand Down Expand Up @@ -377,7 +377,7 @@ class D3D12HelloTriangle : public DXSample



D3D12HelloTriangle::D3D12HelloTriangle(UINT width, UINT height, std::wstring name) :
D3D12HelloTriangle::D3D12HelloTriangle(UINT width, UINT height, std::string name) :
DXSample(width, height, name),
m_frameIndex(0),
m_viewport(),
Expand Down Expand Up @@ -732,7 +732,7 @@ void D3D12HelloTriangle::WaitForPreviousFrame()
_Use_decl_annotations_
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow)
{
D3D12HelloTriangle sample(1280, 720, L"D3D12 Hello Triangle");
D3D12HelloTriangle sample(1280, 720, "D3D12 Hello Triangle");
return sample.Run(hInstance, nCmdShow);
}

Expand Down
8 changes: 4 additions & 4 deletions demo/noui_d3d12/noui_d3d12.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,27 @@
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand Down
2 changes: 1 addition & 1 deletion demo/noui_d3d12_multithreading/SquidRoom.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

namespace SampleAssets
{
const wchar_t DataFileName[] = L"SquidRoom.bin";
const char DataFileName[] = "SquidRoom.bin";

const D3D12_INPUT_ELEMENT_DESC StandardVertexDescription[] =
{
Expand Down
49 changes: 25 additions & 24 deletions demo/noui_d3d12_multithreading/noui_d3d12_multithreading.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ inline void ThrowIfFailed(HRESULT hr)
}
}

inline void GetAssetsPath(_Out_writes_(pathSize) WCHAR* path, UINT pathSize)
inline void GetAssetsPath(_Out_writes_(pathSize) CHAR* path, UINT pathSize)
{
if (path == nullptr)
{
Expand All @@ -81,14 +81,14 @@ inline void GetAssetsPath(_Out_writes_(pathSize) WCHAR* path, UINT pathSize)
throw;
}

WCHAR* lastSlash = wcsrchr(path, L'\\');
CHAR* lastSlash = strrchr(path, L'\\');
if (lastSlash)
{
*(lastSlash + 1) = NULL;
}
}

inline HRESULT ReadDataFromFile(LPCWSTR filename, byte** data, UINT* size)
inline HRESULT ReadDataFromFile(LPCSTR filename, byte** data, UINT* size)
{
using namespace Microsoft::WRL;

Expand All @@ -101,13 +101,14 @@ inline HRESULT ReadDataFromFile(LPCWSTR filename, byte** data, UINT* size)
extendedParams.hTemplateFile = nullptr;

Wrappers::FileHandle file(
CreateFile2(
CreateFile(
filename,
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
&extendedParams
)
FILE_ATTRIBUTE_NORMAL,
NULL)
);

if (file.Get() == INVALID_HANDLE_VALUE)
Expand Down Expand Up @@ -414,11 +415,11 @@ class StepTimer
class DXSample
{
public:
DXSample(UINT width, UINT height, std::wstring name);
DXSample(UINT width, UINT height, std::string name);
virtual ~DXSample();

int Run(HINSTANCE hInstance, int nCmdShow);
void SetCustomWindowText(LPCWSTR text);
void SetCustomWindowText(LPCSTR text);

protected:
virtual void OnInit() = 0;
Expand All @@ -427,7 +428,7 @@ class DXSample
virtual void OnDestroy() = 0;
virtual bool OnEvent(MSG msg) = 0;

std::wstring GetAssetFullPath(LPCWSTR assetName);
std::string GetAssetFullPath(LPCSTR assetName);
void GetHardwareAdapter(_In_ IDXGIFactory4* pFactory, _Outptr_result_maybenull_ IDXGIAdapter1** ppAdapter);

static LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
Expand All @@ -447,23 +448,23 @@ class DXSample
void ParseCommandLineArgs();

// Root assets path.
std::wstring m_assetsPath;
std::string m_assetsPath;

// Window title.
std::wstring m_title;
std::string m_title;
};


DXSample::DXSample(UINT width, UINT height, std::wstring name) :
DXSample::DXSample(UINT width, UINT height, std::string name) :
m_width(width),
m_height(height),
m_useWarpDevice(false)
{
ParseCommandLineArgs();

m_title = name + (m_useWarpDevice ? L" (WARP)" : L"");
m_title = name + (m_useWarpDevice ? " (WARP)" : "");

WCHAR assetsPath[512];
CHAR assetsPath[512];
GetAssetsPath(assetsPath, _countof(assetsPath));
m_assetsPath = assetsPath;

Expand All @@ -483,15 +484,15 @@ int DXSample::Run(HINSTANCE hInstance, int nCmdShow)
windowClass.lpfnWndProc = WindowProc;
windowClass.hInstance = hInstance;
windowClass.hCursor = LoadCursor(NULL, IDC_ARROW);
windowClass.lpszClassName = L"WindowClass1";
windowClass.lpszClassName = "WindowClass1";
RegisterClassEx(&windowClass);

RECT windowRect = { 0, 0, static_cast<LONG>(m_width), static_cast<LONG>(m_height) };
AdjustWindowRect(&windowRect, WS_OVERLAPPEDWINDOW, FALSE);

// Create the window and store a handle to it.
m_hwnd = CreateWindowEx(NULL,
L"WindowClass1",
"WindowClass1",
m_title.c_str(),
WS_OVERLAPPEDWINDOW,
300,
Expand Down Expand Up @@ -568,7 +569,7 @@ int DXSample::Run(HINSTANCE hInstance, int nCmdShow)
}

// Helper function for resolving the full path of assets.
std::wstring DXSample::GetAssetFullPath(LPCWSTR assetName)
std::string DXSample::GetAssetFullPath(LPCSTR assetName)
{
return m_assetsPath + assetName;
}
Expand Down Expand Up @@ -604,9 +605,9 @@ void DXSample::GetHardwareAdapter(_In_ IDXGIFactory4* pFactory, _Outptr_result_m
}

// Helper function for setting the window's title text.
void DXSample::SetCustomWindowText(LPCWSTR text)
void DXSample::SetCustomWindowText(LPCSTR text)
{
std::wstring windowText = m_title + L": " + text;
std::string windowText = m_title + ": " + text;
SetWindowText(m_hwnd, windowText.c_str());
}

Expand Down Expand Up @@ -729,7 +730,7 @@ class FrameResource
class D3D12Multithreading : public DXSample
{
public:
D3D12Multithreading(UINT width, UINT height, std::wstring name);
D3D12Multithreading(UINT width, UINT height, std::string name);
virtual ~D3D12Multithreading();

static D3D12Multithreading* Get() { return s_app; }
Expand Down Expand Up @@ -837,7 +838,7 @@ class D3D12Multithreading : public DXSample

D3D12Multithreading* D3D12Multithreading::s_app = nullptr;

D3D12Multithreading::D3D12Multithreading(UINT width, UINT height, std::wstring name) :
D3D12Multithreading::D3D12Multithreading(UINT width, UINT height, std::string name) :
DXSample(width, height, name),
m_frameIndex(0),
m_viewport(),
Expand Down Expand Up @@ -1666,8 +1667,8 @@ void D3D12Multithreading::OnRender()
m_cpuTimer.Tick(NULL);
if (m_titleCount == TitleThrottle)
{
WCHAR cpu[64];
swprintf_s(cpu, L"%.4f CPU", m_cpuTime / m_titleCount);
CHAR cpu[64];
sprintf_s(cpu, "%.4f CPU", m_cpuTime / m_titleCount);
SetCustomWindowText(cpu);

m_titleCount = 0;
Expand Down Expand Up @@ -2021,7 +2022,7 @@ void D3D12Multithreading::SetCommonPipelineState(ID3D12GraphicsCommandList* pCom
_Use_decl_annotations_
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow)
{
D3D12Multithreading sample(1280, 720, L"D3D12 Multithreading Sample");
D3D12Multithreading sample(1280, 720, "D3D12 Multithreading Sample");
return sample.Run(hInstance, nCmdShow);
}

Expand Down
Loading

0 comments on commit 0ae9eee

Please sign in to comment.