/* * Copyright (c) Contributors to the Open 3D Engine Project. * For complete copyright and license terms please see the LICENSE at the root of this distribution. * * SPDX-License-Identifier: Apache-2.0 OR MIT * */ #include ShaderResourceGroup DualSourceBlendingSrg : SRG_PerObject { float m_blendFactor; } struct VSInput { float3 m_position : POSITION; float4 m_color : COLOR; }; struct VSOutput { float4 m_position : SV_Position; float4 m_color : COLOR; }; VSOutput MainVS(VSInput vsInput) { VSOutput OUT; OUT.m_position = float4(vsInput.m_position, 1.0); OUT.m_color = vsInput.m_color; return OUT; } struct PSOutput { [[vk::location(0), vk::index(0)]] float4 m_color0 : SV_Target0; [[vk::location(0), vk::index(1)]] float4 m_color1 : SV_Target1; }; PSOutput MainPS(VSOutput psInput) { PSOutput OUT; OUT.m_color0 = psInput.m_color; OUT.m_color1 = float4(DualSourceBlendingSrg::m_blendFactor, DualSourceBlendingSrg::m_blendFactor, DualSourceBlendingSrg::m_blendFactor, 1.0); // Set in BlendState // FinalColor = SourceColor * SourceColor1 + DestColor * (1 - SourceColor1) return OUT; }