textures
This commit is contained in:
@@ -57,7 +57,7 @@ DECLARE_BUILD_STAGE(shadercompiler)
|
||||
};
|
||||
stLinkProject.objects.AppendTail({GET_PROJECT_LIBRARY(tier1, "tier1")});
|
||||
stLinkProject.objects.AppendTail({GET_PROJECT_LIBRARY(tier2, "tier2")});
|
||||
stLinkProject.libraries = {"slang-compiler","slang-glslang-2025.24.2"};
|
||||
stLinkProject.libraries = {"slang-compiler","slang-glslang-2026.2.2"};
|
||||
stLinkProject.libraryDirectories = {"../external/linux"};
|
||||
szOutput = linker->Link(&stLinkProject);
|
||||
filesystem2->MakeDirectory(CUtlString("../build/tools"));
|
||||
@@ -65,8 +65,8 @@ DECLARE_BUILD_STAGE(shadercompiler)
|
||||
filesystem2->CopyFile(CUtlString("../build/tools"), GET_PROJECT_LIBRARY(tier0, "tier0"));
|
||||
filesystem2->CopyFile(CUtlString("../build/tools"), GET_PROJECT_LIBRARY(filesystem_std, "fs"));
|
||||
filesystem2->CopyFile(CUtlString("../build/tools"), GET_PROJECT_LIBRARY(libshadercompiler, "lib"));
|
||||
filesystem2->CopyFile(CUtlString("../build/tools"), "../external/linux/libslang-compiler.so.0.2025.24.2");
|
||||
filesystem2->CopyFile(CUtlString("../build/tools"), "../external/linux/libslang-glslang-2025.24.2.so");
|
||||
filesystem2->CopyFile(CUtlString("../build/tools"), "../external/linux/libslang-compiler.so.0.2026.2.2");
|
||||
filesystem2->CopyFile(CUtlString("../build/tools"), "../external/linux/libslang-glslang-2026.2.2.so");
|
||||
ADD_OUTPUT_OBJECT("compiler", szOutput);
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -19,6 +19,8 @@ void CompileShader( const char *szShader )
|
||||
|
||||
s_pVulkanSpirvCompiler->CompileShader(szShader, &shader);
|
||||
|
||||
Plat_MakeDir("../build", 0755);
|
||||
Plat_MakeDir("../build/funnygame", 0755);
|
||||
Plat_MakeDir("../build/funnygame/assets", 0755);
|
||||
Plat_MakeDir("../build/funnygame/assets/shaders", 0755);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user