delete subindex function (#11667)

* delete subindex function
This commit is contained in:
minggo
2022-06-23 14:53:02 +08:00
committed by GitHub
parent 0077fee553
commit 4b8b032ad8
6 changed files with 15 additions and 13 deletions
+9 -7
View File
@@ -220,13 +220,15 @@ public:
return *this;
}
T &operator[](uint32_t idx) {
return _data[idx];
}
const T&operator[](uint32_t idx) const {
return _data[idx];
}
// Can not return reference, or it can use like this
// refVector[i] = val;
// Then, reference count will be wrong. In order to correct reference count, should:
// - dec refVector[i] reference count
// - add `val` reference count.
// It is hard to use, so delete it.
T &operator[](uint32_t idx) = delete;
// As non const version is disabled, disable const version too.
const T&operator[](uint32_t idx) const = delete;
/**
* Requests that the vector capacity be at least enough to contain n elements.
@@ -220,7 +220,7 @@ bool RenderingSubMesh::destroy() {
if (!_jointMappedBuffers.empty() && !_jointMappedBufferIndices.empty()) {
for (uint32_t index : _jointMappedBufferIndices) {
_jointMappedBuffers.at(static_cast<int>(index))->destroy();
_jointMappedBuffers.at(index)->destroy();
}
_jointMappedBuffers.clear();
_jointMappedBufferIndices.clear();
@@ -289,7 +289,7 @@ const gfx::BufferList &RenderingSubMesh::getJointMappedBuffers() {
buffers.pushBack(buffer);
indices.emplace_back(i);
} else {
buffers.pushBack(_vertexBuffers.at(static_cast<int32_t>(prim.vertexBundelIndices[i])));
buffers.pushBack(_vertexBuffers.at(prim.vertexBundelIndices[i]));
}
}
+1 -1
View File
@@ -582,7 +582,7 @@ gfx::DescriptorSetLayout *ProgramLib::getDescriptorSetLayout(gfx::Device *device
info.bindings = pipeline::localDescriptorSetLayout.bindings;
tmplInfo.setLayouts.replace(static_cast<index_t>(pipeline::SetIndex::LOCAL), device->createDescriptorSetLayout(info));
}
return tmplInfo.setLayouts.at(isLocal ? static_cast<index_t>(pipeline::SetIndex::LOCAL) : static_cast<index_t>(pipeline::SetIndex::MATERIAL));
return tmplInfo.setLayouts.at(isLocal ? static_cast<uint32_t>(pipeline::SetIndex::LOCAL) : static_cast<uint32_t>(pipeline::SetIndex::MATERIAL));
}
ccstd::string ProgramLib::getKey(const ccstd::string &name, const MacroRecord &defines) {
@@ -48,7 +48,7 @@ void GLES2Framebuffer::doInit(const FramebufferInfo & /*info*/) {
_gpuFBO->gpuColorTextures.resize(_colorTextures.size());
for (size_t i = 0; i < _colorTextures.size(); ++i) {
auto *colorTexture = static_cast<GLES2Texture *>(_colorTextures[i]);
auto *colorTexture = static_cast<GLES2Texture *>(_colorTextures.at(i));
_gpuFBO->gpuColorTextures[i] = colorTexture->gpuTexture();
_gpuFBO->lodLevel = colorTexture->getViewInfo().baseLevel;
GLES2Device::getInstance()->framebufferHub()->connect(colorTexture->gpuTexture(), _gpuFBO);
@@ -48,7 +48,7 @@ void GLES3Framebuffer::doInit(const FramebufferInfo & /*info*/) {
_gpuFBO->gpuColorViews.resize(_colorTextures.size());
for (size_t i = 0; i < _colorTextures.size(); ++i) {
auto *colorTexture = static_cast<GLES3Texture *>(_colorTextures[i]);
auto *colorTexture = static_cast<GLES3Texture *>(_colorTextures.at(i));
_gpuFBO->gpuColorViews[i] = colorTexture->gpuTextureView();
GLES3Device::getInstance()->framebufferHub()->connect(colorTexture->gpuTexture(), _gpuFBO);
}
@@ -46,7 +46,7 @@ void CCVKFramebuffer::doInit(const FramebufferInfo & /*info*/) {
_gpuFBO->gpuColorViews.resize(_colorTextures.size());
for (size_t i = 0; i < _colorTextures.size(); ++i) {
auto *colorTex = static_cast<CCVKTexture *>(_colorTextures[i]);
auto *colorTex = static_cast<CCVKTexture *>(_colorTextures.at(i));
_gpuFBO->gpuColorViews[i] = colorTex->gpuTextureView();
CCVKDevice::getInstance()->gpuFramebufferHub()->connect(colorTex->gpuTexture(), _gpuFBO);
}