From 6ef4054f8a8aea4ec61481057fa7e16aaecde6d7 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 10 Mar 2021 10:58:15 -0800 Subject: Swapchain resize and rename to `IDevice` (#1741) * Swapchain resize * Fix. --- tools/gfx/render-graphics-common.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'tools/gfx/render-graphics-common.cpp') 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(renderer)) {} @@ -712,18 +712,18 @@ class GraphicsCommonShaderObject : public ShaderObjectBase { public: static Result create( - IRenderer* renderer, + IDevice* device, GraphicsCommonShaderObjectLayout* layout, GraphicsCommonShaderObject** outShaderObject) { auto object = ComPtr(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 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 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(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 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 entryPoint; SLANG_RETURN_ON_FAIL( - EntryPointVars::create(renderer, entryPointInfo.layout, entryPoint.writeRef())); + EntryPointVars::create(device, entryPointInfo.layout, entryPoint.writeRef())); m_entryPoints.add(entryPoint); } -- cgit v1.2.3