mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-13 06:38:31 +09:00
[Fix] (MG_Backend/DirectVulkan): fix Voxy subgroup and indirect draw sync
- Implement Vulkan subgroup capability querying and expose KHR subgroup getter values. - Fix DirectVulkan memory barriers so GL_COMMAND_BARRIER_BIT makes generated indirect draw commands visible. - Keep Voxy on the DirectVulkan gpu_shader_int64 quad decode path while filtering unsupported optional int64 usage on backends that do not advertise it. - Add MG_Test coverage for subgroup getters, Voxy subgroup/int64 shader probes, command barrier mapping, and indirect draw command layout. - Check for whether driver supports shader subgroup operation, disable on demand, and provide env var `MOBILEGL_DISABLE_SUBGROUP` to explicitly disable subgroup features
This commit is contained in:
@@ -76,12 +76,12 @@ namespace MobileGL::MG_Impl::GLImpl {
|
||||
MGLOG_D("shadingLanguageVersion: %s", shadingLanguageVersion.c_str());
|
||||
return (const GLubyte*)shadingLanguageVersion.c_str();
|
||||
case GL_EXTENSIONS:
|
||||
if (extensionsString.empty()) {
|
||||
for (auto& ext : rendererInfo.RendererGLInfo.Extensions) {
|
||||
extensionsString += MG_Util::ConvertGLExtToString(ext);
|
||||
extensionsString.clear();
|
||||
for (auto& ext : rendererInfo.RendererGLInfo.Extensions) {
|
||||
if (!extensionsString.empty()) {
|
||||
extensionsString += " ";
|
||||
}
|
||||
extensionsString.pop_back();
|
||||
extensionsString += MG_Util::ConvertGLExtToString(ext);
|
||||
}
|
||||
return (const GLubyte*)extensionsString.c_str();
|
||||
default:
|
||||
@@ -108,13 +108,10 @@ namespace MobileGL::MG_Impl::GLImpl {
|
||||
}
|
||||
|
||||
static Vector<String> extStrings;
|
||||
static Bool initialized = false;
|
||||
if (!initialized) {
|
||||
extStrings.reserve(exts.size());
|
||||
for (const auto& ext : exts) {
|
||||
extStrings.emplace_back(MG_Util::ConvertGLExtToString(ext));
|
||||
}
|
||||
initialized = true;
|
||||
extStrings.clear();
|
||||
extStrings.reserve(exts.size());
|
||||
for (const auto& ext : exts) {
|
||||
extStrings.emplace_back(MG_Util::ConvertGLExtToString(ext));
|
||||
}
|
||||
|
||||
return (const GLubyte*)extStrings[index].c_str();
|
||||
@@ -174,6 +171,15 @@ namespace MobileGL::MG_Impl::GLImpl {
|
||||
*data = static_cast<GLint64>(MG_Backend::DynamicBackendParameters{}.MaxShaderStorageBlockSize);
|
||||
}
|
||||
return;
|
||||
case GL_SUBGROUP_SIZE_KHR:
|
||||
case GL_SUBGROUP_SUPPORTED_STAGES_KHR:
|
||||
case GL_SUBGROUP_SUPPORTED_FEATURES_KHR:
|
||||
case GL_SUBGROUP_QUAD_ALL_STAGES_KHR: {
|
||||
GLint params = 0;
|
||||
GetIntegerv(pname, ¶ms);
|
||||
*data = static_cast<GLint64>(params);
|
||||
return;
|
||||
}
|
||||
default:
|
||||
*data = 0;
|
||||
MG_State::pGLContext->RecordError(
|
||||
@@ -200,6 +206,7 @@ namespace MobileGL::MG_Impl::GLImpl {
|
||||
return;
|
||||
}
|
||||
const auto& rendererInfo = activeBackendObject->GetRendererInfo();
|
||||
const auto& dynamicParameters = activeBackendObject->GetDynamicParameters();
|
||||
|
||||
switch (pname) {
|
||||
case GL_ACTIVE_TEXTURE:
|
||||
@@ -277,6 +284,18 @@ namespace MobileGL::MG_Impl::GLImpl {
|
||||
case GL_COMPRESSED_TEXTURE_FORMATS:
|
||||
*params = 0; // TODO
|
||||
break;
|
||||
case GL_SUBGROUP_SIZE_KHR:
|
||||
*params = static_cast<GLint>(dynamicParameters.SubgroupSize);
|
||||
break;
|
||||
case GL_SUBGROUP_SUPPORTED_STAGES_KHR:
|
||||
*params = static_cast<GLint>(dynamicParameters.SubgroupSupportedStages);
|
||||
break;
|
||||
case GL_SUBGROUP_SUPPORTED_FEATURES_KHR:
|
||||
*params = static_cast<GLint>(dynamicParameters.SubgroupSupportedFeatures);
|
||||
break;
|
||||
case GL_SUBGROUP_QUAD_ALL_STAGES_KHR:
|
||||
*params = dynamicParameters.SubgroupQuadOperationsInAllStages ? GL_TRUE : GL_FALSE;
|
||||
break;
|
||||
case GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS:
|
||||
*params = 16; // TODO: use backend value
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user