[Feat] (MG_State): Add external index getter for each object.

This commit is contained in:
BZLZHH
2025-11-01 11:18:35 +08:00
parent 8da681c720
commit 1269bc76f3
17 changed files with 61 additions and 33 deletions
@@ -9,7 +9,7 @@ namespace MobileGL {
namespace GLState {
class ProgramObject {
public:
ProgramObject(const Uint id) : m_id(id) {}
ProgramObject(const Uint externalIndex) : m_externalIndex(externalIndex) {}
bool ShaderIsAttached(SharedPtr<ShaderObject> shader);
bool AttachShader(SharedPtr<ShaderObject> shader);
SizeT DetachShader(SharedPtr<ShaderObject> shader);
@@ -78,11 +78,14 @@ namespace MobileGL {
Vector<Vector<unsigned>>& GetGeneratedSpirv() { return m_generatedSpirv; }
Uint GetExternalIndex() const { return m_externalIndex; }
private:
void DoReflection();
void GenerateBinary();
void WaitUntilGenerationCompleted();
const Uint m_id = 0;
const Uint m_externalIndex = 0;
Vector<SharedPtr<ShaderObject>> m_shaders;
SharedPtr<glslang::TProgram> m_program;
@@ -16,13 +16,14 @@ namespace MobileGL {
namespace GLState {
class ShaderObject {
public:
ShaderObject(const ShaderStage stage, const Uint id) : m_stage(stage), m_id(id) {}
ShaderObject(const ShaderStage stage, const Uint externalIndex)
: m_stage(stage), m_externalIndex(externalIndex) {}
void SetShaderSource(const String& source);
void SetShaderSource(String&& source);
void Compile();
void MarkAsDeleted();
Uint GetId() const { return m_id; }
Uint GetExternalIndex() const { return m_externalIndex; }
ShaderStage GetShaderStage() const { return m_stage; }
const String& GetShaderSource() const { return m_source; }
SharedPtr<glslang::TShader> GetCompiledShader() const { return m_shader; }
@@ -32,7 +33,7 @@ namespace MobileGL {
Bool GetDeleteStatus() const { return m_deleteStatus; }
private:
const Uint m_id = 0;
const Uint m_externalIndex = 0;
const ShaderStage m_stage;
String m_source;
SharedPtr<glslang::TShader> m_shader;