62 LogWarning(
"Bridge map is nonempty on destruction.");
72 LogWarning(
"Draw target map nonempty on destruction.");
82 LogWarning(
"Input layout map nonempty on destruction.");
96 Initialize(
nullptr, D3D_DRIVER_TYPE_HARDWARE,
nullptr, 0, minFeatureLevel);
101 HMODULE softwareModule,
UINT flags, D3D_FEATURE_LEVEL minFeatureLevel)
103 Initialize(adapter, driverType, softwareModule, flags, minFeatureLevel);
109 Initialize(
nullptr, D3D_DRIVER_TYPE_HARDWARE,
nullptr, 0, minFeatureLevel);
125 UINT ySize, D3D_DRIVER_TYPE driverType, HMODULE softwareModule,
126 UINT flags, D3D_FEATURE_LEVEL minFeatureLevel)
128 Initialize(adapter, driverType, softwareModule, flags, minFeatureLevel);
145 if (!texture || !engine)
147 LogError(
"The inputs must be nonnull.");
151 if (!texture->IsShared())
153 LogError(
"The texture must allow sharing.");
167 std::shared_ptr<DX11GraphicsObject> dxShared;
170 dxShared = std::make_shared<DX11Texture2>(
mDevice,
static_cast<DX11Texture2 const*
>(dxTexture));
174 dxShared = std::make_shared<DX11TextureRT>(
mDevice,
static_cast<DX11TextureRT const*
>(dxTexture));
178 dxShared = std::make_shared<DX11TextureDS>(
mDevice,
static_cast<DX11TextureDS const*
>(dxTexture));
180 mGOMap.Insert(texture.get(), dxShared);
190 if (!resource->GetData())
192 LogWarning(
"Resource does not have system memory, creating it.");
193 resource->CreateStorage();
211 std::wstring
name(desc.DeviceName);
223 LogError(
"This function requires a swap chain.");
232 std::wstring
name(desc.DeviceName);
241 if (iter->second != fullscreen)
254 LogError(
"Failed to go fullscreen.");
260 hr =
mSwapChain->SetFullscreenState(FALSE,
nullptr);
263 iter->second =
false;
281 LogError(
"This function requires a swap chain.");
290 IDXGIOutput* display;
291 if (S_OK ==
mSwapChain->GetFullscreenState(&isFullscreen, &display))
295 mSwapChain->SetFullscreenState(FALSE,
nullptr);
340 HMODULE softwareModule,
UINT flags, D3D_FEATURE_LEVEL minFeatureLevel)
373 mILMap = std::make_unique<DX11InputLayoutManager>();
423 IDXGIFactory1* factory =
nullptr;
424 HRESULT hr = CreateDXGIFactory1(IID_PPV_ARGS(&factory));
433 for (uint32_t i = 0; ; ++i)
435 IDXGIAdapter1* adapter =
nullptr;
436 if (factory->EnumAdapters1(i, &adapter) == DXGI_ERROR_NOT_FOUND)
442 DXGI_ADAPTER_DESC1 desc;
443 hr = adapter->GetDesc1(&desc);
451 if (desc.Flags != DXGI_ADAPTER_FLAG_SOFTWARE)
486 UINT const maxFeatureLevels = 7;
487 D3D_FEATURE_LEVEL
const featureLevels[maxFeatureLevels] =
489 D3D_FEATURE_LEVEL_11_1,
490 D3D_FEATURE_LEVEL_11_0,
491 D3D_FEATURE_LEVEL_10_1,
492 D3D_FEATURE_LEVEL_10_0,
493 D3D_FEATURE_LEVEL_9_3,
494 D3D_FEATURE_LEVEL_9_2,
495 D3D_FEATURE_LEVEL_9_1
498 UINT numFeatureLevels = 0;
499 for (
UINT i = 0; i < maxFeatureLevels; ++i)
503 numFeatureLevels = i + 1;
507 if (numFeatureLevels == 0)
509 LogError(
"Unsupported minimum feature level.");
513 for (
UINT i = 0; i < numFeatureLevels; ++i)
516 mFlags, &featureLevels[i], 1, D3D11_SDK_VERSION,
521 if (i == 0 || i == 1)
525 else if (i == 2 || i == 3)
541 LogError(
"Failed to create device");
550 struct DXGIInterfaces
568 IDXGIAdapter* adapter;
569 IDXGIFactory1* factory;
573 HRESULT hr =
mDevice->QueryInterface(__uuidof(IDXGIDevice), reinterpret_cast<void**>(&dxgi.device));
576 hr = dxgi.device->GetAdapter(&dxgi.adapter);
579 hr = dxgi.adapter->GetParent(__uuidof(IDXGIFactory1), reinterpret_cast<void**>(&dxgi.factory));
582 DXGI_SWAP_CHAIN_DESC desc;
583 desc.BufferDesc.Width = xSize;
584 desc.BufferDesc.Height = ySize;
585 desc.BufferDesc.RefreshRate.Numerator = 0;
586 desc.BufferDesc.RefreshRate.Denominator = 1;
587 desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
588 desc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
589 desc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
590 desc.SampleDesc.Count = 1;
591 desc.SampleDesc.Quality = 0;
592 desc.BufferUsage = DXGI_USAGE_BACK_BUFFER | DXGI_USAGE_RENDER_TARGET_OUTPUT;
593 desc.BufferCount = 2;
594 desc.OutputWindow = handle;
595 desc.Windowed = TRUE;
596 desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
599 hr = dxgi.factory->CreateSwapChain(dxgi.device, &desc, &
mSwapChain);
602 #if defined(GTE_GRAPHICS_USE_NAMED_OBJECTS) 604 LogAssert(SUCCEEDED(hr),
"Failed to set private name, hr = " + std::to_string(hr));
629 colorBuffer =
nullptr;
631 depthStencilBuffer =
nullptr;
632 depthStencilView =
nullptr;
635 ID3D11Texture2D* colorBuffer;
636 ID3D11RenderTargetView* colorView;
637 ID3D11Texture2D* depthStencilBuffer;
638 ID3D11DepthStencilView* depthStencilView;
644 HRESULT hr =
mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), reinterpret_cast<void**>(&bb.colorBuffer));
647 #if defined(GTE_GRAPHICS_USE_NAMED_OBJECTS) 649 LogAssert(SUCCEEDED(hr),
"Failed to set private name, hr = " + std::to_string(hr));
652 hr =
mDevice->CreateRenderTargetView(bb.colorBuffer,
nullptr, &bb.colorView);
655 #if defined(GTE_GRAPHICS_USE_NAMED_OBJECTS) 657 LogAssert(SUCCEEDED(hr),
"Failed to set private name, hr = " + std::to_string(hr));
661 D3D11_TEXTURE2D_DESC desc;
666 desc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
667 desc.SampleDesc.Count = 1;
668 desc.SampleDesc.Quality = 0;
669 desc.Usage = D3D11_USAGE_DEFAULT;
670 desc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
674 hr =
mDevice->CreateTexture2D(&desc,
nullptr, &bb.depthStencilBuffer);
677 #if defined(GTE_GRAPHICS_USE_NAMED_OBJECTS) 678 hr =
SetPrivateName(bb.depthStencilBuffer,
"DX11Engine::mDepthStencilBuffer");
679 LogAssert(SUCCEEDED(hr),
"Failed to set private name, hr = " + std::to_string(hr));
682 hr =
mDevice->CreateDepthStencilView(bb.depthStencilBuffer,
nullptr,
683 &bb.depthStencilView);
686 #if defined(GTE_GRAPHICS_USE_NAMED_OBJECTS) 687 hr =
SetPrivateName(bb.depthStencilView,
"DX11Engine::mDepthStencilView");
688 LogAssert(SUCCEEDED(hr),
"Failed to set private name, hr = " + std::to_string(hr));
699 mViewport.Width =
static_cast<float>(xSize);
700 mViewport.Height =
static_cast<float>(ySize);
716 std::shared_ptr<HLSLProgramFactory> factory = std::make_shared<HLSLProgramFactory>();
717 mDefaultFont = std::make_shared<FontArialW400H18>(factory, 256);
741 bool successful =
true;
749 LogError(
"Swap chain not released.");
762 ID3D11RenderTargetView* rtView =
nullptr;
763 ID3D11DepthStencilView* dsView =
nullptr;
764 mImmediate->OMSetRenderTargets(1, &rtView, dsView);
788 mImmediate->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);
791 mImmediate->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINELIST);
794 mImmediate->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP);
797 mImmediate->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
800 mImmediate->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
803 mImmediate->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINELIST_ADJ);
806 mImmediate->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ);
809 mImmediate->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ);
812 mImmediate->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ);
815 LogError(
"Unknown primitive topology = " + std::to_string(type));
819 ID3D11Query* occlusionQuery =
nullptr;
820 uint64_t numPixelsDrawn = 0;
828 if (numActiveIndices > 0)
830 mImmediate->DrawIndexed(numActiveIndices, firstIndex, vertexOffset);
835 if (numActiveVertices > 0)
837 mImmediate->Draw(numActiveVertices, vertexOffset);
846 return numPixelsDrawn;
851 D3D11_QUERY_DESC desc;
852 desc.Query = D3D11_QUERY_OCCLUSION;
854 ID3D11Query* occlusionQuery =
nullptr;
855 HRESULT hr =
mDevice->CreateQuery(&desc, &occlusionQuery);
859 return occlusionQuery;
873 while (S_OK !=
mImmediate->GetData(occlusionQuery, &data, size, 0))
877 occlusionQuery->Release();
893 if (!effect->GetVertexShader())
895 LogError(
"Effect does not have a vertex shader.");
901 if (effect->GetGeometryShader())
907 if (!effect->GetPixelShader())
909 LogError(
"Effect does not have a pixel shader.");
915 Enable(effect->GetVertexShader().get(), dxVShader);
916 Enable(effect->GetPixelShader().get(), dxPShader);
919 Enable(effect->GetGeometryShader().get(), dxGShader);
930 Disable(effect->GetGeometryShader().get(), dxGShader);
932 Disable(effect->GetPixelShader().get(), dxPShader);
933 Disable(effect->GetVertexShader().get(), dxVShader);
963 for (
auto const& cb : shader->
GetData(index))
974 LogError(
"Failed to bind constant buffer.");
979 LogError(cb.name +
" is null constant buffer.");
987 for (
auto const& cb : shader->
GetData(index))
996 for (
auto const& tb : shader->
GetData(index))
1007 LogError(
"Failed to bind texture buffer.");
1012 LogError(tb.name +
" is null texture buffer.");
1020 for (
auto const& tb : shader->
GetData(index))
1029 for (
auto const& sb : shader->
GetData(index))
1036 if (sb.isGpuWritable)
1051 LogError(
"Failed to bind structured buffer.");
1056 LogError(sb.name +
" is null structured buffer.");
1064 for (
auto const& sb : shader->
GetData(index))
1066 if (sb.isGpuWritable)
1080 for (
auto const& rb : shader->
GetData(index))
1087 if (rb.isGpuWritable)
1098 LogError(
"Failed to bind byte-address buffer.");
1103 LogError(rb.name +
" is null byte-address buffer.");
1111 for (
auto const& rb : shader->
GetData(index))
1113 if (rb.isGpuWritable)
1127 for (
auto const& tx : shader->
GetData(index))
1134 if (tx.isGpuWritable)
1145 LogError(
"Failed to bind texture.");
1150 LogError(tx.name +
" is null texture.");
1158 for (
auto const& tx : shader->
GetData(index))
1160 if (tx.isGpuWritable)
1174 for (
auto const& ta : shader->
GetData(index))
1181 if (ta.isGpuWritable)
1192 LogError(
"Failed to bind texture array.");
1197 LogError(ta.name +
" is null texture array.");
1206 for (
auto const& ta : shader->
GetData(index))
1208 if (ta.isGpuWritable)
1222 for (
auto const& ss : shader->
GetData(index))
1233 LogError(
"Failed to bind sampler state.");
1238 LogError(ss.name +
" is null sampler state.");
1246 for (
auto const& ss : shader->
GetData(index))
1257 UINT numViewports = 1;
1259 LogAssert(1 == numViewports,
"Failed to get viewport.");
1270 UINT numViewports = 1;
1271 D3D11_VIEWPORT viewport;
1272 mImmediate->RSGetViewports(&numViewports, &viewport);
1273 LogAssert(1 == numViewports,
"Failed to get viewport.");
1275 x =
static_cast<unsigned int>(viewport.TopLeftX);
1276 y =
static_cast<unsigned int>(viewport.TopLeftY);
1277 w =
static_cast<unsigned int>(viewport.Width);
1278 h =
static_cast<unsigned int>(viewport.Height);
1283 UINT numViewports = 1;
1285 LogAssert(1 == numViewports,
"Failed to get viewport.");
1294 UINT numViewports = 1;
1295 D3D11_VIEWPORT viewport;
1296 mImmediate->RSGetViewports(&numViewports, &viewport);
1297 LogAssert(1 == numViewports,
"Failed to get viewport.");
1299 zmin = viewport.MinDepth;
1300 zmax = viewport.MaxDepth;
1309 DXGI_SWAP_CHAIN_DESC desc;
1311 HRESULT hr =
mSwapChain->ResizeBuffers(desc.BufferCount, w, h,
1312 DXGI_FORMAT_R8G8B8A8_UNORM, 0);
1322 w = desc.BufferDesc.Width;
1323 h = desc.BufferDesc.Height;
1324 hr =
mSwapChain->ResizeBuffers(desc.BufferCount, w, h,
1325 DXGI_FORMAT_R8G8B8A8_UNORM, 0);
1336 ID3D11RenderTargetView* rtViews[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT] = {
nullptr };
1337 ID3D11DepthStencilView* dsView =
nullptr;
1346 rtViews[i]->Release();
1353 ID3D11DepthStencilView* dsView =
nullptr;
1354 ID3D11RenderTargetView* rtView =
nullptr;
1355 mImmediate->OMGetRenderTargets(1, &rtView, &dsView);
1366 ID3D11DepthStencilView* dsView =
nullptr;
1367 ID3D11RenderTargetView* rtView =
nullptr;
1368 mImmediate->OMGetRenderTargets(1, &rtView, &dsView);
1372 mImmediate->ClearDepthStencilView(dsView, D3D11_CLEAR_STENCIL, 0.0
f,
1380 ID3D11RenderTargetView* rtViews[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT] = {
nullptr };
1381 ID3D11DepthStencilView* dsView =
nullptr;
1389 rtViews[i]->Release();
1395 D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL,
mClearDepth,
1421 LogError(
"Failed to bind blend state.");
1445 LogError(
"Failed to bind depth-stencil state.");
1469 LogError(
"Failed to bind rasterizer state.");
1497 if (target->WantAutogenerateRTMipmaps())
1499 unsigned int const numTargets = target->GetNumTargets();
1500 for (
unsigned int i = 0; i < numTargets; ++i)
1503 ID3D11ShaderResourceView* srView = dxTexture->
GetSRView();
1514 ID3D11Texture2D* dxTexture, ID3D11ShaderResourceView* dxSRView)
1516 if (!texture || !dxTexture || !dxSRView)
1518 LogError(
"Attempt to bind a null object.");
1523 std::shared_ptr<GEObject> geObject;
1524 if (!
mGOMap.Get(gtObject, geObject))
1526 geObject = std::make_shared<DX11Texture2>(texture.get(), dxTexture, dxSRView);
1527 LogAssert(geObject,
"Null object. Out of memory?");
1528 mGOMap.Insert(gtObject, geObject);
1529 #if defined(GTE_GRAPHICS_USE_NAMED_OBJECTS) 1530 geObject->SetName(texture->GetName());
1538 if (!buffer->GetData())
1540 LogWarning(
"Buffer does not have system memory, creating it.");
1541 buffer->CreateStorage();
1550 if (!texture->GetData())
1552 LogWarning(
"Texture does not have system memory, creating it.");
1553 texture->CreateStorage();
1562 if (!texture->GetData())
1564 LogWarning(
"Texture does not have system memory, creating it.");
1565 texture->CreateStorage();
1569 unsigned int sri = texture->GetIndex(0, level);
1575 if (!textureArray->GetData())
1577 LogWarning(
"Texture array does not have system memory, creating it.");
1578 textureArray->CreateStorage();
1582 Bind(textureArray));
1588 if (!textureArray->GetData())
1590 LogWarning(
"Texture array does not have system memory, creating it.");
1591 textureArray->CreateStorage();
1595 Bind(textureArray));
1596 unsigned int sri = textureArray->GetIndex(item, level);
1602 if (!buffer->GetData())
1604 LogWarning(
"Buffer does not have system memory, creating it.");
1605 buffer->CreateStorage();
1614 if (!texture->GetData())
1616 LogWarning(
"Texture does not have system memory, creating it.");
1617 texture->CreateStorage();
1626 if (!texture->GetData())
1628 LogWarning(
"Texture does not have system memory, creating it.");
1629 texture->CreateStorage();
1633 unsigned int sri = texture->GetIndex(0, level);
1639 if (!textureArray->GetData())
1641 LogWarning(
"Texture array does not have system memory, creating it.");
1642 textureArray->CreateStorage();
1646 Bind(textureArray));
1652 if (!textureArray->GetData())
1654 LogWarning(
"Texture array does not have system memory, creating it.");
1655 textureArray->CreateStorage();
1659 Bind(textureArray));
1660 unsigned int sri = textureArray->GetIndex(item, level);
1666 if (!buffer->GetData())
1668 LogWarning(
"Buffer does not have system memory, creating it.");
1669 buffer->CreateStorage();
1678 if (!texture->GetData())
1680 LogWarning(
"Texture does not have system memory, creating it.");
1681 texture->CreateStorage();
1690 if (!texture->GetData())
1692 LogWarning(
"Texture does not have system memory, creating it.");
1693 texture->CreateStorage();
1697 unsigned int sri = texture->GetIndex(0, level);
1703 if (!textureArray->GetData())
1705 LogWarning(
"Texture array does not have system memory, creating it.");
1706 textureArray->CreateStorage();
1710 Bind(textureArray));
1716 if (!textureArray->GetData())
1718 LogWarning(
"Texture array does not have system memory, creating it.");
1719 textureArray->CreateStorage();
1723 Bind(textureArray));
1724 unsigned int sri = textureArray->GetIndex(item, level);
1729 std::shared_ptr<Buffer>
const& buffer0,
1730 std::shared_ptr<Buffer>
const& buffer1)
1738 std::shared_ptr<TextureSingle>
const& texture0,
1739 std::shared_ptr<TextureSingle>
const& texture1)
1747 std::shared_ptr<TextureSingle>
const& texture0,
1748 std::shared_ptr<TextureSingle>
const& texture1,
1753 unsigned int sri = texture0->GetIndex(0, level);
1758 std::shared_ptr<TextureArray>
const& textureArray0,
1759 std::shared_ptr<TextureArray>
const& textureArray1)
1767 std::shared_ptr<TextureArray>
const& textureArray0,
1768 std::shared_ptr<TextureArray>
const& textureArray1,
1769 unsigned int item,
unsigned int level)
1773 unsigned int sri = textureArray0->GetIndex(item, level);
1804 unsigned int numXGroups,
unsigned int numYGroups,
unsigned int numZGroups)
1807 if (hlslProgram && numXGroups > 0 && numYGroups > 0 && numZGroups > 0)
1813 Enable(cshader.get(), dxCShader);
1814 mImmediate->Dispatch(numXGroups, numYGroups, numZGroups);
1815 Disable(cshader.get(), dxCShader);
1819 LogError(
"Invalid input parameter.");
1828 D3D11_QUERY_DESC desc;
1829 desc.Query = D3D11_QUERY_EVENT;
1853 std::shared_ptr<IndexBuffer>
const& ibuffer, std::shared_ptr<VisualEffect>
const& effect)
1855 uint64_t numPixelsDrawn = 0;
1864 if (vbuffer->StandardUsage())
1868 dxLayout = manager->
Bind(
mDevice, vbuffer.get(), effect->GetVertexShader().get());
1879 if (ibuffer->IsIndexed())
1885 numPixelsDrawn =
DrawPrimitive(vbuffer.get(), ibuffer.get());
1888 if (vbuffer->StandardUsage())
1902 return numPixelsDrawn;
DXGI_OUTPUT_DESC const & GetDescription() const
virtual void GetDepthRange(float &zmin, float &zmax) const override
virtual void DisableSampler(ID3D11DeviceContext *context, unsigned int bindPoint)=0
ID3D11UnorderedAccessView * GetUAView() const
virtual bool Resize(unsigned int w, unsigned int h) override
ThreadSafeMap< GraphicsObject const *, std::shared_ptr< GEObject > > mGOMap
void Unmap(std::shared_ptr< Resource > const &resource, unsigned int sri)
virtual void DisableSRView(ID3D11DeviceContext *context, unsigned int bindPoint)=0
std::shared_ptr< Font > mActiveFont
ID3D11SamplerState * GetDXSamplerState()
static int const shaderDataLookup
virtual void CopyGpuToGpu(ID3D11DeviceContext *context, ID3D11Resource *target) override
virtual void Flush() override
std::array< CreateGEObject, GT_NUM_TYPES > mCreateGEObject
static std::string defaultVersion
virtual bool CopyCpuToGpu(ID3D11DeviceContext *context) override
std::shared_ptr< RasterizerState > mActiveRasterizerState
ID3D11DepthStencilView * mDepthStencilView
DX11Engine(D3D_FEATURE_LEVEL minFeatureLevel=D3D_FEATURE_LEVEL_11_0)
std::shared_ptr< BlendState > mActiveBlendState
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
void DisableTextures(Shader const *shader, DX11Shader *dxShader)
virtual void SetBlendState(std::shared_ptr< BlendState > const &state) override
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
CreateGEDrawTarget mCreateGEDrawTarget
#define D3D11_RESOURCE_MISC_NONE
void DestroyDefaultObjects()
#define LogAssert(condition, message)
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
static int const shaderDataLookup
void DisableShaders(std::shared_ptr< VisualEffect > const &effect, DX11VertexShader *dxVShader, DX11GeometryShader *dxGShader, DX11PixelShader *dxPShader)
D3D11_MAPPED_SUBRESOURCE MapForWrite(std::shared_ptr< Resource > const &resource, unsigned int sri)
#define CHECK_HR_RETURN_NONE(msg)
unsigned int GetOffset() const
void DisableRBuffers(Shader const *shader, DX11Shader *dxShader)
void BeginTimer(DX11PerformanceCounter &counter)
virtual bool CopyGpuToCpu(ID3D11DeviceContext *context, unsigned int sri) override
ID3D11Query * BeginOcclusionQuery()
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
std::array< ID3D11RenderTargetView *, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT > mActiveRT
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
virtual bool BindProgram(std::shared_ptr< ComputeProgram > const &program) override
ID3D11Buffer * GetDXBuffer() const
HRESULT SetPrivateName(ID3D11DeviceChild *object, std::string const &name)
void EndTimer(DX11PerformanceCounter &counter)
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
void EnableTextures(Shader const *shader, DX11Shader *dxShader)
GEObject * Get(std::shared_ptr< GraphicsObject > const &object) const
GLbitfield GLuint program
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
D3D_FEATURE_LEVEL mFeatureLevel
D3D11_VIEWPORT mSaveViewport
std::unique_ptr< GEInputLayoutManager > mILMap
virtual void SetViewport(int x, int y, int w, int h) override
void EnableRBuffers(Shader const *shader, DX11Shader *dxShader)
ID3D11UnorderedAccessView * GetUAView() const
GLuint const GLchar * name
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
virtual void ClearBuffers() override
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
void EnableTextureArrays(Shader const *shader, DX11Shader *dxShader)
static int const shaderDataLookup
uint64_t EndOcclusionQuery(ID3D11Query *occlusionQuery)
void DisableTextureArrays(Shader const *shader, DX11Shader *dxShader)
ID3D11Texture2D * mDepthStencilBuffer
static int const shaderDataLookup
std::shared_ptr< GOListener > mGOListener
ULONG FinalRelease(T *&object)
bool EnableShaders(std::shared_ptr< VisualEffect > const &effect, DX11VertexShader *&dxVShader, DX11GeometryShader *&dxGShader, DX11PixelShader *&dxPShader)
GLubyte GLubyte GLubyte GLubyte w
virtual void EnableUAView(ID3D11DeviceContext *context, unsigned int bindPoint, ID3D11UnorderedAccessView *uaView, unsigned int initialCount)=0
void Initialize(IDXGIAdapter *adapter, D3D_DRIVER_TYPE driverType, HMODULE softwareModule, UINT flags, D3D_FEATURE_LEVEL minFeatureLevel)
virtual void SetDepthRange(float zmin, float zmax) override
uint32_t GetFirstIndex() const
virtual void DestroyDefaultGlobalState()
void Disable(Shader const *shader, DX11Shader *dxShader)
std::array< float, 4 > mClearColor
void CreateDefaultObjects()
void EnableSBuffers(Shader const *shader, DX11Shader *dxShader)
virtual void Execute(std::shared_ptr< ComputeProgram > const &program, unsigned int numXGroups, unsigned int numYGroups, unsigned int numZGroups) override
virtual bool CopyCpuToGpu(ID3D11DeviceContext *context, unsigned int sri) override
unsigned int mClearStencil
static int const shaderDataLookup
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
IDXGIOutput * GetOutput() const
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
void Enable(Shader const *shader, DX11Shader *dxShader)
virtual bool Update(std::shared_ptr< Buffer > const &buffer) override
virtual void GetViewport(int &x, int &y, int &w, int &h) const override
bool GetKeepInternalCount() const
bool CreateBestMatchingDevice()
D3D_DRIVER_TYPE mDriverType
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
void Unmap(ID3D11DeviceContext *context, unsigned int sri)
ID3D11ShaderResourceView * GetSRView() const
void CreateDefaultGlobalState()
virtual void CopyGpuToGpu(ID3D11DeviceContext *context, ID3D11Resource *target, unsigned int sri) override
void Enable(ID3D11DeviceContext *context)
virtual bool GetNumActiveElements(std::shared_ptr< StructuredBuffer > const &buffer) override
uint64_t DrawPrimitive(VertexBuffer const *vbuffer, IndexBuffer const *ibuffer)
#define LogError(message)
ID3D11ShaderResourceView * GetSRView() const
static std::shared_ptr< GEDrawTarget > Create(DrawTarget const *target, std::vector< GEObject * > &rtTextures, GEObject *dsTexture)
virtual void ClearColorBuffer() override
virtual bool Update(ID3D11DeviceContext *context, unsigned int sri) override
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
virtual void CopyGpuToGpu(std::shared_ptr< Buffer > const &buffer0, std::shared_ptr< Buffer > const &buffer1) override
static int const shaderDataLookup
ID3D11RenderTargetView * mColorView
static void UnsubscribeForDestruction(std::shared_ptr< ListenerForDestruction > const &listener)
ThreadSafeMap< DrawTarget const *, std::shared_ptr< GEDrawTarget > > mDTMap
typedef BOOL(WINAPI *PFNWGLSAVEBUFFERREGIONARBPROC)(HANDLE hRegion
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
std::shared_ptr< DepthStencilState > mActiveDepthStencilState
void EnableSamplers(Shader const *shader, DX11Shader *dxShader)
void Enable(ID3D11DeviceContext *context)
#define LogWarning(message)
IDXGISwapChain * mSwapChain
IPType GetPrimitiveType() const
void DisableCBuffers(Shader const *shader, DX11Shader *dxShader)
bool GetNumActiveElements(ID3D11DeviceContext *context)
void Disable(ID3D11DeviceContext *context)
virtual void WaitForFinish() override
virtual bool CopyCpuToGpu(std::shared_ptr< Buffer > const &buffer) override
unsigned int GetNumActiveElements() const
bool IsFullscreen(DXGIOutput const &output) const
std::shared_ptr< Font > mDefaultFont
ID3D11DeviceContext * mImmediate
GEObject * Bind(std::shared_ptr< GraphicsObject > const &object)
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
std::map< std::wstring, bool > mFullscreenState
GLfloat GLfloat GLfloat GLfloat h
virtual void Enable(ID3D11DeviceContext *context)=0
ULONG SafeRelease(T *&object)
void DisableTBuffers(Shader const *shader, DX11Shader *dxShader)
#define D3D11_CPU_ACCESS_NONE
virtual void EnableSampler(ID3D11DeviceContext *context, unsigned int bindPoint, ID3D11SamplerState *state)=0
void Enable(ID3D11DeviceContext *context)
ID3D11Resource * GetDXResource() const
void Disable(ID3D11DeviceContext *context)
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
void EnableTBuffers(Shader const *shader, DX11Shader *dxShader)
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
void Disable(ID3D11DeviceContext *context)
ID3D11ShaderResourceView * GetSRView() const
virtual bool Update(ID3D11DeviceContext *context) override
void Enable(ID3D11DeviceContext *context)
DX11Texture2 * BindTexture(std::shared_ptr< Texture2 > const &texture, ID3D11Texture2D *dxTexture, ID3D11ShaderResourceView *dxSRView)
#define D3D11_QUERY_MISC_NONE
ID3D11DepthStencilView * mSaveDS
ID3D11DepthStencilView * mActiveDS
virtual void ClearDepthBuffer() override
ID3D11Texture2D * mColorBuffer
virtual bool CopyGpuToCpu(std::shared_ptr< Buffer > const &buffer) override
bool CreateBackBuffer(UINT xSize, UINT ySize)
virtual void DisableUAView(ID3D11DeviceContext *context, unsigned int bindPoint)=0
unsigned int mNumActiveRTs
DX11GraphicsObject * Share(std::shared_ptr< Texture2 > const &texture, DX11Engine *engine)
virtual void DisplayColorBuffer(unsigned int syncInterval) override
virtual void EnableCBuffer(ID3D11DeviceContext *context, unsigned int bindPoint, ID3D11Buffer *buffer)=0
ID3D11UnorderedAccessView * GetUAView() const
void DisableSBuffers(Shader const *shader, DX11Shader *dxShader)
virtual void ClearStencilBuffer() override
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
ID3D11ShaderResourceView * GetSRView() const
void DisableSamplers(Shader const *shader, DX11Shader *dxShader)
void Enable(ID3D11DeviceContext *context)
typedef UINT(WINAPI *PFNWGLGETGPUIDSAMDPROC)(UINT maxCount
#define CHECK_HR_RETURN(msg, value)
void EnableCBuffers(Shader const *shader, DX11Shader *dxShader)
std::array< ID3D11RenderTargetView *, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT > mSaveRT
virtual void DisableCBuffer(ID3D11DeviceContext *context, unsigned int bindPoint)=0
static int const shaderDataLookup
D3D11_MAPPED_SUBRESOURCE MapForWrite(ID3D11DeviceContext *context, unsigned int sri)
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
virtual void SetDepthStencilState(std::shared_ptr< DepthStencilState > const &state) override
void Enable(ID3D11DeviceContext *context)
static void UnsubscribeForDestruction(std::shared_ptr< ListenerForDestruction > const &listener)
virtual bool CopyGpuToCpu(ID3D11DeviceContext *context) override
bool mAllowOcclusionQuery
virtual void Disable(ID3D11DeviceContext *context)=0
virtual void SetRasterizerState(std::shared_ptr< RasterizerState > const &state) override
bool mWarnOnNonemptyBridges
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
virtual void EnableSRView(ID3D11DeviceContext *context, unsigned int bindPoint, ID3D11ShaderResourceView *srView)=0
std::shared_ptr< DTListener > mDTListener
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
bool SetFullscreen(DXGIOutput const &output, bool fullscreen)
GLint GLint GLsizei GLint GLenum GLenum type
bool CreateSwapChain(HWND handle, UINT xSize, UINT ySize)
D3D_FEATURE_LEVEL mMinFeatureLevel
static std::shared_ptr< GEObject > Create(void *device, GraphicsObject const *object)
uint32_t GetNumActiveIndices() const
std::vector< Data > const & GetData(int lookup) const
std::shared_ptr< ComputeShader > const & GetCShader() const