3700 FPS here we go

This commit is contained in:
Dynamitos
2021-04-25 23:43:40 +02:00
parent 312ae2af9a
commit 4a078bd24c
35 changed files with 160 additions and 73 deletions
+1 -2
View File
@@ -111,6 +111,7 @@ void Material::compile()
{
p->data = AssetRegistry::findTexture(""); // this will return placeholder texture
}
assert(p->data != nullptr);
parameters.add(p);
}
else if(type.compare("SamplerState") == 0)
@@ -137,8 +138,6 @@ void Material::compile()
uniformBuffer = WindowManager::getGraphics()->createUniformBuffer(uniformInitializer);
}
layout->create();
descriptorSet = layout->allocatedDescriptorSet();
updateDescriptorData();
BRDF* brdf = BRDF::getBRDFByName(profile);
brdf->generateMaterialCode(codeStream, j["code"]);
codeStream << "};";
-1
View File
@@ -27,7 +27,6 @@ private:
static std::mutex shaderMapLock;
std::string materialName;
Gfx::PDescriptorLayout layout;
friend class MaterialLoader;
friend class MaterialInstance;
};
+2
View File
@@ -31,6 +31,8 @@ void MaterialAsset::endFrame()
void MaterialAsset::updateDescriptorData()
{
layout->reset();
descriptorSet = layout->allocatedDescriptorSet();
BulkResourceData uniformUpdate;
uniformUpdate.size = uniformDataSize;
uniformUpdate.data = uniformData;
+3
View File
@@ -24,11 +24,14 @@ public:
// This needs to be called while the descriptorset is unused
void updateDescriptorData();
void resetDescriptorSet();
const Gfx::PDescriptorSet getDescriptor() const;
protected:
//For now its simply the collection of parameters, since there is no point for expressions
Array<PShaderParameter> parameters;
Gfx::PDescriptorSet descriptorSet;
Gfx::PDescriptorLayout layout;
Gfx::PUniformBuffer uniformBuffer;
uint32 uniformDataSize;
uint8* uniformData;
-1
View File
@@ -34,7 +34,6 @@ void MaterialInstance::load()
uniformInitializer.resourceData.size = baseMaterial->uniformDataSize;
uniformInitializer.resourceData.data = nullptr;
uniformBuffer = WindowManager::getGraphics()->createUniformBuffer(uniformInitializer);
descriptorSet = baseMaterial->layout->allocatedDescriptorSet();
}
const Material* MaterialInstance::getRenderMaterial() const