forked from Dynamitos/Seele
Implementing switch for image based lighting
This commit is contained in:
1 parent
106dfe0423
commit
d81ea5f8e5
6 files changed
+44
-33
No files matched your search
@@ -59,32 +59,38 @@ void ShaderCompiler::compile() {
|
||||
if (pass.useMaterial) {
|
||||
for (const auto& [matName, mat] : materials) {
|
||||
for (int y = 0; y < 2; y++) {
|
||||
work.add([=, this]() {
|
||||
ShaderPermutation permutation = getTemplate(name);
|
||||
permutation.setPositionOnly(false);
|
||||
permutation.setDepthCulling(y);
|
||||
permutation.setVertexData(vd->getTypeName());
|
||||
OPipelineLayout layout = graphics->createPipelineLayout(pass.baseLayout->getName(), pass.baseLayout);
|
||||
layout->addDescriptorLayout(vd->getVertexDataLayout());
|
||||
layout->addDescriptorLayout(vd->getInstanceDataLayout());
|
||||
permutation.setMaterial(mat->getName(), mat->getProfile());
|
||||
createShaders(permutation, std::move(layout), name);
|
||||
});
|
||||
for (int z = 0; z < 2; ++z) {
|
||||
work.add([=, this]() {
|
||||
ShaderPermutation permutation = getTemplate(name);
|
||||
permutation.setPositionOnly(false);
|
||||
permutation.setDepthCulling(y);
|
||||
permutation.setImageBasedLighting(z);
|
||||
permutation.setVertexData(vd->getTypeName());
|
||||
OPipelineLayout layout = graphics->createPipelineLayout(pass.baseLayout->getName(), pass.baseLayout);
|
||||
layout->addDescriptorLayout(vd->getVertexDataLayout());
|
||||
layout->addDescriptorLayout(vd->getInstanceDataLayout());
|
||||
permutation.setMaterial(mat->getName(), mat->getProfile());
|
||||
createShaders(permutation, std::move(layout), name);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int x = 0; x < 2; x++) {
|
||||
for (int y = 0; y < 2; y++) {
|
||||
work.add([=, this]() {
|
||||
ShaderPermutation permutation = getTemplate(name);
|
||||
permutation.setPositionOnly(x);
|
||||
permutation.setDepthCulling(y);
|
||||
permutation.setVertexData(vd->getTypeName());
|
||||
OPipelineLayout layout = graphics->createPipelineLayout(pass.baseLayout->getName(), pass.baseLayout);
|
||||
layout->addDescriptorLayout(vd->getVertexDataLayout());
|
||||
layout->addDescriptorLayout(vd->getInstanceDataLayout());
|
||||
createShaders(permutation, std::move(layout), name);
|
||||
});
|
||||
for (int z = 0; z < 2; z++) {
|
||||
work.add([=, this]() {
|
||||
ShaderPermutation permutation = getTemplate(name);
|
||||
permutation.setPositionOnly(x);
|
||||
permutation.setDepthCulling(y);
|
||||
permutation.setImageBasedLighting(z);
|
||||
permutation.setVertexData(vd->getTypeName());
|
||||
OPipelineLayout layout = graphics->createPipelineLayout(pass.baseLayout->getName(), pass.baseLayout);
|
||||
layout->addDescriptorLayout(vd->getVertexDataLayout());
|
||||
layout->addDescriptorLayout(vd->getInstanceDataLayout());
|
||||
createShaders(permutation, std::move(layout), name);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,7 +115,7 @@ void ShaderCompiler::createShaders(ShaderPermutation permutation, Gfx::OPipeline
|
||||
if (std::strlen(permutation.materialName) > 0) {
|
||||
createInfo.modules.add(permutation.materialName);
|
||||
createInfo.defines["MATERIAL_FILE_NAME"] = permutation.materialName;
|
||||
//createInfo.typeParameter.add({"IBRDF", "Phong"});
|
||||
// createInfo.typeParameter.add({"IBRDF", "Phong"});
|
||||
}
|
||||
if (permutation.positionOnly) {
|
||||
createInfo.defines["POS_ONLY"] = "1";
|
||||
@@ -120,13 +126,15 @@ void ShaderCompiler::createShaders(ShaderPermutation permutation, Gfx::OPipeline
|
||||
if (permutation.visibilityPass) {
|
||||
createInfo.defines["VISIBILITY"] = "1";
|
||||
}
|
||||
if (permutation.dumpIntermediates)
|
||||
{
|
||||
if (permutation.imageBasedLighting) {
|
||||
createInfo.defines["IMAGE_BASE_LIGHTING"] = "1";
|
||||
}
|
||||
if (permutation.dumpIntermediates) {
|
||||
createInfo.dumpIntermediate = true;
|
||||
}
|
||||
//createInfo.typeParameter.add({Pair<const char*, const char*>("IVertexData", permutation.vertexDataName)});
|
||||
// createInfo.typeParameter.add({Pair<const char*, const char*>("IVertexData", permutation.vertexDataName)});
|
||||
createInfo.modules.add(permutation.vertexDataName);
|
||||
//createInfo.dumpIntermediate = true;
|
||||
// createInfo.dumpIntermediate = true;
|
||||
|
||||
if (permutation.useMeshShading) {
|
||||
if (permutation.hasTaskShader) {
|
||||
|
||||
Reference in new issue
Block a user