[Feat] (MG_Impl/Texture, MG_State/TextureState, MG_Impl/Framebuffer, MG_Test/Texture): implement multisample frontend state

This commit is contained in:
BZLZHH
2026-06-10 01:37:59 +08:00
parent 3da0b1dfd4
commit c499480692
11 changed files with 362 additions and 16 deletions
@@ -139,6 +139,22 @@ namespace MobileGL {
return m_textureParamsVersion;
}
Int TextureObjectBase::GetSamples() const {
return m_samples;
}
void TextureObjectBase::SetSamples(Int samples) {
m_samples = samples;
}
Bool TextureObjectBase::HasFixedSampleLocations() const {
return m_fixedSampleLocations;
}
void TextureObjectBase::SetFixedSampleLocations(Bool fixedSampleLocations) {
m_fixedSampleLocations = fixedSampleLocations;
}
Uint TextureObjectWithOneMipmap::GetMipmapLevelCount() const {
return m_textureStorage.GetLevelCount();
}
@@ -40,6 +40,10 @@ namespace MobileGL::MG_State::GLState {
virtual void SetBaseLevel(Uint baseLevel) = 0;
virtual void SetMaxLevel(Uint maxLevel) = 0;
virtual Uint16 GetTextureParamsVersion() const = 0;
virtual Int GetSamples() const = 0;
virtual void SetSamples(Int samples) = 0;
virtual Bool HasFixedSampleLocations() const = 0;
virtual void SetFixedSampleLocations(Bool fixedSampleLocations) = 0;
protected:
virtual Uint GetIndexOfTextureUploadTarget(TextureUploadTarget target) const = 0;
@@ -67,6 +71,10 @@ namespace MobileGL::MG_State::GLState {
void SetBaseLevel(Uint baseLevel) override;
void SetMaxLevel(Uint maxLevel) override;
Uint16 GetTextureParamsVersion() const override;
Int GetSamples() const override;
void SetSamples(Int samples) override;
Bool HasFixedSampleLocations() const override;
void SetFixedSampleLocations(Bool fixedSampleLocations) override;
protected:
const Uint m_externalIndex;
@@ -78,6 +86,8 @@ namespace MobileGL::MG_State::GLState {
TextureSwizzleParam::Blue, TextureSwizzleParam::Alpha};
UintVec2 m_levelRange = {0, 1000};
Uint16 m_textureParamsVersion = 0;
Int m_samples = 0;
Bool m_fixedSampleLocations = true;
};
class TextureObjectMipmap : public TextureObjectBase {
@@ -15,12 +15,11 @@ namespace MobileGL {
namespace GLState {
/* These texture types are not yet implemented:
* TextureRectangle,
* Texture2DMultisample,
* TextureBuffer,
* Texture1DArray,
* Texture2DArray,
* TextureCubeMapArray,
* Texture2DMultisampleArray
* Texture2DMultisampleArray layered attachment behavior
*/
#define STUB_TEXTURE_OBJECT_CLASS_DEFINITION(className, texTarget, uploadTargets) \
class className : public TextureObjectWithOneMipmap { \
@@ -58,4 +57,4 @@ namespace MobileGL {
} // namespace GLState
} // namespace MG_State
} // namespace MobileGL
} // namespace MobileGL
@@ -57,7 +57,7 @@ namespace MobileGL::MG_State::GLState {
textureObject = MakeShared<TextureObjectBuffer>(index);
break;
// These texture types are stubbed:
// These texture types are still stubbed:
case TextureTarget::TextureRectangle:
textureObject = MakeShared<TextureObjectRectangle>(index);
break;