summaryrefslogtreecommitdiff
path: root/tools/gfx/render-graphics-common.h
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2021-02-17 18:42:23 -0800
committerGitHub <noreply@github.com>2021-02-17 18:42:23 -0800
commitb1e376fa1e7dd0ff59991bdf1d3d859d3b63a74a (patch)
tree94245294fd9e569ed5a231afff44bd5e06203078 /tools/gfx/render-graphics-common.h
parentbdb0c0bb4c22b7956e1d8062c5bdde1caab44255 (diff)
Streamline shader object creation (#1717)
This change kind of rolls together two different simplifications: 1. The `createShaderObject()` shouldn't really need to take an `IShaderObjectLayout` because it could just take the `slang::TypeLayoutReflection` instead and create the shader-object layout behind the scenes. 2. For that matter, it needn't take a `slang::TypeLayoutReflection` either, becaues it could just take a `slang::TypeReflection` and query the layout of that type behind the scenes. The combination of these two changes means: * `IShaderObjectLayout` is gone from the public API, as is `createShaderObjectLayout()` * `createShaderObject()` directly takes a `slang::TypeReflection` and allocates a shader object of that type The result is simpler and more streamlined application code. Note that under the hood the implementation still has shader-object layouts, using the `ShaderObjectLayoutBase` class. A few locations had to change to use `RefPtr`s instead of `ComPtr`s now that the class is no longer a public COM-lite API type. The hope is that this change makes it easier to allocate/cache layouts for things like specialized types "under the hood," as is needed to implement parameter setting for static specialization.
Diffstat (limited to 'tools/gfx/render-graphics-common.h')
-rw-r--r--tools/gfx/render-graphics-common.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/gfx/render-graphics-common.h b/tools/gfx/render-graphics-common.h
index 59dfb888a..e41fc6ee1 100644
--- a/tools/gfx/render-graphics-common.h
+++ b/tools/gfx/render-graphics-common.h
@@ -20,10 +20,12 @@ private:
class GraphicsAPIRenderer : public RendererBase
{
public:
- virtual SLANG_NO_THROW Result SLANG_MCALL createShaderObjectLayout(
- slang::TypeLayoutReflection* typeLayout, IShaderObjectLayout** outLayout) SLANG_OVERRIDE;
- virtual SLANG_NO_THROW Result SLANG_MCALL
- createShaderObject(IShaderObjectLayout* layout, IShaderObject** outObject) SLANG_OVERRIDE;
+ virtual Result createShaderObjectLayout(
+ slang::TypeLayoutReflection* typeLayout,
+ ShaderObjectLayoutBase** outLayout) SLANG_OVERRIDE;
+ virtual Result createShaderObject(
+ ShaderObjectLayoutBase* layout,
+ IShaderObject** outObject) SLANG_OVERRIDE;
virtual SLANG_NO_THROW Result SLANG_MCALL createRootShaderObject(
IShaderProgram* program,
IShaderObject** outObject) SLANG_OVERRIDE;