Make changes for breaking NZSL update
Fix build Fix compilation (again) Fix global included TextureAsset belongs to another branch Add missing include Fix include (should be good, finally)
This commit is contained in:
@@ -256,6 +256,8 @@ namespace Nz
|
||||
|
||||
void Graphics::BuildDefaultMaterials()
|
||||
{
|
||||
using namespace nzsl::Ast::Literals;
|
||||
|
||||
std::size_t depthPassIndex = m_materialPassRegistry.GetPassIndex("DepthPass");
|
||||
std::size_t shadowPassIndex = m_materialPassRegistry.GetPassIndex("ShadowPass");
|
||||
std::size_t distanceShadowPassIndex = m_materialPassRegistry.GetPassIndex("DistanceShadowPass");
|
||||
@@ -274,17 +276,17 @@ namespace Nz
|
||||
settings.AddPass(forwardPassIndex, forwardPass);
|
||||
|
||||
MaterialPass depthPass = forwardPass;
|
||||
depthPass.options[CRC32("DepthPass")] = true;
|
||||
depthPass.options["DepthPass"_opt] = true;
|
||||
settings.AddPass(depthPassIndex, depthPass);
|
||||
|
||||
MaterialPass shadowPass = depthPass;
|
||||
shadowPass.options[CRC32("ShadowPass")] = true;
|
||||
shadowPass.options["ShadowPass"_opt] = true;
|
||||
shadowPass.states.frontFace = FrontFace::Clockwise;
|
||||
shadowPass.states.depthClamp = enabledFeatures.depthClamping;
|
||||
settings.AddPass(shadowPassIndex, shadowPass);
|
||||
|
||||
MaterialPass distanceShadowPass = shadowPass;
|
||||
distanceShadowPass.options[CRC32("DistanceDepth")] = true;
|
||||
distanceShadowPass.options["DistanceDepth"_opt] = true;
|
||||
settings.AddPass(distanceShadowPassIndex, distanceShadowPass);
|
||||
|
||||
m_defaultMaterials.materials[MaterialType::Basic].material = std::make_shared<Material>(std::move(settings), "BasicMaterial");
|
||||
@@ -302,17 +304,17 @@ namespace Nz
|
||||
settings.AddPass(forwardPassIndex, forwardPass);
|
||||
|
||||
MaterialPass depthPass = forwardPass;
|
||||
depthPass.options[CRC32("DepthPass")] = true;
|
||||
depthPass.options["DepthPass"_opt] = true;
|
||||
settings.AddPass(depthPassIndex, depthPass);
|
||||
|
||||
MaterialPass shadowPass = depthPass;
|
||||
shadowPass.options[CRC32("ShadowPass")] = true;
|
||||
shadowPass.options["ShadowPass"_opt] = true;
|
||||
shadowPass.states.frontFace = FrontFace::Clockwise;
|
||||
shadowPass.states.depthClamp = enabledFeatures.depthClamping;
|
||||
settings.AddPass(shadowPassIndex, shadowPass);
|
||||
|
||||
MaterialPass distanceShadowPass = shadowPass;
|
||||
distanceShadowPass.options[CRC32("DistanceDepth")] = true;
|
||||
distanceShadowPass.options["DistanceDepth"_opt] = true;
|
||||
settings.AddPass(distanceShadowPassIndex, distanceShadowPass);
|
||||
|
||||
m_defaultMaterials.materials[MaterialType::PhysicallyBased].material = std::make_shared<Material>(std::move(settings), "PhysicallyBasedMaterial");
|
||||
@@ -330,17 +332,17 @@ namespace Nz
|
||||
settings.AddPass(forwardPassIndex, forwardPass);
|
||||
|
||||
MaterialPass depthPass = forwardPass;
|
||||
depthPass.options[CRC32("DepthPass")] = true;
|
||||
depthPass.options["DepthPass"_opt] = true;
|
||||
settings.AddPass(depthPassIndex, depthPass);
|
||||
|
||||
MaterialPass shadowPass = depthPass;
|
||||
shadowPass.options[CRC32("ShadowPass")] = true;
|
||||
shadowPass.options["ShadowPass"_opt] = true;
|
||||
shadowPass.states.frontFace = FrontFace::Clockwise;
|
||||
shadowPass.states.depthClamp = enabledFeatures.depthClamping;
|
||||
settings.AddPass(shadowPassIndex, shadowPass);
|
||||
|
||||
MaterialPass distanceShadowPass = shadowPass;
|
||||
distanceShadowPass.options[CRC32("DistanceDepth")] = true;
|
||||
distanceShadowPass.options["DistanceDepth"_opt] = true;
|
||||
settings.AddPass(distanceShadowPassIndex, distanceShadowPass);
|
||||
|
||||
m_defaultMaterials.materials[MaterialType::Phong].material = std::make_shared<Material>(std::move(settings), "PhongMaterial");
|
||||
|
||||
@@ -26,6 +26,8 @@ namespace Nz
|
||||
Material::Material(MaterialSettings settings, const nzsl::Ast::ModulePtr& referenceModule) :
|
||||
m_settings(std::move(settings))
|
||||
{
|
||||
using namespace nzsl::Ast::Literals;
|
||||
|
||||
NazaraAssert(referenceModule, "invalid module");
|
||||
|
||||
Graphics* graphics = Graphics::Instance();
|
||||
@@ -36,9 +38,9 @@ namespace Nz
|
||||
options.forceAutoBindingResolve = true;
|
||||
options.partialSanitization = true;
|
||||
options.moduleResolver = graphics->GetShaderModuleResolver();
|
||||
options.optionValues[CRC32("MaxLightCount")] = SafeCast<UInt32>(PredefinedLightData::MaxLightCount);
|
||||
options.optionValues[CRC32("MaxLightCascadeCount")] = SafeCast<UInt32>(PredefinedDirectionalLightData::MaxLightCascadeCount);
|
||||
options.optionValues[CRC32("MaxJointCount")] = SafeCast<UInt32>(PredefinedSkeletalData::MaxMatricesCount);
|
||||
options.optionValues["MaxLightCount"_opt] = SafeCast<UInt32>(PredefinedLightData::MaxLightCount);
|
||||
options.optionValues["MaxLightCascadeCount"_opt] = SafeCast<UInt32>(PredefinedDirectionalLightData::MaxLightCascadeCount);
|
||||
options.optionValues["MaxJointCount"_opt] = SafeCast<UInt32>(PredefinedSkeletalData::MaxMatricesCount);
|
||||
|
||||
nzsl::Ast::ModulePtr sanitizedModule = nzsl::Ast::Sanitize(*referenceModule, options);
|
||||
|
||||
@@ -123,6 +125,8 @@ namespace Nz
|
||||
{
|
||||
uberShader->UpdateConfigCallback([=](UberShader::Config& config, const std::vector<RenderPipelineInfo::VertexBufferData>& vertexBuffers)
|
||||
{
|
||||
using namespace nzsl::Ast::Literals;
|
||||
|
||||
if (vertexBuffers.empty())
|
||||
return;
|
||||
|
||||
@@ -135,35 +139,35 @@ namespace Nz
|
||||
switch (component.component)
|
||||
{
|
||||
case VertexComponent::Color:
|
||||
config.optionValues[CRC32("VertexColorLoc")] = locationIndex;
|
||||
config.optionValues["VertexColorLoc"_opt] = locationIndex;
|
||||
break;
|
||||
|
||||
case VertexComponent::Normal:
|
||||
config.optionValues[CRC32("VertexNormalLoc")] = locationIndex;
|
||||
config.optionValues["VertexNormalLoc"_opt] = locationIndex;
|
||||
break;
|
||||
|
||||
case VertexComponent::Position:
|
||||
config.optionValues[CRC32("VertexPositionLoc")] = locationIndex;
|
||||
config.optionValues["VertexPositionLoc"_opt] = locationIndex;
|
||||
break;
|
||||
|
||||
case VertexComponent::SizeSinCos:
|
||||
config.optionValues[CRC32("VertexSizeRotLocation")] = locationIndex;
|
||||
config.optionValues["VertexSizeRotLocation"_opt] = locationIndex;
|
||||
break;
|
||||
|
||||
case VertexComponent::Tangent:
|
||||
config.optionValues[CRC32("VertexTangentLoc")] = locationIndex;
|
||||
config.optionValues["VertexTangentLoc"_opt] = locationIndex;
|
||||
break;
|
||||
|
||||
case VertexComponent::TexCoord:
|
||||
config.optionValues[CRC32("VertexUvLoc")] = locationIndex;
|
||||
config.optionValues["VertexUvLoc"_opt] = locationIndex;
|
||||
break;
|
||||
|
||||
case VertexComponent::JointIndices:
|
||||
config.optionValues[CRC32("VertexJointIndicesLoc")] = locationIndex;
|
||||
config.optionValues["VertexJointIndicesLoc"_opt] = locationIndex;
|
||||
break;
|
||||
|
||||
case VertexComponent::JointWeights:
|
||||
config.optionValues[CRC32("VertexJointWeightsLoc")] = locationIndex;
|
||||
config.optionValues["VertexJointWeightsLoc"_opt] = locationIndex;
|
||||
break;
|
||||
|
||||
case VertexComponent::Unused:
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace Nz
|
||||
throw std::runtime_error("option " + node.optName + " condition must be resolved");
|
||||
|
||||
OptionData& optionData = m_options[node.optName];
|
||||
optionData.hash = CRC32(node.optName);
|
||||
optionData.hash = nzsl::Ast::HashOption(node.optName);
|
||||
optionData.type = node.optType.GetResultingValue();
|
||||
}
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace Nz
|
||||
//TODO: Check optionType
|
||||
|
||||
optionByName[option.optName] = Option{
|
||||
CRC32(option.optName)
|
||||
nzsl::Ast::HashOption(option.optName)
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user