mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-13 06:38:31 +09:00
[Feat|Refactor] (MG_Backend|MG_Impl): Implement BackendObject, replacing previous methods.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -12,5 +12,5 @@
|
||||
namespace MobileGL {
|
||||
namespace MG_Util {
|
||||
String ConvertEGLEnumToString(GLenum value);
|
||||
}
|
||||
} // namespace MG_Util
|
||||
} // namespace MobileGL
|
||||
@@ -12,5 +12,5 @@
|
||||
namespace MobileGL {
|
||||
namespace MG_Util {
|
||||
EShLanguage ConvertGLEnumToEShLanguage(GLenum shaderType);
|
||||
}
|
||||
} // namespace MG_Util
|
||||
} // namespace MobileGL
|
||||
@@ -12,5 +12,5 @@
|
||||
namespace MobileGL {
|
||||
namespace MG_Util {
|
||||
DataType ConvertGLEnumToDataType(GLenum type);
|
||||
}
|
||||
} // namespace MG_Util
|
||||
} // namespace MobileGL
|
||||
@@ -30,22 +30,22 @@ namespace MobileGL {
|
||||
}
|
||||
|
||||
switch (attachment) {
|
||||
case GL_NONE:
|
||||
return FramebufferAttachmentType::None;
|
||||
case GL_DEPTH_ATTACHMENT:
|
||||
return FramebufferAttachmentType::Depth;
|
||||
case GL_STENCIL_ATTACHMENT:
|
||||
return FramebufferAttachmentType::Stencil;
|
||||
case GL_FRONT_LEFT:
|
||||
return FramebufferAttachmentType::FrontLeft;
|
||||
case GL_FRONT_RIGHT:
|
||||
return FramebufferAttachmentType::FrontRight;
|
||||
case GL_BACK_LEFT:
|
||||
return FramebufferAttachmentType::BackLeft;
|
||||
case GL_BACK_RIGHT:
|
||||
return FramebufferAttachmentType::BackRight;
|
||||
default:
|
||||
return FramebufferAttachmentType::Unknown;
|
||||
case GL_NONE:
|
||||
return FramebufferAttachmentType::None;
|
||||
case GL_DEPTH_ATTACHMENT:
|
||||
return FramebufferAttachmentType::Depth;
|
||||
case GL_STENCIL_ATTACHMENT:
|
||||
return FramebufferAttachmentType::Stencil;
|
||||
case GL_FRONT_LEFT:
|
||||
return FramebufferAttachmentType::FrontLeft;
|
||||
case GL_FRONT_RIGHT:
|
||||
return FramebufferAttachmentType::FrontRight;
|
||||
case GL_BACK_LEFT:
|
||||
return FramebufferAttachmentType::BackLeft;
|
||||
case GL_BACK_RIGHT:
|
||||
return FramebufferAttachmentType::BackRight;
|
||||
default:
|
||||
return FramebufferAttachmentType::Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,5 +13,5 @@
|
||||
namespace MobileGL {
|
||||
namespace MG_Util {
|
||||
ShaderStage ConvertGLEnumToShaderStage(GLenum type);
|
||||
}
|
||||
} // namespace MG_Util
|
||||
} // namespace MobileGL
|
||||
@@ -1823,9 +1823,9 @@ namespace MobileGL {
|
||||
CASE(GL_FOG_SPECULAR_TEXTURE_WIN)
|
||||
|
||||
default:
|
||||
return std::format("0x%x", value);
|
||||
return std::format("0x{:x}", value);
|
||||
}
|
||||
#undef CASE
|
||||
}
|
||||
} // namespace MG_Util
|
||||
} // namespace MobileGL
|
||||
} // namespace MobileGL
|
||||
|
||||
@@ -12,5 +12,5 @@
|
||||
namespace MobileGL {
|
||||
namespace MG_Util {
|
||||
String ConvertGLEnumToString(GLenum value);
|
||||
}
|
||||
} // namespace MG_Util
|
||||
} // namespace MobileGL
|
||||
@@ -12,5 +12,5 @@
|
||||
namespace MobileGL {
|
||||
namespace MG_Util {
|
||||
GLenum ConvertDataTypeToGLEnum(DataType type);
|
||||
}
|
||||
} // namespace MG_Util
|
||||
} // namespace MobileGL
|
||||
@@ -13,5 +13,5 @@
|
||||
namespace MobileGL {
|
||||
namespace MG_Util {
|
||||
GLenum ConvertErrorCodeToGLEnum(ErrorCode code);
|
||||
}
|
||||
} // namespace MG_Util
|
||||
} // namespace MobileGL
|
||||
@@ -29,20 +29,20 @@ namespace MobileGL {
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case FramebufferAttachmentType::Depth:
|
||||
return GL_DEPTH_ATTACHMENT;
|
||||
case FramebufferAttachmentType::Stencil:
|
||||
return GL_STENCIL_ATTACHMENT;
|
||||
case FramebufferAttachmentType::FrontLeft:
|
||||
return GL_FRONT_LEFT;
|
||||
case FramebufferAttachmentType::FrontRight:
|
||||
return GL_FRONT_RIGHT;
|
||||
case FramebufferAttachmentType::BackLeft:
|
||||
return GL_BACK_LEFT;
|
||||
case FramebufferAttachmentType::BackRight:
|
||||
return GL_BACK_RIGHT;
|
||||
default:
|
||||
return GL_NONE;
|
||||
case FramebufferAttachmentType::Depth:
|
||||
return GL_DEPTH_ATTACHMENT;
|
||||
case FramebufferAttachmentType::Stencil:
|
||||
return GL_STENCIL_ATTACHMENT;
|
||||
case FramebufferAttachmentType::FrontLeft:
|
||||
return GL_FRONT_LEFT;
|
||||
case FramebufferAttachmentType::FrontRight:
|
||||
return GL_FRONT_RIGHT;
|
||||
case FramebufferAttachmentType::BackLeft:
|
||||
return GL_BACK_LEFT;
|
||||
case FramebufferAttachmentType::BackRight:
|
||||
return GL_BACK_RIGHT;
|
||||
default:
|
||||
return GL_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,5 +13,5 @@
|
||||
namespace MobileGL {
|
||||
namespace MG_Util {
|
||||
GLenum ConvertShaderStageToGLEnum(ShaderStage stage);
|
||||
}
|
||||
} // namespace MG_Util
|
||||
} // namespace MobileGL
|
||||
@@ -12,5 +12,5 @@
|
||||
namespace MobileGL {
|
||||
namespace MG_Util {
|
||||
String ConvertDataTypeToString(DataType type);
|
||||
}
|
||||
} // namespace MG_Util
|
||||
} // namespace MobileGL
|
||||
@@ -12,5 +12,5 @@
|
||||
namespace MobileGL {
|
||||
namespace MG_Util {
|
||||
String ConvertGLExtToString(GLExtension extension);
|
||||
}
|
||||
} // namespace MG_Util
|
||||
} // namespace MobileGL
|
||||
@@ -12,5 +12,5 @@
|
||||
namespace MobileGL {
|
||||
namespace MG_Util {
|
||||
SizeT GetGLTypeSize(GLenum type);
|
||||
}
|
||||
} // namespace MG_Util
|
||||
} // namespace MobileGL
|
||||
|
||||
@@ -208,11 +208,11 @@ namespace MobileGL::MG_Util::PixelStoreProcessor {
|
||||
|
||||
bool needSwizzle = false;
|
||||
static Vector<TextureSwizzleParam> swizzle;
|
||||
swizzle = { TextureSwizzleParam::Red, TextureSwizzleParam::Green,
|
||||
TextureSwizzleParam::Blue, TextureSwizzleParam::Alpha };
|
||||
swizzle = {TextureSwizzleParam::Red, TextureSwizzleParam::Green, TextureSwizzleParam::Blue,
|
||||
TextureSwizzleParam::Alpha};
|
||||
if (srcInternalFormat == TextureInternalFormat::RGBA && dstInputFormat == TextureInputFormat::BGRA) {
|
||||
swizzle = { TextureSwizzleParam::Blue, TextureSwizzleParam::Green,
|
||||
TextureSwizzleParam::Red, TextureSwizzleParam::Alpha };
|
||||
swizzle = {TextureSwizzleParam::Blue, TextureSwizzleParam::Green, TextureSwizzleParam::Red,
|
||||
TextureSwizzleParam::Alpha};
|
||||
needSwizzle = true;
|
||||
}
|
||||
if (dstDataType == TexturePixelDataType::UnsignedInt8888) {
|
||||
|
||||
@@ -18,5 +18,5 @@ namespace MobileGL {
|
||||
namespace MG_Util::TextureFormatProcessor {
|
||||
void NormalizePixelFormat(GLenum internalFormat, Flags<PixelFormatNormalizeOptionBit> options,
|
||||
GLenum* outInternalFormat, GLenum* outFormat, GLenum* outType);
|
||||
}
|
||||
} // namespace MG_Util::TextureFormatProcessor
|
||||
} // namespace MobileGL
|
||||
@@ -75,6 +75,10 @@ namespace MobileGL {
|
||||
using E = std::common_type_t<Ts...>;
|
||||
return std::array<E, sizeof...(Ts)>{{std::forward<Ts>(elems)...}};
|
||||
}
|
||||
template <typename T>
|
||||
inline String ToString(const T& value) {
|
||||
return std::to_string(value);
|
||||
}
|
||||
class RuntimeError : public std::runtime_error {
|
||||
public:
|
||||
using std::runtime_error::runtime_error;
|
||||
@@ -252,7 +256,7 @@ namespace MobileGL {
|
||||
}
|
||||
};
|
||||
|
||||
struct BackendCap {
|
||||
struct StaticBackendCapabilityT {
|
||||
Bool AllowVSOnlyPrograms = false;
|
||||
};
|
||||
|
||||
@@ -268,7 +272,7 @@ namespace MobileGL {
|
||||
String BackendName;
|
||||
Optional<String> ExtraVendor;
|
||||
GLInfo RendererGLInfo;
|
||||
BackendCap BackendCapability;
|
||||
StaticBackendCapabilityT StaticBackendCapability;
|
||||
};
|
||||
|
||||
template <typename Bit,
|
||||
|
||||
Reference in New Issue
Block a user