mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 14:18:31 +09:00
[Fix] (MG_State/TextureState): Fix incorrect behavior.
This commit is contained in:
@@ -136,8 +136,8 @@ namespace MobileGL {
|
|||||||
m_textureState.MarkTextureObjectForDeletion(index);
|
m_textureState.MarkTextureObjectForDeletion(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureUnit& GLContext::GetTextureUnitObject() {
|
TextureUnit& GLContext::GetTextureUnitObject(Int unit) {
|
||||||
return m_textureState.GetUnitObject();
|
return m_textureState.GetUnitObject(unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool GLContext::ValidateTextureName(Uint index) const {
|
Bool GLContext::ValidateTextureName(Uint index) const {
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace MobileGL {
|
|||||||
SharedPtr<ITextureObject> GetTextureObject(Uint index);
|
SharedPtr<ITextureObject> GetTextureObject(Uint index);
|
||||||
SharedPtr<ITextureObject> CreateTextureObject(Uint index, TextureTarget target);
|
SharedPtr<ITextureObject> CreateTextureObject(Uint index, TextureTarget target);
|
||||||
void MarkTextureObjectForDeletion(Uint index);
|
void MarkTextureObjectForDeletion(Uint index);
|
||||||
TextureUnit& GetTextureUnitObject();
|
TextureUnit& GetTextureUnitObject(Int unit);
|
||||||
Bool ValidateTextureName(Uint index) const;
|
Bool ValidateTextureName(Uint index) const;
|
||||||
Bool ValidateTextureObject(Uint index) const;
|
Bool ValidateTextureObject(Uint index) const;
|
||||||
Int GetActiveTextureUnit() const;
|
Int GetActiveTextureUnit() const;
|
||||||
@@ -64,6 +64,7 @@ namespace MobileGL {
|
|||||||
SharedPtr<ProgramObject> GetProgramObject(Uint index);
|
SharedPtr<ProgramObject> GetProgramObject(Uint index);
|
||||||
SharedPtr<ShaderObject> GetShaderObject(Uint index);
|
SharedPtr<ShaderObject> GetShaderObject(Uint index);
|
||||||
void UseProgram(Uint program);
|
void UseProgram(Uint program);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Error
|
// Error
|
||||||
ErrorState m_errorState;
|
ErrorState m_errorState;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace MobileGL {
|
|||||||
Red,
|
Red,
|
||||||
RG,
|
RG,
|
||||||
RGB,
|
RGB,
|
||||||
BFR,
|
BGR,
|
||||||
RGBA,
|
RGBA,
|
||||||
BGRA,
|
BGRA,
|
||||||
RInteger,
|
RInteger,
|
||||||
|
|||||||
@@ -64,11 +64,11 @@ namespace MobileGL {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureUnit& TextureState::GetUnitObject() {
|
TextureUnit& TextureState::GetUnitObject(Int unit) {
|
||||||
if (m_activeTextureUnit < 0 || m_activeTextureUnit >= MAX_TEXTURE_IMAGE_UNITS) {
|
if (unit < 0 || unit >= MAX_TEXTURE_IMAGE_UNITS) {
|
||||||
THROW_EXCEPTION("Active texture unit is out of range");
|
THROW_EXCEPTION("Active texture unit is out of range");
|
||||||
}
|
}
|
||||||
return m_textureUnits[m_activeTextureUnit];
|
return m_textureUnits[unit];
|
||||||
}
|
}
|
||||||
|
|
||||||
Int TextureState::GetActiveTextureUnit() const {
|
Int TextureState::GetActiveTextureUnit() const {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace MobileGL {
|
|||||||
Vector<Uint> GenerateNames(Uint number);
|
Vector<Uint> GenerateNames(Uint number);
|
||||||
SharedPtr<ITextureObject> CreateTextureObject(Uint index, TextureTarget target);
|
SharedPtr<ITextureObject> CreateTextureObject(Uint index, TextureTarget target);
|
||||||
SharedPtr<ITextureObject> GetTextureObject(Uint index);
|
SharedPtr<ITextureObject> GetTextureObject(Uint index);
|
||||||
TextureUnit& GetUnitObject();
|
TextureUnit& GetUnitObject(Int unit);
|
||||||
Int GetActiveTextureUnit() const;
|
Int GetActiveTextureUnit() const;
|
||||||
void SetActiveTextureUnit(Int unit);
|
void SetActiveTextureUnit(Int unit);
|
||||||
void MarkTextureObjectForDeletion(Uint index);
|
void MarkTextureObjectForDeletion(Uint index);
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ namespace MobileGL {
|
|||||||
GetAllBindingSlots() {
|
GetAllBindingSlots() {
|
||||||
return m_slots;
|
return m_slots;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TextureUnit::SetSamplerObject(SharedPtr<SamplerObject> sampler) {
|
||||||
|
m_sampler = sampler;
|
||||||
|
}
|
||||||
} // namespace GLState
|
} // namespace GLState
|
||||||
} // namespace MG_State
|
} // namespace MG_State
|
||||||
} // namespace MobileGL
|
} // namespace MobileGL
|
||||||
@@ -13,6 +13,7 @@ namespace MobileGL {
|
|||||||
BindingSlot<ITextureObject>& GetBindingSlot(TextureTarget target);
|
BindingSlot<ITextureObject>& GetBindingSlot(TextureTarget target);
|
||||||
SharedPtr<SamplerObject> GetSamplerObject() const;
|
SharedPtr<SamplerObject> GetSamplerObject() const;
|
||||||
Array<BindingSlot<ITextureObject>, (int)TextureTarget::TextureTargetCount>& GetAllBindingSlots();
|
Array<BindingSlot<ITextureObject>, (int)TextureTarget::TextureTargetCount>& GetAllBindingSlots();
|
||||||
|
void SetSamplerObject(SharedPtr<SamplerObject> sampler);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Array<BindingSlot<ITextureObject>, (int)TextureTarget::TextureTargetCount> m_slots;
|
Array<BindingSlot<ITextureObject>, (int)TextureTarget::TextureTargetCount> m_slots;
|
||||||
|
|||||||
Reference in New Issue
Block a user