mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 21:58:31 +09:00
[Perf] (MG_Backend/DirectVulkan): bind GetBoundObject/GetSamplerObject const-ref returns by reference in BindProgramUniformBuffers resolve paths (UBO/SSBO/texel/sampler override) instead of copying the SharedPtr; ResolveUniformBufferPayload 2.2%->1.6%
This commit is contained in:
@@ -220,7 +220,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
const Int location = programObj.samplerUniformLocationByBinding[binding];
|
const Int location = programObj.samplerUniformLocationByBinding[binding];
|
||||||
const Int unit = ResolveSamplerUnitIndex(program, location, binding);
|
const Int unit = ResolveSamplerUnitIndex(program, location, binding);
|
||||||
auto& textureUnit = MG_State::pGLContext->GetTextureUnitObject(unit);
|
auto& textureUnit = MG_State::pGLContext->GetTextureUnitObject(unit);
|
||||||
const auto samplerOverride = textureUnit.GetSamplerObject();
|
const auto& samplerOverride = textureUnit.GetSamplerObject();
|
||||||
const auto preferredTarget = programObj.samplerTextureTargetByBinding[binding];
|
const auto preferredTarget = programObj.samplerTextureTargetByBinding[binding];
|
||||||
SharedPtr<MG_State::GLState::ITextureObject> fallbackHolder;
|
SharedPtr<MG_State::GLState::ITextureObject> fallbackHolder;
|
||||||
if (texture == nullptr) {
|
if (texture == nullptr) {
|
||||||
@@ -427,7 +427,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto* textureBuffer = static_cast<MG_State::GLState::TextureObjectBuffer*>(texture.get());
|
auto* textureBuffer = static_cast<MG_State::GLState::TextureObjectBuffer*>(texture.get());
|
||||||
const auto bufferObject = textureBuffer->GetBufferBindingSlot().GetBoundObject();
|
const auto& bufferObject = textureBuffer->GetBufferBindingSlot().GetBoundObject();
|
||||||
if (bufferObject == nullptr) {
|
if (bufferObject == nullptr) {
|
||||||
MGLOG_E("ResolveTexelBufferDescriptor: texture buffer binding %u ('%s') has no GL buffer bound",
|
MGLOG_E("ResolveTexelBufferDescriptor: texture buffer binding %u ('%s') has no GL buffer bound",
|
||||||
binding, programObj.samplerNameByBinding[binding].c_str());
|
binding, programObj.samplerNameByBinding[binding].c_str());
|
||||||
@@ -502,7 +502,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
frontendBinding, programObj.storageBlockNameByBinding[binding].c_str());
|
frontendBinding, programObj.storageBlockNameByBinding[binding].c_str());
|
||||||
|
|
||||||
auto& bindingPoint = MG_State::pGLContext->GetBufferBindingPoint(BufferTarget::ShaderStorage, frontendBinding);
|
auto& bindingPoint = MG_State::pGLContext->GetBufferBindingPoint(BufferTarget::ShaderStorage, frontendBinding);
|
||||||
const auto bufferObject = bindingPoint.GetBoundObject();
|
const auto& bufferObject = bindingPoint.GetBoundObject();
|
||||||
if (bufferObject == nullptr) {
|
if (bufferObject == nullptr) {
|
||||||
MGLOG_E("ResolveStorageBufferDescriptor: no SSBO bound at frontend binding %u for block '%s'",
|
MGLOG_E("ResolveStorageBufferDescriptor: no SSBO bound at frontend binding %u for block '%s'",
|
||||||
frontendBinding, programObj.storageBlockNameByBinding[binding].c_str());
|
frontendBinding, programObj.storageBlockNameByBinding[binding].c_str());
|
||||||
@@ -674,7 +674,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
frontendBinding, program.GetUniformBlockName(static_cast<Uint32>(blockIndex)).c_str());
|
frontendBinding, program.GetUniformBlockName(static_cast<Uint32>(blockIndex)).c_str());
|
||||||
|
|
||||||
auto& bindingPoint = MG_State::pGLContext->GetBufferBindingPoint(BufferTarget::Uniform, frontendBinding);
|
auto& bindingPoint = MG_State::pGLContext->GetBufferBindingPoint(BufferTarget::Uniform, frontendBinding);
|
||||||
const auto bufferObject = bindingPoint.GetBoundObject();
|
const auto& bufferObject = bindingPoint.GetBoundObject();
|
||||||
MOBILEGL_ASSERT(bufferObject != nullptr,
|
MOBILEGL_ASSERT(bufferObject != nullptr,
|
||||||
"ResolveUniformBufferPayload: no UBO bound at frontend binding %u for block '%s'",
|
"ResolveUniformBufferPayload: no UBO bound at frontend binding %u for block '%s'",
|
||||||
frontendBinding, program.GetUniformBlockName(static_cast<Uint32>(blockIndex)).c_str());
|
frontendBinding, program.GetUniformBlockName(static_cast<Uint32>(blockIndex)).c_str());
|
||||||
|
|||||||
Reference in New Issue
Block a user