Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
star-e committed Feb 7, 2025
1 parent 1fa80cb commit 9261cec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
5 changes: 3 additions & 2 deletions native/cocos/renderer/pipeline/InstancedBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void InstancedBuffer::merge(scene::SubModel *subModel, uint32_t passIdx, gfx::Sh
gfx::Texture *reflectionProbeBlendCubemap = ENABLE_PROBE_BLEND
? descriptorSet->getTexture(REFLECTIONPROBEBLENDCUBEMAP::BINDING)
: nullptr;
uint32_t reflectionProbeType = subModel->getReflectionProbeType();
const uint32_t reflectionProbeType = subModel->getReflectionProbeType();
auto *shader = shaderImplant;
if (!shader) {
shader = subModel->getShader(passIdx);
Expand Down Expand Up @@ -104,6 +104,7 @@ void InstancedBuffer::merge(scene::SubModel *subModel, uint32_t passIdx, gfx::Sh
if (instance.drawInfo.instanceCount >= instance.capacity) { // resize buffers
instance.capacity <<= 1;
const auto newSize = instance.stride * instance.capacity;
// NOLINTNEXTLINE(bugprone-suspicious-realloc-usage)
instance.data = static_cast<uint8_t *>(CC_REALLOC(instance.data, newSize));
instance.vb->resize(newSize);
}
Expand All @@ -113,7 +114,7 @@ void InstancedBuffer::merge(scene::SubModel *subModel, uint32_t passIdx, gfx::Sh
if (instance.descriptorSet != descriptorSet) {
instance.descriptorSet = descriptorSet;
}
memcpy(instance.data + instance.stride * instance.drawInfo.instanceCount++, attrs.buffer.buffer()->getData(), stride);
memcpy(instance.data + static_cast<size_t>(instance.stride) * instance.drawInfo.instanceCount++, attrs.buffer.buffer()->getData(), stride);
_hasPendingModels = true;
return;
}
Expand Down
16 changes: 8 additions & 8 deletions native/cocos/scene/Model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ void Model::updateUBOs(uint32_t stamp) {
for (const auto &subModel : _subModels) {
const auto idx = subModel->getInstancedWorldMatrixIndex();
if (idx >= 0) {
ccstd::vector<TypedArray> &attrs = subModel->getInstancedAttributeBlock().views;
const ccstd::vector<TypedArray> &attrs = subModel->getInstancedAttributeBlock().views;
subModel->updateInstancedWorldMatrix(worldMatrix, idx);
} else {
hasNonInstancingPass = true;
Expand All @@ -216,7 +216,7 @@ void Model::updateUBOs(uint32_t stamp) {
const Vec4 depthScale = {1.F, 0.F, 0.F, 1.F};
_localBuffer->write(depthScale, sizeof(float) * (pipeline::UBOLocal::REFLECTION_PROBE_DATA2));
} else {
uint16_t mipAndUseRGBE = probe->isRGBE() ? 1000 : 0;
const uint16_t mipAndUseRGBE = probe->isRGBE() ? 1000 : 0;
const Vec4 pos = {probe->getNode()->getWorldPosition().x, probe->getNode()->getWorldPosition().y, probe->getNode()->getWorldPosition().z, 0.F};
_localBuffer->write(pos, sizeof(float) * (pipeline::UBOLocal::REFLECTION_PROBE_DATA1));
const Vec4 boxSize = {probe->getBoudingSize().x, probe->getBoudingSize().y, probe->getBoudingSize().z, static_cast<float>(probe->getCubeMap() ? probe->getCubeMap()->mipmapLevel() + mipAndUseRGBE : 1 + mipAndUseRGBE)};
Expand All @@ -225,9 +225,9 @@ void Model::updateUBOs(uint32_t stamp) {
if (_reflectionProbeType == scene::UseReflectionProbeType::BLEND_PROBES ||
_reflectionProbeType == scene::UseReflectionProbeType::BLEND_PROBES_AND_SKYBOX) {
if (blendProbe) {
uint16_t mipAndUseRGBE = blendProbe->isRGBE() ? 1000 : 0;
const uint16_t mipAndUseRGBE = blendProbe->isRGBE() ? 1000 : 0;
const Vec3 worldPos = blendProbe->getNode()->getWorldPosition();
Vec3 boudingBox = blendProbe->getBoudingSize();
const Vec3 boudingBox = blendProbe->getBoudingSize();
const Vec4 pos = {worldPos.x, worldPos.y, worldPos.z, _reflectionProbeBlendWeight};
_localBuffer->write(pos, sizeof(float) * (pipeline::UBOLocal::REFLECTION_PROBE_BLEND_DATA1));
const Vec4 boxSize = {boudingBox.x, boudingBox.y, boudingBox.z, static_cast<float>(blendProbe->getCubeMap() ? blendProbe->getCubeMap()->mipmapLevel() + mipAndUseRGBE : 1 + mipAndUseRGBE)};
Expand Down Expand Up @@ -431,7 +431,7 @@ void Model::updateSHUBOs() {

_lastWorldBoundCenter.set(center);
_tetrahedronIndex = lightProbes->getData()->getInterpolationWeights(center, _tetrahedronIndex, weights);
bool result = lightProbes->getData()->getInterpolationSHCoefficients(_tetrahedronIndex, weights, coefficients);
const bool result = lightProbes->getData()->getInterpolationSHCoefficients(_tetrahedronIndex, weights, coefficients);
if (!result) {
return;
}
Expand Down Expand Up @@ -468,7 +468,7 @@ ccstd::vector<IMacroPatch> Model::getMacroPatches(index_t subModelIndex) {
}
}

patches.push_back({CC_USE_REFLECTION_PROBE, static_cast<int32_t>(_reflectionProbeType)});
patches.emplace_back(CC_USE_REFLECTION_PROBE, static_cast<int32_t>(_reflectionProbeType));

if (_lightmap != nullptr) {
bool stationary = false;
Expand All @@ -495,7 +495,7 @@ ccstd::vector<IMacroPatch> Model::getMacroPatches(index_t subModelIndex) {
}
}
}
patches.push_back({CC_DISABLE_DIRECTIONAL_LIGHT, !_receiveDirLight});
patches.emplace_back(CC_DISABLE_DIRECTIONAL_LIGHT, !_receiveDirLight);

return patches;
}
Expand Down Expand Up @@ -651,7 +651,7 @@ void Model::updateReflectionProbePlanarMap(gfx::Texture *texture) {
bindingTexture = BuiltinResMgr::getInstance()->get<Texture2D>(ccstd::string("empty-texture"))->getGFXTexture();
}
if (bindingTexture) {
gfx::SamplerInfo info{
const gfx::SamplerInfo info{
cc::gfx::Filter::LINEAR,
cc::gfx::Filter::LINEAR,
cc::gfx::Filter::NONE,
Expand Down

0 comments on commit 9261cec

Please sign in to comment.