mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-13 06:38:31 +09:00
[Chore] (...): Format code.
This commit is contained in:
@@ -434,8 +434,9 @@ namespace MobileGL {
|
||||
}
|
||||
|
||||
void BufferData_State(GLenum target, GLsizeiptr size, const void* data, GLenum usage) {
|
||||
MGLOG_D("%s: %s, size = %d, data = %p, usage = %s",
|
||||
__func__, MG_Util::ConvertGLEnumToString(target).c_str(), size, data, MG_Util::ConvertGLEnumToString(usage).c_str());
|
||||
MGLOG_D("%s: %s, size = %d, data = %p, usage = %s", __func__,
|
||||
MG_Util::ConvertGLEnumToString(target).c_str(), size, data,
|
||||
MG_Util::ConvertGLEnumToString(usage).c_str());
|
||||
if (size < 0) {
|
||||
MG_State::pGLContext->RecordError(
|
||||
ErrorCode::InvalidValue,
|
||||
@@ -479,7 +480,8 @@ namespace MobileGL {
|
||||
|
||||
auto& bindingSlot = MG_State::pGLContext->GetBufferBindingSlot(bufferTarget);
|
||||
bindingSlot.Bind(bufferObject);
|
||||
MGLOG_D("%s: bind buffer object %p -> %s", __func__, bufferObject.get(), MG_Util::ConvertGLEnumToString(target).c_str());
|
||||
MGLOG_D("%s: bind buffer object %p -> %s", __func__, bufferObject.get(),
|
||||
MG_Util::ConvertGLEnumToString(target).c_str());
|
||||
}
|
||||
|
||||
void GenBuffers_State(GLsizei n, GLuint* buffers) {
|
||||
|
||||
@@ -38,10 +38,10 @@ namespace MobileGL::MG_Impl::GLImpl {
|
||||
String bufferTargetStr = ConvertBufferTargetToString(target);
|
||||
String glTargetStr = ConvertGLEnumToString(ConvertBufferTargetToGLEnum(target));
|
||||
MG_State::pGLContext->RecordError(
|
||||
ErrorCode::InvalidEnum,
|
||||
MakeShared<GenericErrorInfo>(
|
||||
"MG_Impl/GLImpl/BufferImpl", "ValidateBufferTarget",
|
||||
std::format("Target {} ({}) is not valid.", bufferTargetStr, glTargetStr)));
|
||||
ErrorCode::InvalidEnum,
|
||||
MakeShared<GenericErrorInfo>(
|
||||
"MG_Impl/GLImpl/BufferImpl", "ValidateBufferTarget",
|
||||
std::format("Target {} ({}) is not valid.", bufferTargetStr, glTargetStr)));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -55,9 +55,9 @@ namespace MobileGL {
|
||||
if (rendererString.empty()) {
|
||||
const char* backendStr = (const char*)GetString_Backend(GL_RENDERER);
|
||||
const char* backendVersionStr = (const char*)GetString_Backend(GL_VERSION);
|
||||
rendererString =
|
||||
std::format("{} ({}) ({} | {})", MG_Config::RendererInfoPtr->RendererName.c_str(),
|
||||
MG_Config::CoreName.c_str(), backendStr ? backendStr : "<unknown GPU>", backendVersionStr ? backendVersionStr : "<unknown version>");
|
||||
rendererString = std::format("{} ({}) ({} | {})", MG_Config::RendererInfoPtr->RendererName.c_str(),
|
||||
MG_Config::CoreName.c_str(), backendStr ? backendStr : "<unknown GPU>",
|
||||
backendVersionStr ? backendVersionStr : "<unknown version>");
|
||||
}
|
||||
return (const GLubyte*)rendererString.c_str();
|
||||
}
|
||||
|
||||
@@ -52,7 +52,8 @@ namespace MobileGL {
|
||||
GLuint GetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName);
|
||||
void UniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
|
||||
void GetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params);
|
||||
void GetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName);
|
||||
void GetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length,
|
||||
GLchar* uniformBlockName);
|
||||
void BindFragDataLocation(GLuint program, GLuint colorNumber, const char* name);
|
||||
GLint GetFragDataLocation(GLuint program, const char* name);
|
||||
void ValidateProgram(GLuint program);
|
||||
|
||||
@@ -76,10 +76,12 @@ namespace MobileGL {
|
||||
*(GLint*)params = MG_Util::ConvertSamplerWrapModeToGLEnum(samplerObj->GetWrapR());
|
||||
break;
|
||||
case GL_TEXTURE_MIN_FILTER:
|
||||
*(GLint*)params = MG_Util::ConvertSamplerFilterModeToGLEnum(samplerObj->GetMinFilter(), samplerObj->GetMipmapMode());
|
||||
*(GLint*)params =
|
||||
MG_Util::ConvertSamplerFilterModeToGLEnum(samplerObj->GetMinFilter(), samplerObj->GetMipmapMode());
|
||||
break;
|
||||
case GL_TEXTURE_MAG_FILTER:
|
||||
*(GLint*)params = MG_Util::ConvertSamplerFilterModeToGLEnum(samplerObj->GetMagFilter(), SamplerMipmapMode::None);
|
||||
*(GLint*)params =
|
||||
MG_Util::ConvertSamplerFilterModeToGLEnum(samplerObj->GetMagFilter(), SamplerMipmapMode::None);
|
||||
break;
|
||||
case GL_TEXTURE_MIN_LOD:
|
||||
*(GLfloat*)params = samplerObj->GetMinLod();
|
||||
|
||||
@@ -384,8 +384,7 @@ namespace MobileGL {
|
||||
textureObject->SetInternalFormat(textureInternalFormat);
|
||||
|
||||
// if isProxy, no more pixel transfer needed below
|
||||
if (isProxy)
|
||||
return;
|
||||
if (isProxy) return;
|
||||
|
||||
const void* originalPixels = pixels;
|
||||
|
||||
@@ -409,8 +408,8 @@ namespace MobileGL {
|
||||
|
||||
void* processedPixels = nullptr;
|
||||
processedPixels = MG_Util::PixelStoreProcessor::ProcessTexturePixelsDataUnpack(
|
||||
originalPixels, MG_State::pGLContext->GetPixelStoreParameters(true), bytesPerPixel,
|
||||
{width, height, 1}, false, imageSize);
|
||||
originalPixels, MG_State::pGLContext->GetPixelStoreParameters(true), bytesPerPixel, {width, height, 1},
|
||||
false, imageSize);
|
||||
|
||||
if (processedPixels && imageSize > 0) {
|
||||
if (imageSize != totalBytes) {
|
||||
@@ -420,7 +419,7 @@ namespace MobileGL {
|
||||
}
|
||||
|
||||
const SizeT copySize = std::min(imageSize, totalBytes);
|
||||
DataPtr texelInput { processedPixels, copySize };
|
||||
DataPtr texelInput{processedPixels, copySize};
|
||||
textureObject->UpdateMipmapSubData(textureUploadingTarget, level, texelInput);
|
||||
}
|
||||
|
||||
@@ -475,14 +474,15 @@ namespace MobileGL {
|
||||
switch (pname) {
|
||||
case GL_TEXTURE_MAG_FILTER:
|
||||
if (params) {
|
||||
*params =
|
||||
MG_Util::ConvertSamplerFilterModeToGLEnum(textureObject->GetSamplerObject()->GetMagFilter(), SamplerMipmapMode::None);
|
||||
*params = MG_Util::ConvertSamplerFilterModeToGLEnum(
|
||||
textureObject->GetSamplerObject()->GetMagFilter(), SamplerMipmapMode::None);
|
||||
}
|
||||
break;
|
||||
case GL_TEXTURE_MIN_FILTER:
|
||||
if (params) {
|
||||
*params =
|
||||
MG_Util::ConvertSamplerFilterModeToGLEnum(textureObject->GetSamplerObject()->GetMinFilter(), textureObject->GetSamplerObject()->GetMipmapMode());
|
||||
MG_Util::ConvertSamplerFilterModeToGLEnum(textureObject->GetSamplerObject()->GetMinFilter(),
|
||||
textureObject->GetSamplerObject()->GetMipmapMode());
|
||||
}
|
||||
break;
|
||||
case GL_TEXTURE_MIN_LOD:
|
||||
@@ -555,14 +555,15 @@ namespace MobileGL {
|
||||
switch (pname) {
|
||||
case GL_TEXTURE_MAG_FILTER:
|
||||
if (params) {
|
||||
*params =
|
||||
MG_Util::ConvertSamplerFilterModeToGLEnum(textureObject->GetSamplerObject()->GetMagFilter(), SamplerMipmapMode::None);
|
||||
*params = MG_Util::ConvertSamplerFilterModeToGLEnum(
|
||||
textureObject->GetSamplerObject()->GetMagFilter(), SamplerMipmapMode::None);
|
||||
}
|
||||
break;
|
||||
case GL_TEXTURE_MIN_FILTER:
|
||||
if (params) {
|
||||
*params =
|
||||
MG_Util::ConvertSamplerFilterModeToGLEnum(textureObject->GetSamplerObject()->GetMinFilter(), textureObject->GetSamplerObject()->GetMipmapMode());
|
||||
MG_Util::ConvertSamplerFilterModeToGLEnum(textureObject->GetSamplerObject()->GetMinFilter(),
|
||||
textureObject->GetSamplerObject()->GetMipmapMode());
|
||||
}
|
||||
break;
|
||||
case GL_TEXTURE_MIN_LOD:
|
||||
@@ -880,9 +881,7 @@ namespace MobileGL {
|
||||
auto textureObject = MG_State::pGLContext->GetTextureObject(texture);
|
||||
|
||||
// ===================== Error Checking ==============================
|
||||
if (textureTarget != TextureTarget::TextureCubeMap &&
|
||||
!TextureImpl::ValidateTextureTargetUniformity(textureObject, textureTarget))
|
||||
return;
|
||||
if (!TextureImpl::ValidateTextureTargetUniformity(textureObject, textureTarget)) return;
|
||||
|
||||
// ======================= Processing ================================
|
||||
if (!textureObject) {
|
||||
|
||||
@@ -16,15 +16,15 @@ namespace MobileGL {
|
||||
auto fbo0 = MG_State::pGLContext->CreateFramebufferObject(0);
|
||||
auto colorTex = MakeShared<MG_State::GLState::TextureObject2D>(0);
|
||||
colorTex->SetInternalFormat(TextureInternalFormat::RGBA8);
|
||||
colorTex->AllocateStorage(TextureUploadTarget::Texture2D, 0, { {512, 512, 1}, 0 });
|
||||
colorTex->AllocateStorage(TextureUploadTarget::Texture2D, 0, {{512, 512, 1}, 0});
|
||||
// colorTex->SetMipmapLevel({{512, 512, 1}, 0, false, 0, {nullptr, 0}});
|
||||
auto depthTex = MakeShared<MG_State::GLState::TextureObject2D>(0);
|
||||
depthTex->SetInternalFormat(TextureInternalFormat::Depth32FStencil8);
|
||||
depthTex->AllocateStorage(TextureUploadTarget::Texture2D, 0, { {512, 512, 1}, 0 });
|
||||
depthTex->AllocateStorage(TextureUploadTarget::Texture2D, 0, {{512, 512, 1}, 0});
|
||||
// depthTex->SetMipmapLevel({{512, 512, 1}, 0, false, 0, {nullptr, 0}});
|
||||
auto stencilTex = MakeShared<MG_State::GLState::TextureObject2D>(0);
|
||||
stencilTex->SetInternalFormat(TextureInternalFormat::Depth32FStencil8);
|
||||
stencilTex->AllocateStorage(TextureUploadTarget::Texture2D, 0, { {512, 512, 1}, 0 });
|
||||
stencilTex->AllocateStorage(TextureUploadTarget::Texture2D, 0, {{512, 512, 1}, 0});
|
||||
// stencilTex->SetMipmapLevel({{512, 512, 1}, 0, false, 0, {nullptr, 0}});
|
||||
fbo0->AttachTexture(FramebufferAttachmentType::Color0, colorTex);
|
||||
fbo0->AttachTexture(FramebufferAttachmentType::Depth, depthTex);
|
||||
|
||||
Reference in New Issue
Block a user