| 38 | { |
| 39 | |
| 40 | USD_Renderer::CreateInfo::PSMainSourceInfo USD_Renderer::GetUsdPbrPSMainSource(USD_Renderer::PSO_FLAGS PSOFlags) const |
| 41 | { |
| 42 | USD_Renderer::CreateInfo::PSMainSourceInfo PSMainInfo; |
| 43 | |
| 44 | if (PSOFlags & USD_PSO_FLAG_ENABLE_ALL_OUTPUTS) |
| 45 | { |
| 46 | std::stringstream ss; |
| 47 | |
| 48 | ss << "struct PSOutput" << std::endl |
| 49 | << '{' << std::endl; |
| 50 | if (PSOFlags & USD_PSO_FLAG_ENABLE_COLOR_OUTPUT) |
| 51 | ss << " float4 Color : SV_Target" << m_ColorTargetIndex << ';' << std::endl; |
| 52 | |
| 53 | if (PSOFlags & USD_PSO_FLAG_ENABLE_MESH_ID_OUTPUT) |
| 54 | ss << " float4 MeshID : SV_Target" << m_MeshIdTargetIndex << ';' << std::endl; |
| 55 | |
| 56 | if (PSOFlags & USD_PSO_FLAG_ENABLE_MOTION_VECTORS_OUTPUT) |
| 57 | ss << " float4 MotionVec : SV_Target" << m_MotionVectorTargetIndex << ';' << std::endl; |
| 58 | |
| 59 | if (PSOFlags & USD_PSO_FLAG_ENABLE_NORMAL_OUTPUT) |
| 60 | ss << " float4 Normal : SV_Target" << m_NormalTargetIndex << ';' << std::endl; |
| 61 | |
| 62 | if (PSOFlags & USD_PSO_FLAG_ENABLE_BASE_COLOR_OUTPUT) |
| 63 | ss << " float4 BaseColor : SV_Target" << m_BaseColorTargetIndex << ';' << std::endl; |
| 64 | |
| 65 | if (PSOFlags & USD_PSO_FLAG_ENABLE_MATERIAL_DATA_OUTPUT) |
| 66 | ss << " float4 Material : SV_Target" << m_MaterialDataTargetIndex << ';' << std::endl; |
| 67 | |
| 68 | if (PSOFlags & USD_PSO_FLAG_ENABLE_IBL_OUTPUT) |
| 69 | ss << " float4 IBL : SV_Target" << m_IBLTargetIndex << ';' << std::endl; |
| 70 | |
| 71 | ss << "};" << std::endl; |
| 72 | |
| 73 | PSMainInfo.OutputStruct = ss.str(); |
| 74 | } |
| 75 | else |
| 76 | { |
| 77 | PSMainInfo.OutputStruct = "#define PSOutput void\n"; |
| 78 | } |
| 79 | |
| 80 | std::stringstream ss; |
| 81 | |
| 82 | if (PSOFlags & USD_PSO_FLAG_ENABLE_ALL_OUTPUTS) |
| 83 | ss << " PSOutput PSOut;"; |
| 84 | |
| 85 | ss << R"( |
| 86 | float MeshId = 0.0; |
| 87 | float3 Normal = float3(0.0, 0.0, 0.0); |
| 88 | float2 MaterialData = float2(0.0, 0.0); |
| 89 | float3 IBL = float3(0.0, 0.0, 0.0); |
| 90 | |
| 91 | #if UNSHADED |
| 92 | float4 OutColor = g_Frame.Renderer.UnshadedColor + g_Frame.Renderer.HighlightColor; |
| 93 | float4 BaseColor = float4(0.0, 0.0, 0.0, 0.0); |
| 94 | float2 MotionVector = float2(0.0, 0.0); |
| 95 | #else |
| 96 | MeshId = PRIMITIVE.Material.Basic.CustomData.x; |
| 97 | Normal = Shading.BaseLayer.Normal.xyz; |
nothing calls this directly
no outgoing calls
no test coverage detected