diff options
| author | Miles Macklin <[email protected]> | 2017-06-09 13:41:15 +1200 |
|---|---|---|
| committer | Miles Macklin <[email protected]> | 2017-06-09 13:41:15 +1200 |
| commit | 688b5f42e9bfe498d7af7075d4d8f4429867f3a3 (patch) | |
| tree | 7e0d0e7c95298f0418723abd92f61ac6e16b055e /demo/d3d11/imguiGraphD3D11.cpp | |
| parent | Update README.md (diff) | |
| download | flex-688b5f42e9bfe498d7af7075d4d8f4429867f3a3.tar.xz flex-688b5f42e9bfe498d7af7075d4d8f4429867f3a3.zip | |
1.2.0.beta.11.2.0.beta.1
Diffstat (limited to 'demo/d3d11/imguiGraphD3D11.cpp')
| -rw-r--r-- | demo/d3d11/imguiGraphD3D11.cpp | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/demo/d3d11/imguiGraphD3D11.cpp b/demo/d3d11/imguiGraphD3D11.cpp index 89c8c91..2df555d 100644 --- a/demo/d3d11/imguiGraphD3D11.cpp +++ b/demo/d3d11/imguiGraphD3D11.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. * * NVIDIA CORPORATION and its licensors retain all intellectual property * and proprietary rights in and to this software, related documentation @@ -13,8 +13,8 @@ //direct3d headers #include <d3d11.h> -#include "shaders/imguiVS.hlsl.h" -#include "shaders/imguiPS.hlsl.h" +#include "../d3d/shaders/imguiVS.hlsl.h" +#include "../d3d/shaders/imguiPS.hlsl.h" namespace { @@ -77,7 +77,7 @@ namespace }; } -void imguiGraphContextDestroy() +void imguiGraphContextDestroyD3D11() { COMRelease(m_rasterizerState); COMRelease(m_samplerState); @@ -89,8 +89,10 @@ void imguiGraphContextDestroy() COMRelease(m_vertexBuffer); } -void imguiGraphContextInit(const ImguiGraphDesc* desc) +void imguiGraphContextInitD3D11(const ImguiGraphDesc* descIn) { + const auto desc = cast_to_imguiGraphDescD3D11(descIn); + m_device = desc->device; m_deviceContext = desc->deviceContext; m_winW = desc->winW; @@ -202,15 +204,17 @@ void imguiGraphContextInit(const ImguiGraphDesc* desc) } } -void imguiGraphContextUpdate(const ImguiGraphDesc* desc) +void imguiGraphContextUpdateD3D11(const ImguiGraphDesc* descIn) { + const auto desc = cast_to_imguiGraphDescD3D11(descIn); + m_device = desc->device; m_deviceContext = desc->deviceContext; m_winW = desc->winW; m_winH = desc->winH; } -void imguiGraphRecordBegin() +void imguiGraphRecordBeginD3D11() { Params params = { 2.f / float(m_winW), 0.f, 0.f, -1.f, @@ -319,7 +323,7 @@ static void imguiGraphFlush() } } -void imguiGraphRecordEnd() +void imguiGraphRecordEndD3D11() { ID3D11DeviceContext* context = m_deviceContext; @@ -341,7 +345,7 @@ void imguiGraphRecordEnd() context->RSSetState(nullptr); } -void imguiGraphEnableScissor(int x, int y, int width, int height) +void imguiGraphEnableScissorD3D11(int x, int y, int width, int height) { // mark end of last region m_stateScissor.stopIdx = m_stateVertIdx; @@ -356,7 +360,7 @@ void imguiGraphEnableScissor(int x, int y, int width, int height) m_stateScissor.height = height; } -void imguiGraphDisableScissor() +void imguiGraphDisableScissorD3D11() { if (m_stateVertIdx == 0) return; @@ -373,13 +377,13 @@ void imguiGraphDisableScissor() m_stateScissor.height = m_winH; } -void imguiGraphVertex2f(float x, float y) +void imguiGraphVertex2fD3D11(float x, float y) { float v[2] = { x,y }; - imguiGraphVertex2fv(v); + imguiGraphVertex2fvD3D11(v); } -void imguiGraphVertex2fv(const float* v) +void imguiGraphVertex2fvD3D11(const float* v) { // update state m_stateVert.x = v[0]; @@ -394,13 +398,13 @@ void imguiGraphVertex2fv(const float* v) } } -void imguiGraphTexCoord2f(float u, float v) +void imguiGraphTexCoord2fD3D11(float u, float v) { m_stateVert.u = u; m_stateVert.v = v; } -void imguiGraphColor4ub(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) +void imguiGraphColor4ubD3D11(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) { m_stateVert.rgba[0] = red; m_stateVert.rgba[1] = green; @@ -408,7 +412,7 @@ void imguiGraphColor4ub(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) m_stateVert.rgba[3] = alpha; } -void imguiGraphColor4ubv(const uint8_t* v) +void imguiGraphColor4ubvD3D11(const uint8_t* v) { m_stateVert.rgba[0] = v[0]; m_stateVert.rgba[1] = v[1]; @@ -416,18 +420,18 @@ void imguiGraphColor4ubv(const uint8_t* v) m_stateVert.rgba[3] = v[3]; } -void imguiGraphFontTextureEnable() +void imguiGraphFontTextureEnableD3D11() { } -void imguiGraphFontTextureDisable() +void imguiGraphFontTextureDisableD3D11() { m_stateVert.u = -1.f; m_stateVert.v = -1.f; } -void imguiGraphFontTextureInit(unsigned char* data) +void imguiGraphFontTextureInitD3D11(unsigned char* data) { ID3D11DeviceContext* context = m_deviceContext; @@ -466,7 +470,7 @@ void imguiGraphFontTextureInit(unsigned char* data) } -void imguiGraphFontTextureRelease() +void imguiGraphFontTextureReleaseD3D11() { COMRelease(m_texture); COMRelease(m_textureSRV); |