Add Roboto font, misc icons and text things

This commit is contained in:
elasota
2019-12-23 17:43:10 -05:00
parent e089cabf98
commit 7ab4c8960d
120 changed files with 2995 additions and 743 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 721 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 670 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 765 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 826 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

View File

@@ -4,8 +4,8 @@
#include "GpFontHandlerFactory.h"
#include "GpPLGlueAudioDriver.h"
#include "GpPLGlueDisplayDriver.h"
#include "GpFiber.h"
#include "HostSuspendCallArgument.h"
#include "IGpFiber.h"
#include <assert.h>
@@ -31,7 +31,7 @@ void GpAppEnvironment::Init()
{
}
void GpAppEnvironment::Tick(GpFiber *vosFiber)
void GpAppEnvironment::Tick(IGpFiber *vosFiber)
{
GpAppInterface_Get()->PL_IncrementTickCounter(1);

View File

@@ -14,7 +14,7 @@ namespace PortabilityLayer
struct IGpDisplayDriver;
struct IGpAudioDriver;
class GpFiber;
struct IGpFiber;
class GpAppEnvironment
{
@@ -24,7 +24,7 @@ public:
void Init();
void Tick(GpFiber *vosFiber);
void Tick(IGpFiber *vosFiber);
void Render();
void SetDisplayDriver(IGpDisplayDriver *displayDriver);
@@ -55,8 +55,8 @@ private:
IGpAudioDriver *m_audioDriver;
PortabilityLayer::HostFontHandler *m_fontHandler;
GpVOSEventQueue m_vosEventQueue;
GpFiber *m_applicationFiber;
GpFiber *m_vosFiber;
IGpFiber *m_applicationFiber;
IGpFiber *m_vosFiber;
uint32_t m_delaySuspendTicks;

View File

@@ -0,0 +1,58 @@
#include "GpColorCursor_Win32.h"
#include <stdlib.h>
#include <new>
void GpColorCursor_Win32::Destroy()
{
this->DecRef();
}
IGpColorCursor_Win32 *GpColorCursor_Win32::Load(const wchar_t *path)
{
HANDLE imageH = LoadImageW(nullptr, path, IMAGE_CURSOR, 0, 0, LR_LOADFROMFILE);
if (imageH == nullptr)
return nullptr;
HCURSOR cursor = reinterpret_cast<HCURSOR>(imageH);
void *storage = malloc(sizeof(GpColorCursor_Win32));
if (!storage)
{
DestroyCursor(cursor);
return nullptr;
}
return new (storage) GpColorCursor_Win32(reinterpret_cast<HCURSOR>(cursor));
}
GpColorCursor_Win32::GpColorCursor_Win32(HCURSOR cursor)
: m_cursor(cursor)
, m_refCount(1)
{
}
GpColorCursor_Win32::~GpColorCursor_Win32()
{
DestroyCursor(m_cursor);
}
const HCURSOR &GpColorCursor_Win32::GetHCursor() const
{
return m_cursor;
}
void GpColorCursor_Win32::IncRef()
{
m_refCount++;
}
void GpColorCursor_Win32::DecRef()
{
m_refCount--;
if (m_refCount == 0)
{
this->~GpColorCursor_Win32();
free(this);
}
}

View File

@@ -0,0 +1,33 @@
#pragma once
#include "IGpColorCursor.h"
#include "GpWindows.h"
struct IGpColorCursor_Win32 : public IGpColorCursor
{
virtual const HCURSOR &GetHCursor() const = 0;
virtual void IncRef() = 0;
virtual void DecRef() = 0;
};
class GpColorCursor_Win32 final : public IGpColorCursor_Win32
{
public:
void Destroy() override;
const HCURSOR &GetHCursor() const override;
void IncRef() override;
void DecRef() override;
static IGpColorCursor_Win32 *Load(const wchar_t *path);
private:
GpColorCursor_Win32(HCURSOR cursor);
~GpColorCursor_Win32();
HCURSOR m_cursor;
int m_refCount;
};

View File

@@ -1,120 +0,0 @@
#pragma once
template<class T>
class GpComPtr final
{
public:
GpComPtr();
const GpComPtr(const GpComPtr<T> &other);
explicit GpComPtr(T *ptr);
~GpComPtr();
GpComPtr<T> &operator=(const GpComPtr<T> &other);
GpComPtr<T> &operator=(T *other);
bool operator==(const GpComPtr<T> &other) const;
bool operator!=(const GpComPtr<T> &other) const;
bool operator==(const T *other) const;
bool operator!=(const T *other) const;
operator T*() const;
T *operator->() const;
T **GetMutablePtr();
private:
T *m_ptr;
};
template<class T>
inline GpComPtr<T>::GpComPtr()
: m_ptr(nullptr)
{
}
template<class T>
inline GpComPtr<T>::GpComPtr(const GpComPtr<T> &other)
: m_ptr(other.m_ptr)
{
if (m_ptr)
m_ptr->AddRef();
}
template<class T>
inline GpComPtr<T>::GpComPtr(T *ptr)
: m_ptr(ptr)
{
if (ptr)
ptr->AddRef();
}
template<class T>
inline GpComPtr<T>::~GpComPtr()
{
if (m_ptr)
m_ptr->Release();
}
template<class T>
inline GpComPtr<T> &GpComPtr<T>::operator=(const GpComPtr<T> &other)
{
(*this) = other.m_ptr;
return *this;
}
template<class T>
inline GpComPtr<T> &GpComPtr<T>::operator=(T *other)
{
if (other)
other->AddRef();
if (m_ptr)
m_ptr->Release();
m_ptr = other;
return *this;
}
template<class T>
inline bool GpComPtr<T>::operator==(const GpComPtr<T> &other) const
{
return m_ptr == other.m_ptr;
}
template<class T>
inline bool GpComPtr<T>::operator!=(const GpComPtr<T> &other) const
{
return !((*this) == other);
}
template<class T>
inline bool GpComPtr<T>::operator==(const T *other) const
{
return m_ptr == other;
}
template<class T>
inline bool GpComPtr<T>::operator!=(const T *other) const
{
return !((*this) == other);
}
template<class T>
T **GpComPtr<T>::GetMutablePtr()
{
return &m_ptr;
}
template<class T>
inline GpComPtr<T>::operator T*() const
{
return m_ptr;
}
template<class T>
inline T *GpComPtr<T>::operator->() const
{
return m_ptr;
}

BIN
GpD3D/GpD3D.aps Normal file

Binary file not shown.

BIN
GpD3D/GpD3D.rc Normal file

Binary file not shown.

View File

@@ -143,12 +143,10 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\GpCommon\GpColorCursor_Win32.cpp" />
<ClCompile Include="GpAppEnvironment.cpp" />
<ClCompile Include="GpAudioDriverFactory.cpp" />
<ClCompile Include="GpColorCursor_Win32.cpp" />
<ClCompile Include="GpDisplayDriverFactory.cpp" />
<ClCompile Include="GpDisplayDriverFactoryD3D11.cpp" />
<ClCompile Include="GpDisplayDriverSurfaceD3D11.cpp" />
<ClCompile Include="GpFiber_Win32.cpp" />
<ClCompile Include="GpFileStream_Win32.cpp" />
<ClCompile Include="GpFileSystem_Win32.cpp" />
@@ -157,7 +155,6 @@
<ClCompile Include="GpGlobalConfig.cpp" />
<ClCompile Include="GpMain.cpp" />
<ClCompile Include="GpMain_Win32.cpp" />
<ClCompile Include="GpDisplayDriverD3D11.cpp" />
<ClCompile Include="GpMemoryBuffer.cpp" />
<ClCompile Include="GpMutex_Win32.cpp" />
<ClCompile Include="GpPLGlueAudioChannel.cpp" />
@@ -167,10 +164,6 @@
<ClCompile Include="GpFiberStarter_Win32.cpp" />
<ClCompile Include="GpThreadEvent_Win32.cpp" />
<ClCompile Include="GpVOSEventQueue.cpp" />
<ClCompile Include="ShadersD3D11\DrawQuad15BitP_D3D11.cpp" />
<ClCompile Include="ShadersD3D11\DrawQuadPaletteP_D3D11.cpp" />
<ClCompile Include="ShadersD3D11\DrawQuadRGBP_D3D11.cpp" />
<ClCompile Include="ShadersD3D11\DrawQuadV_D3D11.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\GpCommon\EGpStandardCursor.h" />
@@ -183,14 +176,10 @@
<ClInclude Include="GpAppEnvironment.h" />
<ClInclude Include="GpAudioDriverFactory.h" />
<ClInclude Include="GpAudioDriverProperties.h" />
<ClInclude Include="GpAudioDriverXAudio2.h" />
<ClInclude Include="GpComPtr.h" />
<ClInclude Include="GpCoreDefs.h" />
<ClInclude Include="GpDisplayDriverD3D11.h" />
<ClInclude Include="GpDisplayDriverFactory.h" />
<ClInclude Include="GpDisplayDriverFactoryD3D11.h" />
<ClInclude Include="GpDisplayDriverProperties.h" />
<ClInclude Include="GpDisplayDriverSurfaceD3D11.h" />
<ClInclude Include="GpFiber.h" />
<ClInclude Include="GpFiber_Win32.h" />
<ClInclude Include="GpFileStream_Win32.h" />
@@ -213,6 +202,7 @@
<ClInclude Include="IGpAudioChannel.h" />
<ClInclude Include="IGpAudioDriver.h" />
<ClInclude Include="IGpDisplayDriver.h" />
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FreeType\FreeType.vcxproj">
@@ -224,6 +214,16 @@
<ProjectReference Include="..\GpAudioDriver_XAudio2\GpAudioDriver_XAudio2.vcxproj">
<Project>{e3bdc783-8646-433e-adf0-8b6390d36669}</Project>
</ProjectReference>
<ProjectReference Include="..\GpDisplayDriver_D3D11\GpDisplayDriver_D3D11.vcxproj">
<Project>{ffc961ac-55b4-4a38-a83e-06ae98f59acc}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="GpD3D.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="ConvertedResources\Large128.ico" />
<Image Include="ConvertedResources\Small128.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@@ -13,9 +13,6 @@
<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="Source Files\CompiledShaders">
<UniqueIdentifier>{6dd6af81-4f84-4e4f-aa25-9dd4c1b53536}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="GpMain_Win32.cpp">
@@ -24,18 +21,12 @@
<ClCompile Include="GpMain.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GpDisplayDriverD3D11.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GpDisplayDriverFactory.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GpGlobalConfig.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GpDisplayDriverFactoryD3D11.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GpAppEnvironment.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -84,22 +75,7 @@
<ClCompile Include="GpVOSEventQueue.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GpDisplayDriverSurfaceD3D11.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ShadersD3D11\DrawQuadV_D3D11.cpp">
<Filter>Source Files\CompiledShaders</Filter>
</ClCompile>
<ClCompile Include="ShadersD3D11\DrawQuad15BitP_D3D11.cpp">
<Filter>Source Files\CompiledShaders</Filter>
</ClCompile>
<ClCompile Include="ShadersD3D11\DrawQuadPaletteP_D3D11.cpp">
<Filter>Source Files\CompiledShaders</Filter>
</ClCompile>
<ClCompile Include="ShadersD3D11\DrawQuadRGBP_D3D11.cpp">
<Filter>Source Files\CompiledShaders</Filter>
</ClCompile>
<ClCompile Include="..\GpCommon\GpColorCursor_Win32.cpp">
<ClCompile Include="GpColorCursor_Win32.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
@@ -122,9 +98,6 @@
<ClInclude Include="GpDisplayDriverProperties.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GpDisplayDriverD3D11.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GpGlobalConfig.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -134,9 +107,6 @@
<ClInclude Include="GpCoreDefs.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GpDisplayDriverFactoryD3D11.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GpRingBuffer.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -179,9 +149,6 @@
<ClInclude Include="GpPLGlueAudioDriver.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GpAudioDriverXAudio2.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GpPLGlueAudioChannel.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -209,9 +176,6 @@
<ClInclude Include="..\GpCommon\IGpDisplayDriverSurface.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GpDisplayDriverSurfaceD3D11.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GpComPtr.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -224,5 +188,21 @@
<ClInclude Include="..\GpCommon\EGpStandardCursor.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="GpD3D.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Image Include="ConvertedResources\Large128.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="ConvertedResources\Small128.ico">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
</Project>

View File

@@ -1,776 +0,0 @@
#define _CRT_SECURE_NO_WARNINGS
#include "GpDisplayDriverD3D11.h"
#include "GpDisplayDriverSurfaceD3D11.h"
#include "GpWindows.h"
#include "GpColorCursor_Win32.h"
#include "GpFiber_Win32.h"
#include <d3d11.h>
#include <dxgi1_2.h>
#include <float.h>
#include <emmintrin.h>
#include <stdio.h>
#pragma comment (lib, "d3d11.lib")
namespace GpBinarizedShaders
{
extern const unsigned char *g_drawQuadV_D3D11[2];
extern const unsigned char *g_drawQuadPaletteP_D3D11[2];
extern const unsigned char *g_drawQuadRGBP_D3D11[2];
extern const unsigned char *g_drawQuad15BitP_D3D11[2];
}
struct GpShaderCodeBlob
{
const void *m_data;
size_t m_size;
};
static GpShaderCodeBlob GetBinarizedShader(const unsigned char **shaderPointers)
{
GpShaderCodeBlob blob;
blob.m_data = shaderPointers[0];
blob.m_size = shaderPointers[1] - shaderPointers[0];
return blob;
}
void DebugPrintf(const char *fmt, ...)
{
char buf[256];
va_list argp;
va_start(argp, fmt);
vsnprintf_s(buf, 255, fmt, argp);
OutputDebugString(buf);
va_end(argp);
}
LRESULT CALLBACK WinProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_DESTROY:
{
PostQuitMessage(0);
return 0;
}
break;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
void StartD3DForWindow(HWND hWnd, GpComPtr<IDXGISwapChain1>& outSwapChain, GpComPtr<ID3D11Device>& outDevice, GpComPtr<ID3D11DeviceContext>& outContext)
{
DXGI_SWAP_CHAIN_DESC1 swapChainDesc;
ZeroMemory(&swapChainDesc, sizeof(swapChainDesc));
swapChainDesc.BufferCount = 2;
swapChainDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapChainDesc.SampleDesc.Count = 1;
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
DXGI_SWAP_CHAIN_FULLSCREEN_DESC swapChainFullscreenDesc;
ZeroMemory(&swapChainFullscreenDesc, sizeof(swapChainFullscreenDesc));
swapChainFullscreenDesc.Windowed = TRUE;
swapChainFullscreenDesc.RefreshRate.Numerator = 60;
swapChainFullscreenDesc.RefreshRate.Denominator = 1;
UINT flags = 0;
const D3D_FEATURE_LEVEL featureLevels[] =
{
D3D_FEATURE_LEVEL_10_0
};
flags |= D3D11_CREATE_DEVICE_DEBUG;
ID3D11Device *device = NULL;
ID3D11DeviceContext *context = NULL;
D3D_FEATURE_LEVEL selectedFeatureLevel;
HRESULT result = D3D11CreateDevice(nullptr, D3D_DRIVER_TYPE_HARDWARE, NULL, flags, featureLevels, sizeof(featureLevels) / sizeof(featureLevels[0]),
D3D11_SDK_VERSION, &device, &selectedFeatureLevel, &context);
IDXGIDevice2 *dxgiDevice = nullptr;
result = device->QueryInterface(__uuidof(IDXGIDevice2), reinterpret_cast<void**>(&dxgiDevice));
IDXGIAdapter *dxgiAdapter = nullptr;
result = dxgiDevice->GetAdapter(&dxgiAdapter);
IDXGIFactory2 *dxgiFactory = nullptr;
result = dxgiAdapter->GetParent(__uuidof(IDXGIFactory2), reinterpret_cast<void**>(&dxgiFactory));
IDXGISwapChain1 *swapChain = nullptr;
result = dxgiFactory->CreateSwapChainForHwnd(device, hWnd, &swapChainDesc, nullptr, nullptr, &swapChain);
// GP TODO: Fix the error handling here, it's bad...
outSwapChain = swapChain;
outDevice = device;
outContext = context;
}
bool GpDisplayDriverD3D11::InitResources()
{
// Fetch back buffer
m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), reinterpret_cast<LPVOID*>(m_backBufferTexture.GetMutablePtr()));
{
D3D11_TEXTURE2D_DESC bbTextureDesc;
m_backBufferTexture->GetDesc(&bbTextureDesc);
D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
rtvDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
rtvDesc.Texture2D.MipSlice = 0;
if (m_device->CreateRenderTargetView(m_backBufferTexture, &rtvDesc, m_backBufferRTV.GetMutablePtr()) != S_OK)
return false;
}
// Quad vertex constant buffer
{
D3D11_BUFFER_DESC bufferDesc;
bufferDesc.ByteWidth = sizeof(DrawQuadVertexConstants);
bufferDesc.Usage = D3D11_USAGE_DYNAMIC;
bufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
bufferDesc.MiscFlags = 0;
bufferDesc.StructureByteStride = 0;
if (m_device->CreateBuffer(&bufferDesc, nullptr, m_drawQuadVertexConstantBuffer.GetMutablePtr()) != S_OK)
return false;
}
// Quad index buffer
{
const uint16_t indexBufferData[] = { 0, 1, 2, 1, 3, 2 };
D3D11_BUFFER_DESC bufferDesc;
bufferDesc.ByteWidth = sizeof(indexBufferData);
bufferDesc.Usage = D3D11_USAGE_DEFAULT;
bufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
bufferDesc.CPUAccessFlags = 0;
bufferDesc.MiscFlags = 0;
bufferDesc.StructureByteStride = 0;
D3D11_SUBRESOURCE_DATA initialData;
initialData.pSysMem = indexBufferData;
initialData.SysMemPitch = 0;
initialData.SysMemSlicePitch = 0;
if (m_device->CreateBuffer(&bufferDesc, &initialData, m_quadIndexBuffer.GetMutablePtr()) != S_OK)
return false;
}
// Quad vertex buffer
{
const float vertexBufferData[] =
{
0.f, 0.0f,
1.f, 0.f,
0.f, 1.f,
1.f, 1.f,
};
D3D11_BUFFER_DESC bufferDesc;
bufferDesc.ByteWidth = sizeof(vertexBufferData);
bufferDesc.Usage = D3D11_USAGE_DEFAULT;
bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
bufferDesc.CPUAccessFlags = 0;
bufferDesc.MiscFlags = 0;
bufferDesc.StructureByteStride = 0;
D3D11_SUBRESOURCE_DATA initialData;
initialData.pSysMem = vertexBufferData;
initialData.SysMemPitch = 0;
initialData.SysMemSlicePitch = 0;
if (m_device->CreateBuffer(&bufferDesc, &initialData, m_quadVertexBuffer.GetMutablePtr()) != S_OK)
return false;
}
const GpShaderCodeBlob drawQuadVBlob = GetBinarizedShader(GpBinarizedShaders::g_drawQuadV_D3D11);
const GpShaderCodeBlob drawQuadPalettePBlob = GetBinarizedShader(GpBinarizedShaders::g_drawQuadPaletteP_D3D11);
const GpShaderCodeBlob drawQuadRGBPBlob = GetBinarizedShader(GpBinarizedShaders::g_drawQuadRGBP_D3D11);
const GpShaderCodeBlob drawQuad15BitPBlob = GetBinarizedShader(GpBinarizedShaders::g_drawQuad15BitP_D3D11);
m_device->CreateVertexShader(drawQuadVBlob.m_data, drawQuadVBlob.m_size, nullptr, m_drawQuadVertexShader.GetMutablePtr());
m_device->CreatePixelShader(drawQuadPalettePBlob.m_data, drawQuadPalettePBlob.m_size, nullptr, m_drawQuadPalettePixelShader.GetMutablePtr());
m_device->CreatePixelShader(drawQuadRGBPBlob.m_data, drawQuadRGBPBlob.m_size, nullptr, m_drawQuadRGBPixelShader.GetMutablePtr());
m_device->CreatePixelShader(drawQuad15BitPBlob.m_data, drawQuad15BitPBlob.m_size, nullptr, m_drawQuad15BitPixelShader.GetMutablePtr());
// Quad input layout
{
D3D11_INPUT_ELEMENT_DESC descs[] =
{
"POSITION", // Semantic name
0, // Semantic index
DXGI_FORMAT_R32G32_FLOAT, // Format
0, // Input slot
0, // Aligned byte offset
D3D11_INPUT_PER_VERTEX_DATA, // Input slot class
0 // Instance data step rate
};
m_device->CreateInputLayout(descs, sizeof(descs) / sizeof(descs[0]), drawQuadVBlob.m_data, drawQuadVBlob.m_size, m_drawQuadInputLayout.GetMutablePtr());
}
// Quad depth stencil state
{
D3D11_DEPTH_STENCIL_DESC desc;
desc.DepthEnable = FALSE;
desc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO;
desc.DepthFunc = D3D11_COMPARISON_ALWAYS;
desc.StencilEnable = FALSE;
desc.StencilReadMask = 0;
desc.StencilWriteMask = 0;
desc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP;
desc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
desc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
desc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
desc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP;
desc.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
desc.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
desc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
if (m_device->CreateDepthStencilState(&desc, m_drawQuadDepthStencilState.GetMutablePtr()) != S_OK)
return false;
}
// Nearest neighbor sampler desc
{
D3D11_SAMPLER_DESC samplerDesc;
samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
samplerDesc.MipLODBias = 0.f;
samplerDesc.MaxAnisotropy = 1;
samplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER;
samplerDesc.BorderColor[0] = samplerDesc.BorderColor[1] = samplerDesc.BorderColor[2] = samplerDesc.BorderColor[3] = 1.0f;
samplerDesc.MinLOD = -FLT_MAX;
samplerDesc.MaxLOD = FLT_MAX;
if (m_device->CreateSamplerState(&samplerDesc, m_nearestNeighborSamplerState.GetMutablePtr()) != S_OK)
return false;
}
DXGI_FORMAT paletteTextureFormat = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
// Palette texture
{
D3D11_TEXTURE1D_DESC desc;
desc.Width = 256;
desc.MipLevels = 1;
desc.ArraySize = 1;
desc.Format = paletteTextureFormat;
desc.Usage = D3D11_USAGE_DYNAMIC;
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
desc.MiscFlags = 0;
uint8_t initialDataBytes[256][4];
for (int i = 0; i < 256; i++)
{
for (int ch = 0; ch < 4; ch++)
initialDataBytes[i][ch] = 255;
}
D3D11_SUBRESOURCE_DATA initialData;
initialData.pSysMem = initialDataBytes[0];
initialData.SysMemPitch = 256 * 4;
initialData.SysMemSlicePitch = 256 * 4;
if (m_device->CreateTexture1D(&desc, &initialData, m_paletteTexture.GetMutablePtr()) != S_OK)
return false;
}
// Palette texture SRV
{
D3D11_SHADER_RESOURCE_VIEW_DESC desc;
desc.Format = paletteTextureFormat;
desc.ViewDimension = D3D_SRV_DIMENSION_TEXTURE1D;
desc.Texture1D.MostDetailedMip = 0;
desc.Texture1D.MipLevels = 1;
if (m_device->CreateShaderResourceView(m_paletteTexture, &desc, m_paletteTextureSRV.GetMutablePtr()) != S_OK)
return false;
}
return true;
}
bool GpDisplayDriverD3D11::PresentFrameAndSync()
{
SynchronizeCursors();
float clearColor[4] = { 0.5f, 0.5f, 0.5f, 1.0f };
m_deviceContext->ClearRenderTargetView(m_backBufferRTV, clearColor);
ID3D11RenderTargetView *const rtv = m_backBufferRTV;
m_deviceContext->OMSetRenderTargets(1, &rtv, nullptr);
{
D3D11_VIEWPORT viewport;
viewport.TopLeftX = 0;
viewport.TopLeftY = 0;
viewport.Width = static_cast<FLOAT>(m_windowWidth);
viewport.Height = static_cast<FLOAT>(m_windowHeight);
viewport.MinDepth = 0.0f;
viewport.MaxDepth = 1.0f;
m_deviceContext->RSSetViewports(1, &viewport);
}
m_properties.m_renderFunc(m_properties.m_renderFuncContext);
DXGI_PRESENT_PARAMETERS presentParams;
ZeroMemory(&presentParams, sizeof(presentParams));
UINT lastPresentCount = 0;
if (FAILED(m_swapChain->GetLastPresentCount(&lastPresentCount)))
return false;
if (FAILED(m_swapChain->Present1(1, 0, &presentParams)))
return false;
//DebugPrintf("r: %i\n", static_cast<int>(r));
DXGI_FRAME_STATISTICS stats;
if (FAILED(m_swapChain->GetFrameStatistics(&stats)))
return false;
if (stats.SyncQPCTime.QuadPart != 0)
{
if (m_syncTimeBase.QuadPart == 0)
m_syncTimeBase = stats.SyncQPCTime;
LARGE_INTEGER timestamp;
timestamp.QuadPart = stats.SyncQPCTime.QuadPart - m_syncTimeBase.QuadPart;
bool compacted = false;
if (m_presentHistory.Size() > 0)
{
CompactedPresentHistoryItem &lastItem = m_presentHistory[m_presentHistory.Size() - 1];
LONGLONG timeDelta = timestamp.QuadPart - lastItem.m_timestamp.QuadPart;
if (timeDelta < 0)
timeDelta = 0; // This should never happen
if (timeDelta * static_cast<LONGLONG>(m_properties.m_frameTimeLockDenominator) < m_QPFrequency.QuadPart * static_cast<LONGLONG>(m_properties.m_frameTimeLockNumerator))
{
lastItem.m_numFrames++;
compacted = true;
}
}
if (!compacted)
{
if (m_presentHistory.Size() == m_presentHistory.CAPACITY)
m_presentHistory.RemoveFromStart();
CompactedPresentHistoryItem *newItem = m_presentHistory.Append();
newItem->m_timestamp = timestamp;
newItem->m_numFrames = 1;
}
}
if (m_presentHistory.Size() >= 2)
{
const size_t presentHistorySizeMinusOne = m_presentHistory.Size() - 1;
unsigned int numFrames = 0;
for (size_t i = 0; i < presentHistorySizeMinusOne; i++)
numFrames += m_presentHistory[i].m_numFrames;
LONGLONG timeFrame = m_presentHistory[presentHistorySizeMinusOne].m_timestamp.QuadPart - m_presentHistory[0].m_timestamp.QuadPart;
unsigned int cancelledFrames = 0;
LONGLONG cancelledTime = 0;
const int overshootTolerance = 2;
for (size_t i = 0; i < presentHistorySizeMinusOne; i++)
{
LONGLONG blockTimeframe = m_presentHistory[i + 1].m_timestamp.QuadPart - m_presentHistory[i].m_timestamp.QuadPart;
unsigned int blockNumFrames = m_presentHistory[i].m_numFrames;
if (blockTimeframe * static_cast<LONGLONG>(numFrames) >= timeFrame * static_cast<LONGLONG>(blockNumFrames) * overshootTolerance)
{
cancelledTime += blockTimeframe;
cancelledFrames += blockNumFrames;
}
}
numFrames -= cancelledFrames;
timeFrame -= cancelledTime;
// timeFrame / numFrames = Frame timestep
// Unless Frame timestep is within the frame lock range, a.k.a.
// timeFrame / numFrames / qpFreq >= minFrameTimeNum / minFrameTimeDenom
bool isInFrameTimeLock = false;
if (timeFrame * static_cast<LONGLONG>(m_properties.m_frameTimeLockMinDenominator) >= static_cast<LONGLONG>(numFrames) * static_cast<LONGLONG>(m_properties.m_frameTimeLockMinNumerator) * m_QPFrequency.QuadPart
&& timeFrame * static_cast<LONGLONG>(m_properties.m_frameTimeLockMaxDenominator) <= static_cast<LONGLONG>(numFrames) * static_cast<LONGLONG>(m_properties.m_frameTimeLockMaxNumerator) * m_QPFrequency.QuadPart)
{
isInFrameTimeLock = true;
}
LONGLONG frameTimeStep = m_frameTimeSliceSize;
if (!isInFrameTimeLock)
{
const int MAX_FRAMES_PER_STEP = 4;
frameTimeStep = timeFrame / numFrames;
if (frameTimeStep > m_frameTimeSliceSize * MAX_FRAMES_PER_STEP)
frameTimeStep = m_frameTimeSliceSize * MAX_FRAMES_PER_STEP;
}
m_frameTimeAccumulated += frameTimeStep;
while (m_frameTimeAccumulated >= m_frameTimeSliceSize)
{
m_properties.m_tickFunc(m_properties.m_tickFuncContext, m_vosFiber);
m_frameTimeAccumulated -= m_frameTimeSliceSize;
}
}
return true;
}
void GpDisplayDriverD3D11::SynchronizeCursors()
{
HCURSOR replacementCursor = nullptr;
if (m_activeCursor)
{
if (m_pendingCursor != m_activeCursor)
{
if (m_pendingCursor == nullptr)
{
m_currentStandardCursor = m_pendingStandardCursor;
ChangeToStandardCursor(m_currentStandardCursor);
m_activeCursor->DecRef();
m_activeCursor = nullptr;
}
else
{
ChangeToCursor(m_pendingCursor->GetHCursor());
m_pendingCursor->IncRef();
m_activeCursor->DecRef();
m_activeCursor = m_pendingCursor;
}
}
}
else
{
if (m_pendingCursor)
{
m_pendingCursor->IncRef();
m_activeCursor = m_pendingCursor;
ChangeToCursor(m_activeCursor->GetHCursor());
}
else
{
if (m_pendingStandardCursor != m_currentStandardCursor)
{
ChangeToStandardCursor(m_pendingStandardCursor);
m_currentStandardCursor = m_pendingStandardCursor;
}
}
}
}
void GpDisplayDriverD3D11::ChangeToCursor(HCURSOR cursor)
{
if (m_mouseIsInClientArea)
SetCursor(cursor);
SetClassLongPtrW(m_hwnd, GCLP_HCURSOR, reinterpret_cast<LONG_PTR>(cursor));
}
void GpDisplayDriverD3D11::ChangeToStandardCursor(EGpStandardCursor_t cursor)
{
switch (cursor)
{
case EGpStandardCursors::kArrow:
default:
ChangeToCursor(m_arrowCursor);
break;
}
}
void GpDisplayDriverD3D11::Run()
{
WNDCLASSEX wc;
LPVOID fiber = ConvertThreadToFiberEx(this, 0);
if (!fiber)
return; // ???
m_vosFiber = new GpFiber_Win32(fiber);
ZeroMemory(&wc, sizeof(wc));
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WinProc;
wc.hInstance = g_gpWindowsGlobals.m_hInstance;
wc.hCursor = m_arrowCursor;
wc.hbrBackground = (HBRUSH)COLOR_WINDOW;
wc.lpszClassName = "GPD3D11WindowClass";
RegisterClassEx(&wc);
LONG windowStyle = WS_OVERLAPPEDWINDOW;
HMENU menus = NULL;
// TODO: Fix the resolution here
RECT wr = { 0, 0, m_windowWidth, m_windowHeight };
AdjustWindowRect(&wr, windowStyle, menus != NULL);
m_hwnd = CreateWindowExW(NULL, L"GPD3D11WindowClass", L"GlidePort (Direct3D 11)", WS_OVERLAPPEDWINDOW, 300, 300, wr.right - wr.left, wr.bottom - wr.top, NULL, menus, g_gpWindowsGlobals.m_hInstance, NULL);
ShowWindow(m_hwnd, g_gpWindowsGlobals.m_nCmdShow);
StartD3DForWindow(m_hwnd, m_swapChain, m_device, m_deviceContext);
InitResources();
LARGE_INTEGER lastTimestamp;
memset(&lastTimestamp, 0, sizeof(lastTimestamp));
MSG msg;
for (;;)
{
if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
if (msg.message == WM_QUIT)
break;
else if (msg.message == WM_MOUSEMOVE)
m_mouseIsInClientArea = true;
else if (msg.message == WM_MOUSELEAVE)
m_mouseIsInClientArea = false;
}
else
{
PresentFrameAndSync();
}
}
// Exit
ConvertFiberToThread();
}
void GpDisplayDriverD3D11::Shutdown()
{
delete this;
}
void GpDisplayDriverD3D11::GetDisplayResolution(unsigned int *width, unsigned int *height, PortabilityLayer::PixelFormat *pixelFormat)
{
if (width)
*width = m_windowWidth;
if (height)
*height = m_windowHeight;
if (pixelFormat)
*pixelFormat = PortabilityLayer::PixelFormat_8BitStandard;
}
IGpDisplayDriverSurface *GpDisplayDriverD3D11::CreateSurface(size_t width, size_t height, PortabilityLayer::PixelFormat pixelFormat)
{
return GpDisplayDriverSurfaceD3D11::Create(m_device, m_deviceContext, width, height, pixelFormat);
}
void GpDisplayDriverD3D11::DrawSurface(IGpDisplayDriverSurface *surface, size_t x, size_t y, size_t width, size_t height)
{
ID3D11Buffer *vbPtr = m_quadVertexBuffer;
UINT vbStride = sizeof(float) * 2;
UINT zero = 0;
GpDisplayDriverSurfaceD3D11 *d3d11Surface = static_cast<GpDisplayDriverSurfaceD3D11*>(surface);
//m_deviceContext->OMSetDepthStencilState(m_drawQuadDepthStencilState, 0);
{
const float twoDivWidth = 2.0f / static_cast<float>(m_windowWidth);
const float negativeTwoDivHeight = -2.0f / static_cast<float>(m_windowHeight);
DrawQuadVertexConstants constantsData;
constantsData.m_ndcOriginX = static_cast<float>(x) * twoDivWidth - 1.0f;
constantsData.m_ndcOriginY = static_cast<float>(y) * negativeTwoDivHeight + 1.0f;
constantsData.m_ndcWidth = static_cast<float>(width) * twoDivWidth;
constantsData.m_ndcHeight = static_cast<float>(height) * negativeTwoDivHeight;
constantsData.m_surfaceDimensionX = static_cast<float>(d3d11Surface->GetWidth());
constantsData.m_surfaceDimensionY = static_cast<float>(d3d11Surface->GetHeight());
D3D11_MAPPED_SUBRESOURCE mappedConstants;
if (m_deviceContext->Map(m_drawQuadVertexConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedConstants) == S_OK)
{
memcpy(mappedConstants.pData, &constantsData, sizeof(constantsData));
m_deviceContext->Unmap(m_drawQuadVertexConstantBuffer, 0);
}
}
m_deviceContext->IASetVertexBuffers(0, 1, &vbPtr, &vbStride, &zero);
m_deviceContext->IASetIndexBuffer(m_quadIndexBuffer, DXGI_FORMAT_R16_UINT, 0);
m_deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
m_deviceContext->IASetInputLayout(m_drawQuadInputLayout);
ID3D11Buffer *vsConstants = m_drawQuadVertexConstantBuffer;
m_deviceContext->VSSetShader(m_drawQuadVertexShader, nullptr, 0);
m_deviceContext->VSSetConstantBuffers(0, 1, &vsConstants);
ID3D11SamplerState *samplerStates[] =
{
m_nearestNeighborSamplerState,
};
m_deviceContext->PSSetSamplers(0, sizeof(samplerStates) / sizeof(samplerStates[0]), samplerStates);
PortabilityLayer::PixelFormat pixelFormat = d3d11Surface->GetPixelFormat();
if (pixelFormat == PortabilityLayer::PixelFormat_8BitStandard || pixelFormat == PortabilityLayer::PixelFormat_8BitCustom)
{
ID3D11ShaderResourceView *psResourceViews[] =
{
d3d11Surface->GetSRV(),
m_paletteTextureSRV
};
m_deviceContext->PSSetShader(m_drawQuadPalettePixelShader, nullptr, 0);
m_deviceContext->PSSetShaderResources(0, sizeof(psResourceViews) / sizeof(psResourceViews[0]), psResourceViews);
}
else if (pixelFormat == PortabilityLayer::PixelFormat_RGB555)
{
ID3D11ShaderResourceView *psResourceViews[] =
{
d3d11Surface->GetSRV(),
};
m_deviceContext->PSSetShader(m_drawQuad15BitPixelShader, nullptr, 0);
m_deviceContext->PSSetShaderResources(0, sizeof(psResourceViews) / sizeof(psResourceViews[0]), psResourceViews);
}
else if (pixelFormat == PortabilityLayer::PixelFormat_RGB32)
{
ID3D11ShaderResourceView *psResourceViews[] =
{
d3d11Surface->GetSRV(),
};
m_deviceContext->PSSetShader(m_drawQuadRGBPixelShader, nullptr, 0);
m_deviceContext->PSSetShaderResources(0, sizeof(psResourceViews) / sizeof(psResourceViews[0]), psResourceViews);
}
else
{
return;
}
m_deviceContext->DrawIndexed(6, 0, 0);
}
IGpColorCursor *GpDisplayDriverD3D11::LoadColorCursor(int cursorID)
{
const size_t bufSize = MAX_PATH;
wchar_t path[bufSize];
int sz = _snwprintf(path, bufSize, L"%sPackaged\\WinCursors\\%i.cur", m_osGlobals->m_baseDir, cursorID);
if (sz < 0 || static_cast<size_t>(sz) >= bufSize)
return nullptr;
return GpColorCursor_Win32::Load(path);
}
// We can't just set the cursor because we want to post WM_SETCURSOR to keep it limited
// to the game window area, but depending on the fiber implementation, this may not be
// the window thread.
void GpDisplayDriverD3D11::SetColorCursor(IGpColorCursor *colorCursor)
{
GpColorCursor_Win32 *winCursor = static_cast<GpColorCursor_Win32*>(colorCursor);
winCursor->IncRef();
if (m_pendingCursor)
m_pendingCursor->DecRef();
m_pendingCursor = winCursor;
}
void GpDisplayDriverD3D11::SetStandardCursor(EGpStandardCursor_t standardCursor)
{
if (m_pendingCursor)
{
m_pendingCursor->DecRef();
m_pendingCursor = nullptr;
}
m_pendingStandardCursor = standardCursor;
}
void GpDisplayDriverD3D11::UpdatePalette(const void *paletteData)
{
const size_t dataSize = 256 * 4;
const uint8_t *paletteDataBytes = static_cast<const uint8_t *>(paletteData);
D3D11_MAPPED_SUBRESOURCE mappedResource;
if (m_deviceContext->Map(m_paletteTexture, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource) == S_OK)
{
uint8_t *textureDataBytes = static_cast<uint8_t *>(mappedResource.pData);
for (size_t chunkOffset = 0; chunkOffset < dataSize; chunkOffset += sizeof(__m128i))
{
__m128i chunkData = _mm_loadu_si128(reinterpret_cast<const __m128i*>(paletteDataBytes + chunkOffset));
_mm_stream_si128(reinterpret_cast<__m128i*>(textureDataBytes + chunkOffset), chunkData);
}
m_deviceContext->Unmap(m_paletteTexture, 0);
}
}
GpDisplayDriverD3D11 *GpDisplayDriverD3D11::Create(const GpDisplayDriverProperties &properties)
{
return new GpDisplayDriverD3D11(properties);
}
GpDisplayDriverD3D11::GpDisplayDriverD3D11(const GpDisplayDriverProperties &properties)
: m_properties(properties)
, m_frameTimeAccumulated(0)
, m_windowWidth(640)
, m_windowHeight(480)
, m_vosFiber(nullptr)
, m_osGlobals(static_cast<GpWindowsGlobals*>(properties.m_osGlobals))
, m_pendingCursor(nullptr)
, m_activeCursor(nullptr)
, m_currentStandardCursor(EGpStandardCursors::kArrow)
, m_pendingStandardCursor(EGpStandardCursors::kArrow)
, m_mouseIsInClientArea(false)
{
memset(&m_syncTimeBase, 0, sizeof(m_syncTimeBase));
QueryPerformanceFrequency(&m_QPFrequency);
m_frameTimeSliceSize = m_QPFrequency.QuadPart * static_cast<LONGLONG>(properties.m_frameTimeLockNumerator) / static_cast<LONGLONG>(properties.m_frameTimeLockDenominator);
m_arrowCursor = reinterpret_cast<HCURSOR>(LoadImageW(nullptr, MAKEINTRESOURCEW(OCR_NORMAL), IMAGE_CURSOR, 0, 0, LR_SHARED));
}
GpDisplayDriverD3D11::~GpDisplayDriverD3D11()
{
// GP TODO: Sloppy cleanup... Close the window!!
}

