diff options
| author | Yong He <yonghe@outlook.com> | 2021-10-18 12:19:45 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-18 12:19:45 -0700 |
| commit | 2f44d9e01234911dd563f0456b9d861fd8db286d (patch) | |
| tree | e2727f31654ebc93bae6a1de4b25586be6fb9d10 /tools/gfx/renderer-shared.cpp | |
| parent | 87e7c49fbfccd54be0d1cee61fba8f309b1f792e (diff) | |
GFX: implement mutable shader objects. (#1963)
* GFX: implement mutable shader objects.
* Revert unnecessary changes
* Revert more changes.
* Fix clang errors.
* Fix clang/gcc errors.
* Fix clang errors.
* Remove CPU test.
* Fix after merge.
* Fix after merge.
* Remove gl test
* Code review fixes.
* Fixing all vk validation errors.
* Flush test output more often.
* Fix a crash in `specializeDynamicAssociatedTypeLookup`.
* temporarily disable std-lib-serialize test to see what happens
* Fix crashes.
* Make sure cpu gfx unit tests are properly disabled on TeamCity.
* Disable cpu test.
* Fix.
* Fix cuda.
* Disable nv-ray-tracing-motion-blur
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tools/gfx/renderer-shared.cpp')
| -rw-r--r-- | tools/gfx/renderer-shared.cpp | 45 |
1 files changed, 35 insertions, 10 deletions
diff --git a/tools/gfx/renderer-shared.cpp b/tools/gfx/renderer-shared.cpp index c5a0c826d..791cb1859 100644 --- a/tools/gfx/renderer-shared.cpp +++ b/tools/gfx/renderer-shared.cpp @@ -1,4 +1,5 @@ #include "renderer-shared.h" +#include "mutable-shader-object.h" #include "core/slang-io.h" #include "core/slang-token-reader.h" @@ -128,22 +129,22 @@ IResourceView* ResourceViewBase::getInterface(const Guid& guid) return nullptr; } -IAccelerationStructure* AccelerationStructureBase::getInterface(const Slang::Guid& guid) +ISamplerState* SamplerStateBase::getInterface(const Slang::Guid& guid) { - if (guid == GfxGUID::IID_ISlangUnknown || guid == GfxGUID::IID_IResourceView || - guid == GfxGUID::IID_IAccelerationStructure) - return static_cast<IAccelerationStructure*>(this); + if (guid == GfxGUID::IID_ISlangUnknown || guid == GfxGUID::IID_ISamplerState) + return static_cast<ISamplerState*>(this); return nullptr; } -IShaderObject* ShaderObjectBase::getInterface(const Guid& guid) +IAccelerationStructure* AccelerationStructureBase::getInterface(const Slang::Guid& guid) { - if (guid == GfxGUID::IID_ISlangUnknown || guid == GfxGUID::IID_IShaderObject) - return static_cast<IShaderObject*>(this); + if (guid == GfxGUID::IID_ISlangUnknown || guid == GfxGUID::IID_IResourceView || + guid == GfxGUID::IID_IAccelerationStructure) + return static_cast<IAccelerationStructure*>(this); return nullptr; } -bool ShaderObjectBase::_doesValueFitInExistentialPayload( +bool _doesValueFitInExistentialPayload( slang::TypeLayoutReflection* concreteTypeLayout, slang::TypeLayoutReflection* existentialTypeLayout) { @@ -223,6 +224,20 @@ IFramebufferLayout* FramebufferLayoutBase::getInterface(const Guid& guid) return nullptr; } +IFramebuffer* FramebufferBase::getInterface(const Guid& guid) +{ + if (guid == GfxGUID::IID_ISlangUnknown || guid == GfxGUID::IID_IFramebuffer) + return static_cast<IFramebuffer*>(this); + return nullptr; +} + +IQueryPool* QueryPoolBase::getInterface(const Guid& guid) +{ + if (guid == GfxGUID::IID_ISlangUnknown || guid == GfxGUID::IID_IQueryPool) + return static_cast<IQueryPool*>(this); + return nullptr; +} + IPipelineState* gfx::PipelineStateBase::getInterface(const Guid& guid) { if (guid == GfxGUID::IID_ISlangUnknown || guid == GfxGUID::IID_IPipelineState) @@ -298,10 +313,20 @@ SLANG_NO_THROW Result SLANG_MCALL RendererBase::createShaderObject( IShaderObject** outObject) { RefPtr<ShaderObjectLayoutBase> shaderObjectLayout; - SLANG_RETURN_FALSE_ON_FAIL(getShaderObjectLayout(type, container, shaderObjectLayout.writeRef())); + SLANG_RETURN_ON_FAIL(getShaderObjectLayout(type, container, shaderObjectLayout.writeRef())); return createShaderObject(shaderObjectLayout, outObject); } +SLANG_NO_THROW Result SLANG_MCALL RendererBase::createMutableShaderObject( + slang::TypeReflection* type, + ShaderObjectContainerType containerType, + IShaderObject** outObject) +{ + RefPtr<ShaderObjectLayoutBase> shaderObjectLayout; + SLANG_RETURN_ON_FAIL(getShaderObjectLayout(type, containerType, shaderObjectLayout.writeRef())); + return createMutableShaderObject(shaderObjectLayout, outObject); +} + Result RendererBase::getAccelerationStructurePrebuildInfo( const IAccelerationStructure::BuildInputs& buildInputs, IAccelerationStructure::PrebuildInfo* outPrebuildInfo) @@ -452,7 +477,7 @@ Result ShaderObjectBase::_getSpecializedShaderObjectType(ExtendedShaderObjectTyp else { shaderObjectType.slangType = getRenderer()->slangContext.session->specializeType( - getElementTypeLayout()->getType(), + _getElementTypeLayout()->getType(), specializationArgs.components.getArrayView().getBuffer(), specializationArgs.getCount()); shaderObjectType.componentID = getRenderer()->shaderCache.getComponentId(shaderObjectType.slangType); } |
