mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 21:58:31 +09:00
[Fix] (MG_Impl/Getter): Fix crashing when object is nullptr in GetIntegerv.
This commit is contained in:
@@ -52,7 +52,14 @@ namespace MobileGL {
|
||||
|
||||
BindingSlot<BufferObject>& GLContext::GetBufferBindingSlot(BufferTarget target) {
|
||||
if (target == BufferTarget::Index) {
|
||||
return m_vertexArrayState.GetBoundVertexArray()->GetIndexBufferBindingSlot();
|
||||
const auto& vao = m_vertexArrayState.GetBoundVertexArray();
|
||||
if (vao) {
|
||||
return vao->GetIndexBufferBindingSlot();
|
||||
} else {
|
||||
assert(false);
|
||||
static BindingSlot<BufferObject> defaultSlot(BufferTarget::Index);
|
||||
return defaultSlot;
|
||||
}
|
||||
}
|
||||
|
||||
return m_bufferState.GetBindingSlot(target);
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace MobileGL {
|
||||
namespace GLState {
|
||||
class ProgramObject {
|
||||
public:
|
||||
ProgramObject(const Uint externalIndex) : m_externalIndex(externalIndex) {}
|
||||
ProgramObject(Uint externalIndex) : m_externalIndex(externalIndex) {}
|
||||
bool ShaderIsAttached(SharedPtr<ShaderObject> shader);
|
||||
bool AttachShader(SharedPtr<ShaderObject> shader);
|
||||
SizeT DetachShader(SharedPtr<ShaderObject> shader);
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace MobileGL {
|
||||
namespace GLState {
|
||||
class ShaderObject {
|
||||
public:
|
||||
ShaderObject(const ShaderStage stage, const Uint externalIndex)
|
||||
ShaderObject(const ShaderStage stage, Uint externalIndex)
|
||||
: m_stage(stage), m_externalIndex(externalIndex) {}
|
||||
void SetShaderSource(const String& source);
|
||||
void SetShaderSource(String&& source);
|
||||
|
||||
Reference in New Issue
Block a user