View File

@@ -1,122 +0,0 @@
#pragma once
#include "GpWindows.h"
#include "GpRingBuffer.h"
#include "IGpDisplayDriver.h"
#include "GpCoreDefs.h"
#include "GpDisplayDriverProperties.h"
#include "GpComPtr.h"
#include "PixelFormat.h"
struct GpWindowsGlobals;
class GpColorCursor_Win32;
struct IDXGISwapChain1;
struct ID3D11Buffer;
struct ID3D11DepthStencilState;
struct ID3D11Device;
struct ID3D11DeviceContext;
struct ID3D11InputLayout;
struct ID3D11PixelShader;
struct ID3D11RenderTargetView;
struct ID3D11SamplerState;
struct ID3D11ShaderResourceView;
struct ID3D11Texture1D;
struct ID3D11Texture2D;
struct ID3D11VertexShader;
class GpDisplayDriverD3D11 : public IGpDisplayDriver
{
public:
void Run() override;
void Shutdown() override;
void GetDisplayResolution(unsigned int *width, unsigned int *height, PortabilityLayer::PixelFormat *bpp) override;
IGpDisplayDriverSurface *CreateSurface(size_t width, size_t height, PortabilityLayer::PixelFormat pixelFormat) override;
void DrawSurface(IGpDisplayDriverSurface *surface, size_t x, size_t y, size_t width, size_t height) override;
IGpColorCursor *LoadColorCursor(int cursorID) override;
void SetColorCursor(IGpColorCursor *colorCursor) override;
void SetStandardCursor(EGpStandardCursor_t standardCursor) override;
void UpdatePalette(const void *paletteData) override;
static GpDisplayDriverD3D11 *Create(const GpDisplayDriverProperties &properties);
private:
struct DrawQuadVertexConstants
{
float m_ndcOriginX;
float m_ndcOriginY;
float m_ndcWidth;
float m_ndcHeight;
float m_surfaceDimensionX;
float m_surfaceDimensionY;
float m_unused[2];
};
struct CompactedPresentHistoryItem
{
LARGE_INTEGER m_timestamp;
unsigned int m_numFrames;
};
GpDisplayDriverD3D11(const GpDisplayDriverProperties &properties);
~GpDisplayDriverD3D11();
bool InitResources();
bool PresentFrameAndSync();
void SynchronizeCursors();
void ChangeToCursor(HCURSOR cursor);
void ChangeToStandardCursor(EGpStandardCursor_t cursor);
GpComPtr<IDXGISwapChain1> m_swapChain;
GpComPtr<ID3D11Device> m_device;
GpComPtr<ID3D11DeviceContext> m_deviceContext;
GpComPtr<ID3D11Buffer> m_quadIndexBuffer;
GpComPtr<ID3D11Buffer> m_quadVertexBuffer;
GpComPtr<ID3D11InputLayout> m_drawQuadInputLayout;
GpComPtr<ID3D11VertexShader> m_drawQuadVertexShader;
GpComPtr<ID3D11PixelShader> m_drawQuadPalettePixelShader;
GpComPtr<ID3D11PixelShader> m_drawQuad15BitPixelShader;
GpComPtr<ID3D11PixelShader> m_drawQuadRGBPixelShader;
GpComPtr<ID3D11Buffer> m_drawQuadVertexConstantBuffer;
GpComPtr<ID3D11DepthStencilState> m_drawQuadDepthStencilState;
GpComPtr<ID3D11SamplerState> m_nearestNeighborSamplerState;
GpComPtr<ID3D11Texture1D> m_paletteTexture;
GpComPtr<ID3D11ShaderResourceView> m_paletteTextureSRV;
GpComPtr<ID3D11Texture2D> m_backBufferTexture;
GpComPtr<ID3D11RenderTargetView> m_backBufferRTV;
GpRingBuffer<CompactedPresentHistoryItem, 60> m_presentHistory;
GpDisplayDriverProperties m_properties;
LARGE_INTEGER m_syncTimeBase;
LARGE_INTEGER m_QPFrequency;
UINT m_expectedSyncDelta;
bool m_isResettingSwapChain;
LONGLONG m_frameTimeAccumulated;
LONGLONG m_frameTimeSliceSize;
DWORD m_windowWidth;
DWORD m_windowHeight;
GpColorCursor_Win32 *m_activeCursor;
GpColorCursor_Win32 *m_pendingCursor;
EGpStandardCursor_t m_currentStandardCursor;
EGpStandardCursor_t m_pendingStandardCursor;
bool m_mouseIsInClientArea;
GpFiber *m_vosFiber;
GpWindowsGlobals *m_osGlobals;
HCURSOR m_arrowCursor;
HWND m_hwnd;
};

