Migrating back to using UniformBuffer structs.

Since the cbuffer uses the same name as the struct, we have to rename the cbuffer using a consistent prefix. The reflection handling also needs to reinterpret the renamed cbuffer as the correct UniformBuffer.

#jira none
#rb kenzo.terelst
#preflight 625edc5f034d8924cdcc35e2

[CL 19813742 by christopher waters in ue5-main branch]
This commit is contained in:
christopher waters
2022-04-19 14:32:30 -04:00
parent 6d0622b494
commit 5c395bb058
6 changed files with 29 additions and 4 deletions

View File

@@ -5,6 +5,7 @@
#include "Modules/ModuleManager.h"
#include "HlslccDefinitions.h"
#include "HAL/FileManager.h"
#include "ShaderParameters.h"
IMPLEMENT_MODULE(FDefaultModuleImpl, ShaderCompilerCommon);
@@ -469,6 +470,13 @@ TCHAR* FindNextUniformBufferReference(TCHAR* SearchPtr, const TCHAR* SearchStrin
return nullptr;
}
FString UE::ShaderCompilerCommon::SanitizeUniformBufferName(const FString& InName)
{
FString NewName(InName);
NewName.RemoveFromStart(UE::ShaderParameters::kUniformBufferConstantBufferPrefix);
return NewName;
}
void HandleReflectedGlobalConstantBufferMember(
const FString& MemberName,
uint32 ConstantBufferIndex,
@@ -518,8 +526,10 @@ void HandleReflectedUniformBuffer(
FShaderCompilerOutput& CompilerOutput
)
{
FString AdjustedUniformBufferName(UE::ShaderCompilerCommon::SanitizeUniformBufferName(UniformBufferName));
CompilerOutput.ParameterMap.AddParameterAllocation(
*UniformBufferName,
*AdjustedUniformBufferName,
ReflectionSlot,
BaseIndex,
BufferSize,