diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2018-03-21 14:28:43 -0400 |
|---|---|---|
| committer | Tim Foley <tfoleyNV@users.noreply.github.com> | 2018-03-21 11:28:43 -0700 |
| commit | d421988f91d0d6fda78b9aea4cba763f9c662ffe (patch) | |
| tree | 4207ebec4a744f67df540388133033753cffa359 /tools/render-test/render.h | |
| parent | 98b8e0c809ceab84cee25389e54f3f37d220d95e (diff) | |
First pass impls on ComPtr and reorganise Renderer (#450)
* Fixed some small typos in api-users-guide.md
* Fix some small typos in slang-test/main.cpp, render-test/render-d3d11.cpp
* Remove exit() calls from test code. Added Slang::Result, which works in the same way as COM HRESULT.
* FIx bug introduced when moving to Slang::Result - handling E_INVALIDARG on Dx11.
* Fix the testing of feature levels on Dx11 renderer.
* First attempt at README.md for slang-test.
* Tidied up the slang-test README.md file.
* Fix some small typos in tools/slang-test/main.cpp
* Fix spaces -> tabs problems.
Fix some small types.
* Refactor Renderer implementations such that:
* Class definition does not contain long implementation/s
* Removed unused globals
* Ordered implementation after class definition
* Made renderer specific classes child classes, and use Impl postfix to differentiate
* Converted tabs into spaces
* First pass at Slang::ComPtr. Added slang-defines.h which sets up some fairly commonly used defines such as SLANG_FORCE_INLINE, compiler detection, os detection, and some other cross platform features.
Diffstat (limited to 'tools/render-test/render.h')
| -rw-r--r-- | tools/render-test/render.h | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/tools/render-test/render.h b/tools/render-test/render.h index 902067d62..bc63caa77 100644 --- a/tools/render-test/render.h +++ b/tools/render-test/render.h @@ -9,10 +9,12 @@ namespace renderer_test { -typedef struct Buffer Buffer; -typedef struct InputLayout InputLayout; -typedef struct ShaderProgram ShaderProgram; -typedef struct BindingState BindingState; +// Declare opaque type +struct Buffer; +struct InputLayout; +struct ShaderProgram; +struct BindingState; + struct ShaderCompileRequest { struct SourceInfo @@ -39,7 +41,7 @@ struct ShaderCompileRequest SourceInfo source; EntryPoint vertexShader; EntryPoint fragmentShader; - EntryPoint computeShader; + EntryPoint computeShader; Slang::List<Slang::String> entryPointTypeArguments; }; @@ -79,8 +81,8 @@ struct InputElementDesc enum class MapFlavor { - HostRead, - HostWrite, + HostRead, + HostWrite, WriteDiscard, }; @@ -115,20 +117,28 @@ public: virtual void setBindingState(BindingState * state) = 0; virtual void setVertexBuffers(UInt startSlot, UInt slotCount, Buffer* const* buffers, UInt const* strides, UInt const* offsets) = 0; - inline void setVertexBuffer(UInt slot, Buffer* buffer, UInt stride, UInt offset = 0) - { - setVertexBuffers(slot, 1, &buffer, &stride, &offset); - } + inline void setVertexBuffer(UInt slot, Buffer* buffer, UInt stride, UInt offset = 0); virtual void setShaderProgram(ShaderProgram* program) = 0; virtual void setConstantBuffers(UInt startSlot, UInt slotCount, Buffer* const* buffers, UInt const* offsets) = 0; - inline void setConstantBuffer(UInt slot, Buffer* buffer, UInt offset = 0) - { - setConstantBuffers(slot, 1, &buffer, &offset); - } + inline void setConstantBuffer(UInt slot, Buffer* buffer, UInt offset = 0); + virtual void draw(UInt vertexCount, UInt startVertex = 0) = 0; - virtual void dispatchCompute(int x, int y, int z) = 0; + virtual void dispatchCompute(int x, int y, int z) = 0; }; + +// ---------------------------------------------------------------------------------------- +inline void Renderer::setVertexBuffer(UInt slot, Buffer* buffer, UInt stride, UInt offset) +{ + setVertexBuffers(slot, 1, &buffer, &stride, &offset); +} +// ---------------------------------------------------------------------------------------- +inline void Renderer::setConstantBuffer(UInt slot, Buffer* buffer, UInt offset) +{ + setConstantBuffers(slot, 1, &buffer, &offset); +} + + } // renderer_test |
