diff options
| author | Yong He <yonghe@outlook.com> | 2021-03-10 10:58:15 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-10 10:58:15 -0800 |
| commit | 6ef4054f8a8aea4ec61481057fa7e16aaecde6d7 (patch) | |
| tree | 66edcae112faff7276c2595865463698bde277fd /tools/gfx/render-graphics-common.cpp | |
| parent | 2765861cdc104e6104a31cf9e20800b8d1dfae26 (diff) | |
Swapchain resize and rename to `IDevice` (#1741)
* Swapchain resize
* Fix.
Diffstat (limited to 'tools/gfx/render-graphics-common.cpp')
| -rw-r--r-- | tools/gfx/render-graphics-common.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/tools/gfx/render-graphics-common.cpp b/tools/gfx/render-graphics-common.cpp index 2e460982e..10713e92b 100644 --- a/tools/gfx/render-graphics-common.cpp +++ b/tools/gfx/render-graphics-common.cpp @@ -414,7 +414,7 @@ public: struct Builder : Super::Builder { - Builder(IRenderer* renderer) + Builder(IDevice* renderer) : Super::Builder(static_cast<RendererBase*>(renderer)) {} @@ -712,18 +712,18 @@ class GraphicsCommonShaderObject : public ShaderObjectBase { public: static Result create( - IRenderer* renderer, + IDevice* device, GraphicsCommonShaderObjectLayout* layout, GraphicsCommonShaderObject** outShaderObject) { auto object = ComPtr<GraphicsCommonShaderObject>(new GraphicsCommonShaderObject()); - SLANG_RETURN_ON_FAIL(object->init(renderer, layout)); + SLANG_RETURN_ON_FAIL(object->init(device, layout)); *outShaderObject = object.detach(); return SLANG_OK; } - RendererBase* getRenderer() { return m_layout->getRenderer(); } + RendererBase* getDevice() { return m_layout->getDevice(); } SLANG_NO_THROW UInt SLANG_MCALL getEntryPointCount() SLANG_OVERRIDE { return 0; } @@ -1011,7 +1011,7 @@ public: protected: friend class ProgramVars; - Result init(IRenderer* renderer, GraphicsCommonShaderObjectLayout* layout) + Result init(IDevice* device, GraphicsCommonShaderObjectLayout* layout) { m_layout = layout; @@ -1075,7 +1075,7 @@ protected: { RefPtr<GraphicsCommonShaderObject> subObject; SLANG_RETURN_ON_FAIL( - GraphicsCommonShaderObject::create(renderer, subObjectLayout, subObject.writeRef())); + GraphicsCommonShaderObject::create(device, subObjectLayout, subObject.writeRef())); m_objects[bindingRangeInfo.baseIndex + i] = subObject; } } @@ -1251,11 +1251,11 @@ protected: // Once we have computed how large the buffer should be, we can allocate // it using the existing public `IRenderer` API. // - IRenderer* renderer = getRenderer(); + IDevice* device = getRenderer(); IBufferResource::Desc bufferDesc; bufferDesc.init(specializedOrdinaryDataSize); bufferDesc.cpuAccessFlags |= IResource::AccessFlag::Write; - SLANG_RETURN_ON_FAIL(renderer->createBufferResource( + SLANG_RETURN_ON_FAIL(device->createBufferResource( IResource::Usage::ConstantBuffer, bufferDesc, nullptr, m_ordinaryDataBuffer.writeRef())); // Once the buffer is allocated, we can use `_writeOrdinaryData` to fill it in. @@ -1517,10 +1517,10 @@ class EntryPointVars : public GraphicsCommonShaderObject public: static Result - create(IRenderer* renderer, EntryPointLayout* layout, EntryPointVars** outShaderObject) + create(IDevice* device, EntryPointLayout* layout, EntryPointVars** outShaderObject) { RefPtr<EntryPointVars> object = new EntryPointVars(); - SLANG_RETURN_ON_FAIL(object->init(renderer, layout)); + SLANG_RETURN_ON_FAIL(object->init(device, layout)); *outShaderObject = object.detach(); return SLANG_OK; @@ -1529,9 +1529,9 @@ public: EntryPointLayout* getLayout() { return static_cast<EntryPointLayout*>(m_layout.Ptr()); } protected: - Result init(IRenderer* renderer, EntryPointLayout* layout) + Result init(IDevice* device, EntryPointLayout* layout) { - SLANG_RETURN_ON_FAIL(Super::init(renderer, layout)); + SLANG_RETURN_ON_FAIL(Super::init(device, layout)); return SLANG_OK; } }; @@ -1541,10 +1541,10 @@ class ProgramVars : public GraphicsCommonShaderObject typedef GraphicsCommonShaderObject Super; public: - static Result create(IRenderer* renderer, GraphicsCommonProgramLayout* layout, ProgramVars** outShaderObject) + static Result create(IDevice* device, GraphicsCommonProgramLayout* layout, ProgramVars** outShaderObject) { RefPtr<ProgramVars> object = new ProgramVars(); - SLANG_RETURN_ON_FAIL(object->init(renderer, layout)); + SLANG_RETURN_ON_FAIL(object->init(device, layout)); *outShaderObject = object.detach(); return SLANG_OK; @@ -1616,15 +1616,15 @@ protected: return SLANG_OK; } - Result init(IRenderer* renderer, GraphicsCommonProgramLayout* layout) + Result init(IDevice* device, GraphicsCommonProgramLayout* layout) { - SLANG_RETURN_ON_FAIL(Super::init(renderer, layout)); + SLANG_RETURN_ON_FAIL(Super::init(device, layout)); for (auto entryPointInfo : layout->getEntryPoints()) { RefPtr<EntryPointVars> entryPoint; SLANG_RETURN_ON_FAIL( - EntryPointVars::create(renderer, entryPointInfo.layout, entryPoint.writeRef())); + EntryPointVars::create(device, entryPointInfo.layout, entryPoint.writeRef())); m_entryPoints.add(entryPoint); } |