View File

@@ -1,7 +0,0 @@
#include "GpDisplayDriverFactoryD3D11.h"
#include "GpDisplayDriverD3D11.h"
IGpDisplayDriver *GpDisplayDriverFactoryD3D11::Create(const GpDisplayDriverProperties &properties)
{
return GpDisplayDriverD3D11::Create(properties);
}

View File

@@ -1,10 +0,0 @@
#pragma once
struct IGpDisplayDriver;
struct GpDisplayDriverProperties;
class GpDisplayDriverFactoryD3D11
{
public:
static IGpDisplayDriver *Create(const GpDisplayDriverProperties &properties);
};

View File

@@ -1,153 +0,0 @@
#include "GpDisplayDriverSurfaceD3D11.h"
#include "GpComPtr.h"
#include <d3d11.h>
#include <emmintrin.h>
#include <stdint.h>
#include <stdlib.h>
#include <new>
void GpDisplayDriverSurfaceD3D11::Upload(const void *data, size_t x, size_t y, size_t width, size_t height, size_t pitch)
{
D3D11_BOX box;
box.left = x;
box.right = x + width;
box.top = y;
box.bottom = y + height;
box.front = 0;
box.back = 1;
m_deviceContext->UpdateSubresource(m_texture, 0, &box, data, pitch, height * pitch);
}
void GpDisplayDriverSurfaceD3D11::UploadEntire(const void *data, size_t pitch)
{
D3D11_MAPPED_SUBRESOURCE mappedRes;
if (m_deviceContext->Map(m_texture, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedRes) == S_OK)
{
if (mappedRes.RowPitch < pitch || (pitch % 16) != 0)
return; // This should not happen, D3D10+ feature level should guarantee 16-byte alignment
const size_t destPitch = mappedRes.RowPitch;
const uint8_t *srcBytes = static_cast<const uint8_t*>(data);
uint8_t *destBytes = static_cast<uint8_t*>(mappedRes.pData);
const size_t height = m_height;
const size_t numM128PerRow = pitch / 16;
for (size_t row = 0; row < height; row++)
{
for (size_t moffs = 0; moffs < numM128PerRow; moffs++)
{
const __m128i v = _mm_load_si128(reinterpret_cast<const __m128i*>(srcBytes + moffs * 16));
_mm_stream_si128(reinterpret_cast<__m128i*>(destBytes + moffs * 16), v);
}
srcBytes += pitch;
destBytes += destPitch;
}
m_deviceContext->Unmap(m_texture, 0);
}
}
void GpDisplayDriverSurfaceD3D11::Destroy()
{
this->~GpDisplayDriverSurfaceD3D11();
free(this);
}
ID3D11ShaderResourceView *GpDisplayDriverSurfaceD3D11::GetSRV() const
{
return m_srv;
}
PortabilityLayer::PixelFormat GpDisplayDriverSurfaceD3D11::GetPixelFormat() const
{
return m_pixelFormat;
}
size_t GpDisplayDriverSurfaceD3D11::GetWidth() const
{
return m_width;
}
size_t GpDisplayDriverSurfaceD3D11::GetHeight() const
{
return m_height;
}
GpDisplayDriverSurfaceD3D11 *GpDisplayDriverSurfaceD3D11::Create(ID3D11Device *device, ID3D11DeviceContext *deviceContext, size_t width, size_t height, PortabilityLayer::PixelFormat pixelFormat)
{
DXGI_FORMAT dxgiFormat = DXGI_FORMAT_R8_UNORM;
switch (pixelFormat)
{
case PortabilityLayer::PixelFormat_8BitCustom:
case PortabilityLayer::PixelFormat_8BitStandard:
dxgiFormat = DXGI_FORMAT_R8_UINT;
break;
case PortabilityLayer::PixelFormat_RGB555:
dxgiFormat = DXGI_FORMAT_R16_UINT;
break;
case PortabilityLayer::PixelFormat_RGB32:
dxgiFormat = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
break;
case PortabilityLayer::PixelFormat_RGB24: // RGB24 is not supported as a surface format (PL must convert it)
default:
return nullptr;
}
D3D11_TEXTURE2D_DESC textureDesc;
textureDesc.Width = static_cast<UINT>(width);
textureDesc.Height = static_cast<UINT>(height);
textureDesc.MipLevels = 1;
textureDesc.ArraySize = 1;
textureDesc.Format = dxgiFormat;
textureDesc.SampleDesc.Count = 1;
textureDesc.SampleDesc.Quality = 0;
textureDesc.Usage = D3D11_USAGE_DYNAMIC;
textureDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
textureDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
textureDesc.MiscFlags = 0;
GpComPtr<ID3D11Texture2D> texture;
if (device->CreateTexture2D(&textureDesc, nullptr, texture.GetMutablePtr()) != S_OK)
return nullptr;
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
srvDesc.Format = dxgiFormat;
srvDesc.ViewDimension = D3D_SRV_DIMENSION_TEXTURE2D;
srvDesc.Texture2D.MipLevels = 1;
srvDesc.Texture2D.MostDetailedMip = 0;
GpComPtr<ID3D11ShaderResourceView> srv;
if (device->CreateShaderResourceView(texture, &srvDesc, srv.GetMutablePtr()) != S_OK)
return nullptr;
void *storage = malloc(sizeof(GpDisplayDriverSurfaceD3D11));
if (!storage)
{
texture->Release();
return nullptr;
}
return new (storage) GpDisplayDriverSurfaceD3D11(device, deviceContext, texture, srv, width, height, pixelFormat);
}
GpDisplayDriverSurfaceD3D11::GpDisplayDriverSurfaceD3D11(ID3D11Device *device, ID3D11DeviceContext *deviceContext, ID3D11Texture2D *texture, ID3D11ShaderResourceView *srv, size_t width, size_t height, PortabilityLayer::PixelFormat pixelFormat)
: m_width(width)
, m_height(height)
, m_pixelFormat(pixelFormat)
, m_device(device)
, m_deviceContext(deviceContext)
, m_texture(texture)
, m_srv(srv)
{
}
GpDisplayDriverSurfaceD3D11::~GpDisplayDriverSurfaceD3D11()
{
}

