diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2019-03-05 05:59:51 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2019-03-05 05:59:51 +0000 |
| commit | eff4c4323a9ab2cfe168d01bcfd919e574547cb6 (patch) | |
| tree | b9bdd1f001faabd990a2c63667f0bc9d56727b7f /unityplugin/GhostCubePlugin/PluginSource | |
| parent | Fixed asteroids demo to comply with the updated API (diff) | |
| download | DiligentEngine-eff4c4323a9ab2cfe168d01bcfd919e574547cb6.tar.gz DiligentEngine-eff4c4323a9ab2cfe168d01bcfd919e574547cb6.zip | |
Fixed Unity plugin to comply with the new API
Diffstat (limited to 'unityplugin/GhostCubePlugin/PluginSource')
| -rw-r--r-- | unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.cpp | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.cpp b/unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.cpp index 859951d..d13c5fb 100644 --- a/unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.cpp +++ b/unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.cpp @@ -60,30 +60,28 @@ SamplePlugin::SamplePlugin(Diligent::IRenderDevice *pDevice, bool UseReverseZ, T PSODesc.GraphicsPipeline.BlendDesc.RenderTargets[0].SrcBlendAlpha = BLEND_FACTOR_ZERO; PSODesc.GraphicsPipeline.BlendDesc.RenderTargets[0].DestBlendAlpha = BLEND_FACTOR_ONE; - ShaderCreationAttribs CreationAttribs; - CreationAttribs.SourceLanguage = SHADER_SOURCE_LANGUAGE_HLSL; - CreationAttribs.Desc.DefaultVariableType = SHADER_VARIABLE_TYPE_STATIC; - CreationAttribs.UseCombinedTextureSamplers = true; + ShaderCreateInfo ShaderCI; + ShaderCI.SourceLanguage = SHADER_SOURCE_LANGUAGE_HLSL; + ShaderCI.UseCombinedTextureSamplers = true; CreateUniformBuffer(pDevice, sizeof(float4x4), "SamplePlugin: VS constants CB", &m_VSConstants); RefCntAutoPtr<IShader> pVS; { - CreationAttribs.Desc.ShaderType = SHADER_TYPE_VERTEX; - CreationAttribs.EntryPoint = "main"; - CreationAttribs.Desc.Name = "Sample cube VS"; - CreationAttribs.Source = VSSource; - pDevice->CreateShader(CreationAttribs, &pVS); - pVS->GetShaderVariable("Constants")->Set(m_VSConstants); + ShaderCI.Desc.ShaderType = SHADER_TYPE_VERTEX; + ShaderCI.EntryPoint = "main"; + ShaderCI.Desc.Name = "Sample cube VS"; + ShaderCI.Source = VSSource; + pDevice->CreateShader(ShaderCI, &pVS); } RefCntAutoPtr<IShader> pPS; { - CreationAttribs.Desc.ShaderType = SHADER_TYPE_PIXEL; - CreationAttribs.EntryPoint = "main"; - CreationAttribs.Desc.Name = "Sample cube PS"; - CreationAttribs.Source = PSSource; - pDevice->CreateShader(CreationAttribs, &pPS); + ShaderCI.Desc.ShaderType = SHADER_TYPE_PIXEL; + ShaderCI.EntryPoint = "main"; + ShaderCI.Desc.Name = "Sample cube PS"; + ShaderCI.Source = PSSource; + pDevice->CreateShader(ShaderCI, &pPS); } LayoutElement LayoutElems[] = @@ -92,12 +90,15 @@ SamplePlugin::SamplePlugin(Diligent::IRenderDevice *pDevice, bool UseReverseZ, T LayoutElement{1, 0, 4, VT_FLOAT32, False} }; + PSODesc.ResourceLayout.DefaultVariableType = SHADER_RESOURCE_VARIABLE_TYPE_STATIC; PSODesc.GraphicsPipeline.pVS = pVS; PSODesc.GraphicsPipeline.pPS = pPS; PSODesc.GraphicsPipeline.InputLayout.LayoutElements = LayoutElems; PSODesc.GraphicsPipeline.InputLayout.NumElements = _countof(LayoutElems); pDevice->CreatePipelineState(PSODesc, &m_PSO); m_PSO->CreateShaderResourceBinding(&m_SRB, true); + + m_PSO->GetStaticShaderVariable(SHADER_TYPE_VERTEX, "Constants")->Set(m_VSConstants); } { |
