Feature detection fixes

This commit is contained in:
Henrik Rydgård 2022-08-05 14:18:22 +02:00
parent 4e3c258140
commit 81c36578ca
7 changed files with 19 additions and 21 deletions

View file

@ -266,6 +266,7 @@ D3D11DrawContext::D3D11DrawContext(ID3D11Device *device, ID3D11DeviceContext *de
caps_.framebufferDepthCopySupported = true;
caps_.framebufferSeparateDepthCopySupported = false; // Though could be emulated with a draw.
caps_.texture3DSupported = true;
caps_.fragmentShaderInt32Supported = true;
D3D11_FEATURE_DATA_D3D11_OPTIONS options{};
HRESULT result = device_->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS, &options, sizeof(options));

View file

@ -526,8 +526,17 @@ OpenGLContext::OpenGLContext() {
} else {
caps_.preferredDepthBufferFormat = DataFormat::D16;
}
if (gl_extensions.GLES3) {
// Mali reports 30 but works fine...
if (gl_extensions.range[1][5][1] >= 30) {
caps_.fragmentShaderInt32Supported = true;
}
}
caps_.texture3DSupported = gl_extensions.OES_texture_3D;
} else {
if (gl_extensions.VersionGEThan(3, 3, 0)) {
caps_.fragmentShaderInt32Supported = true;
}
caps_.preferredDepthBufferFormat = DataFormat::D24_S8;
caps_.texture3DSupported = true;
}

View file

@ -791,6 +791,7 @@ VKContext::VKContext(VulkanContext *vulkan, bool splitSubmit)
caps_.framebufferSeparateDepthCopySupported = true; // Will pretty much always be the case.
caps_.preferredDepthBufferFormat = DataFormat::D24_S8; // TODO: Ask vulkan.
caps_.texture3DSupported = true;
caps_.fragmentShaderInt32Supported = true;
auto deviceProps = vulkan->GetPhysicalDeviceProperties(vulkan_->GetCurrentPhysicalDeviceIndex()).properties;
switch (deviceProps.vendorID) {

View file

@ -539,6 +539,7 @@ struct DeviceCaps {
bool framebufferStencilBlitSupported;
bool framebufferFetchSupported;
bool texture3DSupported;
bool fragmentShaderInt32Supported;
std::string deviceName; // The device name to use when creating the thin3d context, to get the same one.
};

View file

@ -1849,8 +1849,8 @@ void TextureCacheCommon::ApplyTextureFramebuffer(VirtualFramebuffer *framebuffer
bool need_depalettize = IsClutFormat(texFormat);
bool depth = channel == NOTIFY_FB_DEPTH;
bool useShaderDepal = framebufferManager_->GetCurrentRenderVFB() != framebuffer && (gstate_c.Supports(GPU_SUPPORTS_GLSL_ES_300) || gstate_c.Supports(GPU_SUPPORTS_GLSL_330)) && !depth;
if (!gstate_c.Supports(GPU_SUPPORTS_32BIT_INT_FSHADER)) {
bool useShaderDepal = framebufferManager_->GetCurrentRenderVFB() != framebuffer && !depth;
if (!draw_->GetDeviceCaps().fragmentShaderInt32Supported) {
useShaderDepal = false;
depth = false; // Can't support this
}
@ -1893,6 +1893,7 @@ void TextureCacheCommon::ApplyTextureFramebuffer(VirtualFramebuffer *framebuffer
Draw::Texture *clutTexture = depalShaderCache_->GetClutTexture(clutFormat, clutHash_, clutBufRaw_);
Draw::Framebuffer *depalFBO = framebufferManager_->GetTempFBO(TempFBO::DEPAL, framebuffer->renderWidth, framebuffer->renderHeight);
draw_->BindTexture(0, nullptr);
draw_->BindTexture(1, nullptr);
draw_->BindFramebufferAsRenderTarget(depalFBO, { Draw::RPAction::DONT_CARE, Draw::RPAction::DONT_CARE, Draw::RPAction::DONT_CARE }, "Depal");
draw_->SetScissorRect(0, 0, (int)framebuffer->renderWidth, (int)framebuffer->renderHeight);
@ -1910,7 +1911,7 @@ void TextureCacheCommon::ApplyTextureFramebuffer(VirtualFramebuffer *framebuffer
draw_->BindTexture(1, clutTexture);
shaderApply.Shade();
draw_->BindTexture(0, nullptr);
framebufferManager_->RebindFramebuffer("ApplyTextureFramebuffer");
draw_->BindFramebufferAsTexture(depalFBO, 0, Draw::FB_COLOR_BIT, 0);

View file

@ -160,24 +160,9 @@ void GPU_GLES::CheckGPUFeatures() {
}
}
if (gl_extensions.IsGLES) {
if (gl_extensions.GLES3) {
features |= GPU_SUPPORTS_GLSL_ES_300;
// Mali reports 30 but works fine...
if (gl_extensions.range[1][5][1] >= 30) {
features |= GPU_SUPPORTS_32BIT_INT_FSHADER;
}
}
} else {
if (gl_extensions.VersionGEThan(3, 3, 0)) {
features |= GPU_SUPPORTS_GLSL_330;
features |= GPU_SUPPORTS_32BIT_INT_FSHADER;
}
}
if (gl_extensions.EXT_shader_framebuffer_fetch || gl_extensions.ARM_shader_framebuffer_fetch) {
// This has caused problems in the past. Let's only enable on GLES3.
if (features & GPU_SUPPORTS_GLSL_ES_300) {
if (gl_extensions.GLES3) {
features |= GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH;
}
}

View file

@ -463,7 +463,7 @@ struct UVScale {
// Might want to move this mechanism into the backend later.
enum {
GPU_SUPPORTS_DUALSOURCE_BLEND = FLAG_BIT(0),
GPU_SUPPORTS_GLSL_ES_300 = FLAG_BIT(1),
// Free bit: 1
GPU_SUPPORTS_GLSL_330 = FLAG_BIT(2),
GPU_SUPPORTS_VS_RANGE_CULLING = FLAG_BIT(3),
GPU_SUPPORTS_BLEND_MINMAX = FLAG_BIT(4),
@ -476,7 +476,7 @@ enum {
GPU_SUPPORTS_TEXTURE_FLOAT = FLAG_BIT(12),
GPU_SUPPORTS_16BIT_FORMATS = FLAG_BIT(13),
GPU_SUPPORTS_DEPTH_CLAMP = FLAG_BIT(14),
GPU_SUPPORTS_32BIT_INT_FSHADER = FLAG_BIT(15),
// Free bit: 15
GPU_SUPPORTS_DEPTH_TEXTURE = FLAG_BIT(16),
GPU_SUPPORTS_ACCURATE_DEPTH = FLAG_BIT(17),
// Free bits: 18-19