mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 14:18:31 +09:00
[Fix] (MG_Backend/DirectVulkan, trace-replay): gate R11G11B10F fallback
This commit is contained in:
@@ -445,7 +445,11 @@ jobs:
|
|||||||
|
|
||||||
- name: Retrace and validate
|
- name: Retrace and validate
|
||||||
working-directory: build-retrace/tools/trace_replay
|
working-directory: build-retrace/tools/trace_replay
|
||||||
run: ctest -V --no-tests=error -R '^MobileGLTraceReplay\.${{ matrix.case }}\.${{ matrix.backend }}$'
|
run: |
|
||||||
|
if [ '${{ matrix.backend }}' = 'DirectVulkan' ]; then
|
||||||
|
export MOBILEGL_VULKAN_R11G11B10F_FALLBACK=1
|
||||||
|
fi
|
||||||
|
ctest -V --no-tests=error -R '^MobileGLTraceReplay\.${{ matrix.case }}\.${{ matrix.backend }}$'
|
||||||
|
|
||||||
- name: Upload actual image
|
- name: Upload actual image
|
||||||
if: always()
|
if: always()
|
||||||
|
|||||||
@@ -17,8 +17,19 @@
|
|||||||
#include "MG_Util/Converters/MGToVk/TextureEnumConverter.h"
|
#include "MG_Util/Converters/MGToVk/TextureEnumConverter.h"
|
||||||
#include "MG_Util/Texture/TextureFormatProcessor.h"
|
#include "MG_Util/Texture/TextureFormatProcessor.h"
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
namespace MobileGL::MG_Backend::DirectVulkan {
|
namespace MobileGL::MG_Backend::DirectVulkan {
|
||||||
namespace {
|
namespace {
|
||||||
|
Bool IsR11G11B10FFallbackEnabled() {
|
||||||
|
static const Bool enabled = [] {
|
||||||
|
const char* value = std::getenv("MOBILEGL_VULKAN_R11G11B10F_FALLBACK");
|
||||||
|
return value != nullptr && value[0] != '\0' && std::strcmp(value, "0") != 0;
|
||||||
|
}();
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
Bool IsReleaseCurrentRequest(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx) {
|
Bool IsReleaseCurrentRequest(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx) {
|
||||||
(void)dpy;
|
(void)dpy;
|
||||||
return draw == EGL_NO_SURFACE && read == EGL_NO_SURFACE && ctx == EGL_NO_CONTEXT;
|
return draw == EGL_NO_SURFACE && read == EGL_NO_SURFACE && ctx == EGL_NO_CONTEXT;
|
||||||
@@ -142,6 +153,11 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
return TextureInternalFormat::RGBA16Snorm;
|
return TextureInternalFormat::RGBA16Snorm;
|
||||||
case TextureInternalFormat::RGB16F:
|
case TextureInternalFormat::RGB16F:
|
||||||
return TextureInternalFormat::RGBA16F;
|
return TextureInternalFormat::RGBA16F;
|
||||||
|
case TextureInternalFormat::R11FG11FB10F:
|
||||||
|
if (IsR11G11B10FFallbackEnabled()) {
|
||||||
|
return TextureInternalFormat::RGBA16F;
|
||||||
|
}
|
||||||
|
return Nullopt;
|
||||||
case TextureInternalFormat::RGB32F:
|
case TextureInternalFormat::RGB32F:
|
||||||
return TextureInternalFormat::RGBA32F;
|
return TextureInternalFormat::RGBA32F;
|
||||||
case TextureInternalFormat::RGB8I:
|
case TextureInternalFormat::RGB8I:
|
||||||
|
|||||||
@@ -46,6 +46,14 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
Uint32 arrayLayers = 1;
|
Uint32 arrayLayers = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static Bool IsR11G11B10FFallbackEnabled() {
|
||||||
|
static const Bool enabled = [] {
|
||||||
|
const char* value = std::getenv("MOBILEGL_VULKAN_R11G11B10F_FALLBACK");
|
||||||
|
return value != nullptr && value[0] != '\0' && std::strcmp(value, "0") != 0;
|
||||||
|
}();
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
static Bool IsMultisampleTextureUploadTarget(TextureUploadTarget target) {
|
static Bool IsMultisampleTextureUploadTarget(TextureUploadTarget target) {
|
||||||
return target == TextureUploadTarget::Texture2DMultisample ||
|
return target == TextureUploadTarget::Texture2DMultisample ||
|
||||||
target == TextureUploadTarget::ProxyTexture2DMultisample ||
|
target == TextureUploadTarget::ProxyTexture2DMultisample ||
|
||||||
@@ -320,6 +328,11 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
return {VK_FORMAT_R16G16B16A16_SNORM, true, 2, {0xFF, 0x7F, 0x00, 0x00}};
|
return {VK_FORMAT_R16G16B16A16_SNORM, true, 2, {0xFF, 0x7F, 0x00, 0x00}};
|
||||||
case TextureInternalFormat::RGB16F:
|
case TextureInternalFormat::RGB16F:
|
||||||
return {VK_FORMAT_R16G16B16A16_SFLOAT, true, 2, {0x00, 0x3C, 0x00, 0x00}};
|
return {VK_FORMAT_R16G16B16A16_SFLOAT, true, 2, {0x00, 0x3C, 0x00, 0x00}};
|
||||||
|
case TextureInternalFormat::R11FG11FB10F:
|
||||||
|
if (IsR11G11B10FFallbackEnabled()) {
|
||||||
|
return {VK_FORMAT_R16G16B16A16_SFLOAT, true, 2, {0x00, 0x3C, 0x00, 0x00}};
|
||||||
|
}
|
||||||
|
return {MG_Util::ConvertTextureInternalFormatToVkEnum(format), false, 0, {0, 0, 0, 0}};
|
||||||
case TextureInternalFormat::RGB32F:
|
case TextureInternalFormat::RGB32F:
|
||||||
return {VK_FORMAT_R32G32B32A32_SFLOAT, true, 4, {0x00, 0x00, 0x80, 0x3F}};
|
return {VK_FORMAT_R32G32B32A32_SFLOAT, true, 4, {0x00, 0x00, 0x80, 0x3F}};
|
||||||
case TextureInternalFormat::RGB8I:
|
case TextureInternalFormat::RGB8I:
|
||||||
|
|||||||
Reference in New Issue
Block a user