This commit is contained in:
2026-02-20 19:35:09 +02:00
parent 3ed689f801
commit c00ecf4081
35 changed files with 576 additions and 99 deletions

View File

@@ -76,13 +76,42 @@ void CSlangVulkanSpirvShaderCompiler::CompileShaderStage( EShaderStage eStage, c
{
VariableLayoutReflection *pVar = pProgramLayout->getParameterByIndex(u);
input = {};
switch(pVar->getType()->getKind())
input.uCount = 1;
V_printf("%s %i\n", pVar->getName(), pVar->getType()->getKind());
TypeReflection *pType = pVar->getType();
trygetkind:
V_printf("%s %i\n", pType->getName(), pType->getKind());
switch(pType->getKind())
{
case slang::TypeReflection::Kind::ConstantBuffer:
input.eDescriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
break;
case slang::TypeReflection::Kind::Resource:
input.eDescriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
V_printf("%s: %i\n", pType->getName(), pType->getResourceShape());
switch(pType->getResourceShape())
{
case SLANG_TEXTURE_2D:
input.eDescriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE;
break;
case SLANG_STRUCTURED_BUFFER:
input.eDescriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
break;
default:
break;
}
break;
case slang::TypeReflection::Kind::Array:
{
size_t uCount = pType->getTotalArrayElementCount();
if (uCount == 0)
input.uCount = 128;
else
input.uCount = uCount;
pType = pType->getElementType();
}
goto trygetkind;
case slang::TypeReflection::Kind::SamplerState:
input.eDescriptorType = VK_DESCRIPTOR_TYPE_SAMPLER;
break;
default:
break;
@@ -90,6 +119,7 @@ void CSlangVulkanSpirvShaderCompiler::CompileShaderStage( EShaderStage eStage, c
V_strncpy(input.szName, pVar->getName(), 32);
input.uBinding = pVar->getBindingIndex();
input.uSet = pVar->getBindingSpace();
V_printf("%i\n", input.uCount);
inputs.AppendTail(input);
}
@@ -174,6 +204,7 @@ void CSlangVulkanSpirvShaderCompiler::CompileShader( const char *szInput, CCompi
if ( szMainName == NULL )
continue;
pSession = NULL;
V_printf("Cool\n");
s_pGlobalSession->createSession(stSessionDesc, &pSession);
pModule = pSession->loadModuleFromSource("main", szInput, pShaderSourceBlob, &m_pDiagnostics);
@@ -192,7 +223,6 @@ void CSlangVulkanSpirvShaderCompiler::CheckDiagnostics()
if (m_pDiagnostics)
{
V_printf("%s\n",(const char*)m_pDiagnostics->getBufferPointer());
Plat_Exit(0);
}
};