mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-13 14:48:32 +09:00
[Feat] (MG_Util/ShaderCompiler): extract global UBO offset from GL plain uniforms
This commit is contained in:
@@ -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;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user