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