View File

@@ -1,38 +0,0 @@
#pragma once
#include "IGpDisplayDriverSurface.h"
#include "GpComPtr.h"
#include "PixelFormat.h"
struct ID3D11Device;
struct ID3D11DeviceContext;
struct ID3D11ShaderResourceView;
struct ID3D11Texture2D;
class GpDisplayDriverSurfaceD3D11 final : public IGpDisplayDriverSurface
{
public:
virtual void Upload(const void *data, size_t x, size_t y, size_t width, size_t height, size_t pitch) override;
virtual void UploadEntire(const void *data, size_t pitch) override;
virtual void Destroy() override;
ID3D11ShaderResourceView *GetSRV() const;
PortabilityLayer::PixelFormat GetPixelFormat() const;
size_t GetWidth() const;
size_t GetHeight() const;
static GpDisplayDriverSurfaceD3D11 *Create(ID3D11Device *device, ID3D11DeviceContext *deviceContext, size_t width, size_t height, PortabilityLayer::PixelFormat pixelFormat);
private:
GpDisplayDriverSurfaceD3D11(ID3D11Device *device, ID3D11DeviceContext *deviceContext, ID3D11Texture2D *texture, ID3D11ShaderResourceView *srv, size_t width, size_t height, PortabilityLayer::PixelFormat pixelFormat);
~GpDisplayDriverSurfaceD3D11();
size_t m_width;
size_t m_height;
PortabilityLayer::PixelFormat m_pixelFormat;
ID3D11Device *m_device;
ID3D11DeviceContext *m_deviceContext;
GpComPtr<ID3D11Texture2D> m_texture;
GpComPtr<ID3D11ShaderResourceView> m_srv;
};

