[Feat] (MG_Util/ShaderCompiler): extract global UBO offset from GL plain uniforms

This commit is contained in:
2025-08-08 13:46:08 +08:00
parent fcd52a9177
commit 916fdf40af
5 changed files with 81 additions and 22 deletions
@@ -7,9 +7,25 @@
#pragma once
#define SPVC_CHK_INIT \
auto __r = SPVC_SUCCESS;
#define SPVC_CHK_RESULT(res) \
__r = res; \
if (__r != SPVC_SUCCESS) { \
return __r; \
}
#define SPVC_CHK_RETURN \
return __r;
namespace MobileGL {
namespace MG_Util {
namespace ShaderTranspiler {
struct SpvcMetadata {
UnorderedMap<String, unsigned> plainUniformOffsetsInUBO;
};
class SpvcSession {
public:
SpvcSession() {}
@@ -29,15 +45,21 @@ namespace ShaderTranspiler {
spvc_result CreateOptions(spvc_compiler_options *options);
spvc_result SetOptions(spvc_compiler_options options);
Vector<InterfaceVariable> GetShaderInterface(spvc_resource_type resource_type) const;
spvc_result Compile(const char** result) const;
spvc_result Compile(const char** result);
const SpvcMetadata& GetMetadata() const;
const char* GetLastErrorString() const;
private:
// Should be called once, and only once, for every SPIR-V binary
spvc_result ParseMetaData();
spvc_context context = nullptr;
spvc_parsed_ir ir = nullptr;
spvc_compiler compiler = nullptr;
spvc_compiler_options compiler_options = nullptr;
spvc_resources resources = nullptr;
SpvcMetadata metadata;
};
}
}