View File

@@ -1,10 +0,0 @@
#pragma once
#include "CoreDefs.h"
class GpFiber
{
public:
virtual void YieldTo() = 0;
virtual void Destroy() = 0;
};

View File

@@ -1,11 +1,11 @@
#pragma once
class GpFiber;
struct IGpFiber;
class GpFiberStarter
{
public:
typedef void(*ThreadFunc_t)(void *context);
static GpFiber *StartFiber(ThreadFunc_t threadFunc, void *context, GpFiber *creatingFiber);
static IGpFiber *StartFiber(ThreadFunc_t threadFunc, void *context, IGpFiber *creatingFiber);
};

View File

@@ -9,7 +9,7 @@ namespace GpFiberStarter_Win32
struct FiberStartState
{
GpFiberStarter::ThreadFunc_t m_threadFunc;
GpFiber *m_creatingFiber;
IGpFiber *m_creatingFiber;
void *m_context;
};
@@ -18,7 +18,7 @@ namespace GpFiberStarter_Win32
const FiberStartState *tss = static_cast<const FiberStartState*>(lpThreadParameter);
GpFiberStarter::ThreadFunc_t threadFunc = tss->m_threadFunc;
GpFiber *creatingFiber = tss->m_creatingFiber;
IGpFiber *creatingFiber = tss->m_creatingFiber;
void *context = tss->m_context;
creatingFiber->YieldTo();
@@ -28,7 +28,7 @@ namespace GpFiberStarter_Win32
}
}
GpFiber *GpFiberStarter::StartFiber(ThreadFunc_t threadFunc, void *context, GpFiber *creatingFiber)
IGpFiber *GpFiberStarter::StartFiber(ThreadFunc_t threadFunc, void *context, IGpFiber *creatingFiber)
{
ULONG_PTR lowLimit;
ULONG_PTR highLimit;
@@ -48,5 +48,5 @@ GpFiber *GpFiberStarter::StartFiber(ThreadFunc_t threadFunc, void *context, GpFi
SwitchToFiber(fiber);
return new GpFiber_Win32(fiber);
return GpFiber_Win32::Create(fiber);
}

View File

@@ -1,4 +1,5 @@
#include "GpFiber_Win32.h"
#include "GpFiber_Win32.h"
#include <new>
GpFiber_Win32::GpFiber_Win32(LPVOID fiber)
: m_fiber(fiber)
@@ -11,7 +12,21 @@ void GpFiber_Win32::YieldTo()
}
void GpFiber_Win32::Destroy()
{
this->~GpFiber_Win32();
free(this);
}
GpFiber_Win32::~GpFiber_Win32()
{
DeleteFiber(m_fiber);
delete this;
}
}
IGpFiber *GpFiber_Win32::Create(LPVOID fiber)
{
void *storage = malloc(sizeof(GpFiber_Win32));
if (!storage)
return nullptr;
return new (storage) GpFiber_Win32(fiber);
}

View File

@@ -1,15 +1,18 @@
#pragma once
#include "GpWindows.h"
#include "GpFiber.h"
class GpFiber_Win32 final : public GpFiber
{
public:
explicit GpFiber_Win32(LPVOID fiber);
void YieldTo() override;
void Destroy() override;
private:
LPVOID m_fiber;
};
#pragma once
#include "GpWindows.h"
#include "IGpFiber.h"
class GpFiber_Win32 final : public IGpFiber
{
public:
void YieldTo() override;
void Destroy() override;
static IGpFiber *Create(LPVOID fiber);
private:
explicit GpFiber_Win32(LPVOID fiber);
~GpFiber_Win32();
LPVOID m_fiber;
};

View File

@@ -245,7 +245,13 @@ bool GpFileSystem_Win32::ResolvePath(PortabilityLayer::EVirtualDirectory virtual
memcpy(outPath, baseDir, sizeof(wchar_t) * baseDirLen);
for (size_t i = 0; i < pathLen; i++)
outPath[baseDirLen + i] = static_cast<wchar_t>(path[i]);
{
char c = path[i];
if (c == '/')
c = '\\';
outPath[baseDirLen + i] = static_cast<wchar_t>(c);
}
outPath[baseDirLen + pathLen] = static_cast<wchar_t>(0);

View File

@@ -1,30 +1,103 @@
#include "GpFontHandler_FreeType2.h"
#include "CoreDefs.h"
#include "IOStream.h"
#include "HostFont.h"
#include "HostFontRenderedGlyph.h"
#include "RenderedGlyphMetrics.h"
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_MODULE_H
#include <stdint.h>
#include <stdlib.h>
#include <new>
#include <assert.h>
class GpFontRenderedGlyph_FreeType2 final : public PortabilityLayer::HostFontRenderedGlyph
{
public:
const PortabilityLayer::RenderedGlyphMetrics &GetMetrics() const override;
const void *GetData() const override;
void Destroy() override;
static GpFontRenderedGlyph_FreeType2 *Create(size_t dataSize, const PortabilityLayer::RenderedGlyphMetrics &metrics);
void *GetMutableData();
private:
GpFontRenderedGlyph_FreeType2(void *data, const PortabilityLayer::RenderedGlyphMetrics &metrics);
~GpFontRenderedGlyph_FreeType2();
void *m_data;
PortabilityLayer::RenderedGlyphMetrics m_metrics;
};
class GpFont_FreeType2 final : public PortabilityLayer::HostFont
{
public:
void Destroy() override;
GpFontRenderedGlyph_FreeType2 *Render(uint32_t unicodeCodePoint, unsigned int size) override;
static GpFont_FreeType2 *Create(FT_Face face);
static GpFont_FreeType2 *Create(const FT_StreamRec_ &streamRec, PortabilityLayer::IOStream *stream);
bool FTLoad(const FT_Library &library);
private:
explicit GpFont_FreeType2(FT_Face face);
explicit GpFont_FreeType2(const FT_StreamRec_ &streamRec, PortabilityLayer::IOStream *stream);
~GpFont_FreeType2();
FT_StreamRec_ m_ftStream;
FT_Face m_face;
PortabilityLayer::IOStream *m_stream;
unsigned int m_currentSize;
};
const PortabilityLayer::RenderedGlyphMetrics &GpFontRenderedGlyph_FreeType2::GetMetrics() const
{
return m_metrics;
}
const void *GpFontRenderedGlyph_FreeType2::GetData() const
{
return m_data;
}
void GpFontRenderedGlyph_FreeType2::Destroy()
{
this->~GpFontRenderedGlyph_FreeType2();
free(this);
}
GpFontRenderedGlyph_FreeType2 *GpFontRenderedGlyph_FreeType2::Create(size_t dataSize, const PortabilityLayer::RenderedGlyphMetrics &metrics)
{
size_t alignedPrefixSize = (sizeof(GpFontRenderedGlyph_FreeType2) + PL_SYSTEM_MEMORY_ALIGNMENT - 1);
alignedPrefixSize -= alignedPrefixSize % PL_SYSTEM_MEMORY_ALIGNMENT;
void *storage = malloc(alignedPrefixSize + dataSize);
if (!storage)
return nullptr;
return new (storage) GpFontRenderedGlyph_FreeType2(static_cast<uint8_t*>(storage) + alignedPrefixSize, metrics);
}
void *GpFontRenderedGlyph_FreeType2::GetMutableData()
{
return m_data;
}
GpFontRenderedGlyph_FreeType2::GpFontRenderedGlyph_FreeType2(void *data, const PortabilityLayer::RenderedGlyphMetrics &metrics)
: m_metrics(metrics)
, m_data(data)
{
}
GpFontRenderedGlyph_FreeType2::~GpFontRenderedGlyph_FreeType2()
{
}
void GpFont_FreeType2::Destroy()
{
@@ -32,23 +105,120 @@ void GpFont_FreeType2::Destroy()
free(this);
}
GpFont_FreeType2 *GpFont_FreeType2::Create(FT_Face face)
GpFontRenderedGlyph_FreeType2 *GpFont_FreeType2::Render(uint32_t unicodeCodePoint, unsigned int size)
{
if (m_currentSize != size)
{
if (FT_Set_Pixel_Sizes(m_face, 0, size) != 0)
return nullptr;
m_currentSize = size;
}
FT_UInt glyphIndex = FT_Get_Char_Index(m_face, unicodeCodePoint);
if (!glyphIndex)
return nullptr;
if (FT_Load_Glyph(m_face, glyphIndex, FT_LOAD_MONOCHROME | FT_LOAD_TARGET_MONO) != 0)
return nullptr;
if (FT_Render_Glyph(m_face->glyph, FT_RENDER_MODE_MONO) != 0)
return nullptr;
const FT_GlyphSlot glyph = m_face->glyph;
if (glyph->bitmap.pixel_mode != FT_PIXEL_MODE_MONO)
return nullptr; // ????
PortabilityLayer::RenderedGlyphMetrics metrics;
memset(&metrics, 0, sizeof(metrics));
metrics.m_bearingX = glyph->metrics.horiBearingX / 64;
metrics.m_bearingY = glyph->metrics.horiBearingY / 64;
metrics.m_glyphWidth = glyph->bitmap.width;
metrics.m_glyphHeight = glyph->bitmap.rows;
metrics.m_advanceX = glyph->metrics.horiAdvance / 64;
const size_t numRowsRequired = glyph->bitmap.rows;
size_t pitchRequired = (glyph->bitmap.width + 7) / 8;
pitchRequired = pitchRequired + (PL_SYSTEM_MEMORY_ALIGNMENT - 1);
pitchRequired -= pitchRequired % PL_SYSTEM_MEMORY_ALIGNMENT;
const size_t glyphDataSize = numRowsRequired * pitchRequired;
metrics.m_glyphDataPitch = pitchRequired;
GpFontRenderedGlyph_FreeType2 *renderedGlyph = GpFontRenderedGlyph_FreeType2::Create(glyphDataSize, metrics);
if (!renderedGlyph)
return nullptr;
uint8_t *fillData = static_cast<uint8_t*>(renderedGlyph->GetMutableData());
unsigned int bmWidth = glyph->bitmap.width;
unsigned int bmHeight = glyph->bitmap.rows;
unsigned int bmPitch = glyph->bitmap.pitch;
unsigned int copyableBytesPerRow = (bmWidth + 7) / 8;
const uint8_t *bmBytes = glyph->bitmap.buffer;
size_t fillOffset = 0;
for (unsigned int row = 0; row < bmHeight; row++)
{
const uint8_t *bmReadStart = bmBytes + bmPitch * row;
uint8_t *bmWriteStart = fillData + pitchRequired * row;
for (unsigned int i = 0; i < copyableBytesPerRow; i++)
{
const uint8_t b = bmReadStart[i];
uint8_t fillByte = 0;
for (int bit = 0; bit < 8; bit++)
fillByte |= ((b >> (7 - bit)) & 1) << bit;
bmWriteStart[i] = fillByte;
}
}
return renderedGlyph;
}
GpFont_FreeType2 *GpFont_FreeType2::Create(const FT_StreamRec_ &streamRec, PortabilityLayer::IOStream *stream)
{
void *storage = malloc(sizeof(GpFont_FreeType2));
if (!storage)
return nullptr;
return new (storage) GpFont_FreeType2(face);
return new (storage) GpFont_FreeType2(streamRec, stream);
}
GpFont_FreeType2::GpFont_FreeType2(FT_Face face)
: m_face(face)
bool GpFont_FreeType2::FTLoad(const FT_Library &library)
{
FT_Open_Args openArgs;
memset(&openArgs, 0, sizeof(openArgs));
openArgs.flags = FT_OPEN_STREAM;
openArgs.stream = &m_ftStream;
FT_Error errorCode = FT_Open_Face(library, &openArgs, 0, &m_face);
if (errorCode != 0)
return false;
return true;
}
GpFont_FreeType2::GpFont_FreeType2(const FT_StreamRec_ &streamRec, PortabilityLayer::IOStream *stream)
: m_face(nullptr)
, m_ftStream(streamRec)
, m_stream(stream)
, m_currentSize(0)
{
assert(stream);
}
GpFont_FreeType2::~GpFont_FreeType2()
{
FT_Done_Face(m_face);
if (m_face)
FT_Done_Face(m_face);
m_stream->Close();
}
GpFontHandler_FreeType2 *GpFontHandler_FreeType2::Create()
@@ -69,7 +239,6 @@ GpFontHandler_FreeType2 *GpFontHandler_FreeType2::Create()
PortabilityLayer::HostFont *GpFontHandler_FreeType2::LoadFont(PortabilityLayer::IOStream *stream)
{
FT_StreamRec_ ftStream;
memset(&ftStream, 0, sizeof(ftStream));
ftStream.size = 0x7fffffff;
@@ -78,26 +247,27 @@ PortabilityLayer::HostFont *GpFontHandler_FreeType2::LoadFont(PortabilityLayer::
ftStream.read = FTStreamIo;
ftStream.close = FTStreamClose;
FT_Open_Args openArgs;
memset(&openArgs, 0, sizeof(openArgs));
openArgs.flags = FT_OPEN_STREAM;
openArgs.stream = &ftStream;
FT_Face face;
FT_Error errorCode = FT_Open_Face(m_library, &openArgs, 0, &face);
if (errorCode != 0)
return nullptr;
GpFont_FreeType2 *font = GpFont_FreeType2::Create(face);
GpFont_FreeType2 *font = GpFont_FreeType2::Create(ftStream, stream);
if (!font)
{
FT_Done_Face(face);
stream->Close();
return nullptr;
}
if (!font->FTLoad(m_library))
{
font->Destroy();
return nullptr;
}
return font;
}
bool GpFontHandler_FreeType2::KeepStreamOpen() const
{
return true;
}
void GpFontHandler_FreeType2::Shutdown()
{
this->~GpFontHandler_FreeType2();
@@ -120,17 +290,17 @@ GpFontHandler_FreeType2::~GpFontHandler_FreeType2()
void *GpFontHandler_FreeType2::FTAllocThunk(FT_Memory memory, long size)
{
return static_cast<GpFontHandler_FreeType2*>(memory->user)->FTAlloc(size);
return static_cast<GpFontHandler_FreeType2*>(memory->user)->FTAlloc(size);
}
void GpFontHandler_FreeType2::FTFreeThunk(FT_Memory memory, void* block)
{
static_cast<GpFontHandler_FreeType2*>(memory->user)->FTFree(block);
{
static_cast<GpFontHandler_FreeType2*>(memory->user)->FTFree(block);
}
void *GpFontHandler_FreeType2::FTReallocThunk(FT_Memory memory, long curSize, long newSize, void *block)
{
return static_cast<GpFontHandler_FreeType2*>(memory->user)->FTRealloc(curSize, newSize, block);
return static_cast<GpFontHandler_FreeType2*>(memory->user)->FTRealloc(curSize, newSize, block);
}
@@ -147,9 +317,9 @@ unsigned long GpFontHandler_FreeType2::FTStreamIo(FT_Stream stream, unsigned lon
}
const size_t bytesRead = ioStream->Read(buffer, count);
return static_cast<unsigned long>(bytesRead);
return static_cast<unsigned long>(bytesRead);
}
void GpFontHandler_FreeType2::FTStreamClose(FT_Stream stream)
{
(void)stream;
@@ -157,14 +327,14 @@ void GpFontHandler_FreeType2::FTStreamClose(FT_Stream stream)
void *GpFontHandler_FreeType2::FTAlloc(long size)
{
return malloc(static_cast<size_t>(size));
return malloc(static_cast<size_t>(size));
}
void GpFontHandler_FreeType2::FTFree(void* block)
void GpFontHandler_FreeType2::FTFree(void* block)
{
free(block);
free(block);
}
void *GpFontHandler_FreeType2::FTRealloc(long curSize, long newSize, void *block)
{
(void)curSize;

View File

@@ -18,6 +18,8 @@ public:
PortabilityLayer::HostFont *LoadFont(PortabilityLayer::IOStream *stream) override;
void Shutdown() override;
bool KeepStreamOpen() const override;
static GpFontHandler_FreeType2 *Create();
private:

View File

@@ -13,7 +13,7 @@
namespace
{
void TickAppEnvironment(void *context, GpFiber *vosFiber)
void TickAppEnvironment(void *context, IGpFiber *vosFiber)
{
static_cast<GpAppEnvironment*>(context)->Tick(vosFiber);
}

View File

@@ -1,8 +1,9 @@
#include "GpMain.h"
#include "GpAudioDriverFactory.h"
#include "GpColorCursor_Win32.h"
#include "GpDisplayDriverFactory.h"
#include "GpDisplayDriverFactoryD3D11.h"
#include "GpGlobalConfig.h"
#include "GpFiber_Win32.h"
#include "GpFileSystem_Win32.h"
#include "GpAppInterface.h"
#include "GpSystemServices_Win32.h"
@@ -16,6 +17,7 @@
GpWindowsGlobals g_gpWindowsGlobals;
extern "C" __declspec(dllimport) IGpAudioDriver *GpDriver_CreateAudioDriver_XAudio2(const GpAudioDriverProperties &properties);
extern "C" __declspec(dllimport) IGpDisplayDriver *GpDriver_CreateDisplayDriver_D3D11(const GpDisplayDriverProperties &properties);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
@@ -28,10 +30,13 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
g_gpWindowsGlobals.m_nCmdShow = nCmdShow;
g_gpWindowsGlobals.m_baseDir = GpFileSystem_Win32::GetInstance()->GetBasePath();
g_gpWindowsGlobals.m_createFiberFunc = GpFiber_Win32::Create;
g_gpWindowsGlobals.m_loadColorCursorFunc = GpColorCursor_Win32::Load;
g_gpGlobalConfig.m_displayDriverType = EGpDisplayDriverType_D3D11;
g_gpGlobalConfig.m_osGlobals = &g_gpWindowsGlobals;
GpDisplayDriverFactory::RegisterDisplayDriverFactory(EGpDisplayDriverType_D3D11, GpDisplayDriverFactoryD3D11::Create);
GpDisplayDriverFactory::RegisterDisplayDriverFactory(EGpDisplayDriverType_D3D11, GpDriver_CreateDisplayDriver_D3D11);
GpAudioDriverFactory::RegisterAudioDriverFactory(EGpAudioDriverType_XAudio2, GpDriver_CreateAudioDriver_XAudio2);
return GpMain::Run();

View File

@@ -7,7 +7,7 @@ GpPLGlueDisplayDriver::GpPLGlueDisplayDriver()
{
}
void GpPLGlueDisplayDriver::GetDisplayResolution(unsigned int *width, unsigned int *height, PortabilityLayer::PixelFormat *bpp)
void GpPLGlueDisplayDriver::GetDisplayResolution(unsigned int *width, unsigned int *height, GpPixelFormat_t *bpp)
{
m_displayDriver->GetDisplayResolution(width, height, bpp);
}

View File

@@ -9,7 +9,7 @@ class GpPLGlueDisplayDriver final : public PortabilityLayer::HostDisplayDriver
public:
GpPLGlueDisplayDriver();
void GetDisplayResolution(unsigned int *width, unsigned int *height, PortabilityLayer::PixelFormat *bpp) override;
void GetDisplayResolution(unsigned int *width, unsigned int *height, GpPixelFormat_t *bpp) override;
IGpColorCursor *LoadColorCursor(int id) override;
void SetColorCursor(IGpColorCursor *colorCursor) override;
void SetStandardCursor(EGpStandardCursor_t standardCursor) override;

View File

@@ -1,63 +0,0 @@
#pragma once
#include <stdint.h>
#include <assert.h>
#include "GpCoreDefs.h"
template<class TItem, size_t TCapacity>
class GpRingBuffer
{
public:
GpRingBuffer()
: m_Size(0)
, m_Start(0)
{
}
TItem &operator[](size_t index)
{
assert(index < m_Size);
return m_Items[(m_Start + index) % TCapacity];
}
void RemoveFromStart()
{
assert(m_Size >= 1);
m_Start = (m_Start + 1) % TCapacity;
m_Size--;
}
void RemoveFromEnd()
{
assert(m_Size >= 1);
m_Size--;
}
void Clear()
{
m_Size = 0;
m_Start = 0;
}
size_t Size() const
{
return m_Size;
}
TItem *Append()
{
if (m_Size == TCapacity)
return nullptr;
m_Size++;
return &m_Items[(m_Start + (m_Size - 1)) % TCapacity];
}
static const size_t CAPACITY = TCapacity;
private:
TItem m_Items[TCapacity];
size_t m_Size;
size_t m_Start;
};

View File

@@ -1,52 +0,0 @@
static unsigned char gs_shaderData[] = {
68, 88, 66, 67, 181, 133, 124, 121, 179, 141, 64, 216, 166, 21, 153,
10, 33, 21, 80, 169, 1, 0, 0, 0, 152, 2, 0, 0, 5, 0,
0, 0, 52, 0, 0, 0, 224, 0, 0, 0, 56, 1, 0, 0, 108,
1, 0, 0, 28, 2, 0, 0, 82, 68, 69, 70, 164, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0,
0, 0, 4, 255, 255, 0, 137, 0, 0, 122, 0, 0, 0, 92, 0,
0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
107, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4, 0, 0,
0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0,
0, 0, 115, 117, 114, 102, 97, 99, 101, 83, 97, 109, 112, 108, 101,
114, 0, 115, 117, 114, 102, 97, 99, 101, 84, 101, 120, 116, 117, 114,
101, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41,
32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
109, 112, 105, 108, 101, 114, 32, 49, 48, 46, 49, 0, 171, 171, 73,
83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0,
56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0,
0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3,
3, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 171, 171, 79, 83, 71,
78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0,
0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69,
84, 0, 171, 171, 83, 72, 68, 82, 168, 0, 0, 0, 64, 0, 0,
0, 42, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0, 0,
0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85,
85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0,
101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0,
2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 0, 0,
0, 0, 70, 16, 16, 0, 1, 0, 0, 0, 70, 126, 16, 0, 0,
0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5,
18, 32, 16, 0, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0,
0, 54, 0, 0, 5, 98, 32, 16, 0, 0, 0, 0, 0, 6, 17,
16, 0, 1, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0,
0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 62, 0, 0, 1,
83, 84, 65, 84, 116, 0, 0, 0, 5, 0, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0,
};
namespace GpBinarizedShaders
{
const unsigned char *g_drawQuad15BitP_D3D11[2] = { gs_shaderData, gs_shaderData + sizeof(gs_shaderData) };
};

View File

@@ -1,58 +0,0 @@
static unsigned char gs_shaderData[] = {
68, 88, 66, 67, 96, 46, 192, 91, 73, 216, 92, 145, 77, 166, 215,
215, 59, 255, 4, 67, 1, 0, 0, 0, 240, 2, 0, 0, 5, 0,
0, 0, 52, 0, 0, 0, 224, 0, 0, 0, 56, 1, 0, 0, 108,
1, 0, 0, 116, 2, 0, 0, 82, 68, 69, 70, 164, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0,
0, 0, 4, 255, 255, 0, 137, 0, 0, 122, 0, 0, 0, 92, 0,
0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 255,
255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
107, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 2, 0, 0,
0, 255, 255, 255, 255, 1, 0, 0, 0, 1, 0, 0, 0, 13, 0,
0, 0, 115, 117, 114, 102, 97, 99, 101, 84, 101, 120, 116, 117, 114,
101, 0, 112, 97, 108, 101, 116, 116, 101, 84, 101, 120, 116, 117, 114,
101, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41,
32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
109, 112, 105, 108, 101, 114, 32, 49, 48, 46, 49, 0, 171, 171, 73,
83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0,
56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0,
0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3,
3, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 171, 171, 79, 83, 71,
78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0,
0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69,
84, 0, 171, 171, 83, 72, 68, 82, 0, 1, 0, 0, 64, 0, 0,
0, 64, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0,
0, 0, 68, 68, 0, 0, 88, 16, 0, 4, 0, 112, 16, 0, 1,
0, 0, 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0,
1, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0,
0, 104, 0, 0, 2, 1, 0, 0, 0, 27, 0, 0, 5, 50, 0,
16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0, 54,
0, 0, 8, 194, 0, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 45, 0, 0, 7, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14,
16, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 54,
0, 0, 8, 226, 0, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 45, 0, 0, 7, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14,
16, 0, 0, 0, 0, 0, 70, 126, 16, 0, 1, 0, 0, 0, 54,
0, 0, 5, 114, 32, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0,
0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0,
0, 1, 64, 0, 0, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84,
65, 84, 116, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 0,
0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0,
};
namespace GpBinarizedShaders
{
const unsigned char *g_drawQuadPaletteP_D3D11[2] = { gs_shaderData, gs_shaderData + sizeof(gs_shaderData) };
};

View File

@@ -1,52 +0,0 @@
static unsigned char gs_shaderData[] = {
68, 88, 66, 67, 181, 133, 124, 121, 179, 141, 64, 216, 166, 21, 153,
10, 33, 21, 80, 169, 1, 0, 0, 0, 152, 2, 0, 0, 5, 0,
0, 0, 52, 0, 0, 0, 224, 0, 0, 0, 56, 1, 0, 0, 108,
1, 0, 0, 28, 2, 0, 0, 82, 68, 69, 70, 164, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0,
0, 0, 4, 255, 255, 0, 137, 0, 0, 122, 0, 0, 0, 92, 0,
0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
107, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4, 0, 0,
0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0,
0, 0, 115, 117, 114, 102, 97, 99, 101, 83, 97, 109, 112, 108, 101,
114, 0, 115, 117, 114, 102, 97, 99, 101, 84, 101, 120, 116, 117, 114,
101, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41,
32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
109, 112, 105, 108, 101, 114, 32, 49, 48, 46, 49, 0, 171, 171, 73,
83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0,
56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0,
0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3,
3, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 171, 171, 79, 83, 71,
78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0,
0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69,
84, 0, 171, 171, 83, 72, 68, 82, 168, 0, 0, 0, 64, 0, 0,
0, 42, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0, 0,
0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85,
85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0,
101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0,
2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 0, 0,
0, 0, 70, 16, 16, 0, 1, 0, 0, 0, 70, 126, 16, 0, 0,
0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5,
18, 32, 16, 0, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0,
0, 54, 0, 0, 5, 98, 32, 16, 0, 0, 0, 0, 0, 6, 17,
16, 0, 1, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0,
0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 62, 0, 0, 1,
83, 84, 65, 84, 116, 0, 0, 0, 5, 0, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0,
};
namespace GpBinarizedShaders
{
const unsigned char *g_drawQuadRGBP_D3D11[2] = { gs_shaderData, gs_shaderData + sizeof(gs_shaderData) };
};

View File

@@ -1,59 +0,0 @@
static unsigned char gs_shaderData[] = {
68, 88, 66, 67, 201, 152, 69, 241, 255, 40, 36, 8, 50, 11, 168,
246, 127, 135, 38, 130, 1, 0, 0, 0, 8, 3, 0, 0, 5, 0,
0, 0, 52, 0, 0, 0, 72, 1, 0, 0, 124, 1, 0, 0, 212,
1, 0, 0, 140, 2, 0, 0, 82, 68, 69, 70, 12, 1, 0, 0,
1, 0, 0, 0, 88, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0,
0, 0, 4, 254, 255, 0, 137, 0, 0, 225, 0, 0, 0, 60, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
83, 68, 114, 97, 119, 81, 117, 97, 100, 86, 101, 114, 116, 101, 120,
67, 111, 110, 115, 116, 97, 110, 116, 115, 0, 171, 171, 171, 60, 0,
0, 0, 2, 0, 0, 0, 112, 0, 0, 0, 32, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 160, 0, 0, 0, 0, 0, 0, 0,
16, 0, 0, 0, 2, 0, 0, 0, 184, 0, 0, 0, 0, 0, 0,
0, 200, 0, 0, 0, 16, 0, 0, 0, 16, 0, 0, 0, 2, 0,
0, 0, 184, 0, 0, 0, 0, 0, 0, 0, 110, 100, 99, 79, 114,
105, 103, 105, 110, 65, 110, 100, 68, 105, 109, 101, 110, 115, 105, 111,
110, 115, 0, 171, 1, 0, 3, 0, 1, 0, 4, 0, 0, 0, 0,
0, 0, 0, 0, 0, 115, 117, 114, 102, 97, 99, 101, 68, 105, 109,
101, 110, 115, 105, 111, 110, 115, 95, 85, 110, 117, 115, 101, 100, 0,
77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72,
76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112,
105, 108, 101, 114, 32, 49, 48, 46, 49, 0, 171, 171, 171, 73, 83,
71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
0, 0, 0, 0, 3, 3, 0, 0, 80, 79, 83, 73, 84, 73, 79,
78, 0, 171, 171, 171, 79, 83, 71, 78, 80, 0, 0, 0, 2, 0,
0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1,
0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0,
68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0,
0, 1, 0, 0, 0, 3, 12, 0, 0, 83, 86, 95, 80, 79, 83,
73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0,
171, 171, 171, 83, 72, 68, 82, 176, 0, 0, 0, 64, 0, 1, 0,
44, 0, 0, 0, 89, 0, 0, 4, 70, 142, 32, 0, 0, 0, 0,
0, 2, 0, 0, 0, 95, 0, 0, 3, 50, 16, 16, 0, 0, 0,
0, 0, 103, 0, 0, 4, 242, 32, 16, 0, 0, 0, 0, 0, 1,
0, 0, 0, 101, 0, 0, 3, 50, 32, 16, 0, 1, 0, 0, 0,
50, 0, 0, 11, 50, 32, 16, 0, 0, 0, 0, 0, 70, 16, 16,
0, 0, 0, 0, 0, 230, 138, 32, 0, 0, 0, 0, 0, 0, 0,
0, 0, 70, 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54,
0, 0, 8, 194, 32, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128,
63, 56, 0, 0, 8, 50, 32, 16, 0, 1, 0, 0, 0, 70, 16,
16, 0, 0, 0, 0, 0, 70, 128, 32, 0, 0, 0, 0, 0, 1,
0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0,
4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0,
0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
namespace GpBinarizedShaders
{
const unsigned char *g_drawQuadV_D3D11[2] = { gs_shaderData, gs_shaderData + sizeof(gs_shaderData) };
};

17
GpD3D/resource.h Normal file
View File

@@ -0,0 +1,17 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by GpD3D.rc
//
#define IDI_ICON1 101
#define IDI_ICON2 102
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

BIN
GpD3D/x64/Debug/GpD3D.res Normal file

Binary file not shown.