mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-21 18:22:33 +01:00
gl: Fall back to renderpass decoder on ATI drivers
This commit is contained in:
parent
fafae1cbb5
commit
6d43fcf8fb
@ -631,13 +631,17 @@ namespace gl
|
||||
#include "../Program/GLSLSnippets/CopyBufferToGenericImage.glsl"
|
||||
;
|
||||
|
||||
const bool stencil_export_supported = gl::get_driver_caps().ARB_shader_stencil_export_supported;
|
||||
const auto& caps = gl::get_driver_caps();
|
||||
const bool stencil_export_supported = caps.ARB_shader_stencil_export_supported;
|
||||
const bool legacy_format_support = caps.subvendor_ATI;
|
||||
|
||||
std::pair<std::string_view, std::string> repl_list[] =
|
||||
{
|
||||
{ "%set, ", "" },
|
||||
{ "%loc", std::to_string(GL_COMPUTE_BUFFER_SLOT(0)) },
|
||||
{ "%push_block", fmt::format("binding=%d, std140", GL_COMPUTE_BUFFER_SLOT(1)) },
|
||||
{ "%stencil_export_supported", stencil_export_supported ? "1" : "0" }
|
||||
{ "%stencil_export_supported", stencil_export_supported ? "1" : "0" },
|
||||
{ "%legacy_format_support", legacy_format_support ? "1" : "0" }
|
||||
};
|
||||
|
||||
fs_src = fmt::replace_all(fs_src, repl_list);
|
||||
|
@ -384,6 +384,7 @@ namespace gl
|
||||
bool skip_barrier = false;
|
||||
u32 in_offset = static_cast<u32>(reinterpret_cast<u64>(src_offset));
|
||||
u32 out_offset = in_offset;
|
||||
const auto& caps = gl::get_driver_caps();
|
||||
|
||||
auto initialize_scratch_mem = [&]()
|
||||
{
|
||||
@ -409,7 +410,6 @@ namespace gl
|
||||
transfer_buf = &scratch_mem;
|
||||
};
|
||||
|
||||
const auto caps = gl::get_driver_caps();
|
||||
if ((dst->aspect() & image_aspect::stencil) == 0 || caps.ARB_shader_stencil_export_supported)
|
||||
{
|
||||
// We do not need to use the driver's builtin transport mechanism
|
||||
@ -469,18 +469,24 @@ namespace gl
|
||||
}
|
||||
|
||||
// If possible, decode using a compute transform to potentially have asynchronous scheduling
|
||||
bool use_compute_transform = (dst->aspect() == gl::image_aspect::color);
|
||||
switch (dst->get_internal_format())
|
||||
bool use_compute_transform = (
|
||||
dst->aspect() == gl::image_aspect::color && // Cannot use image_load_store with depth images
|
||||
caps.subvendor_ATI == false); // The old AMD/ATI driver does not support image writeonly without format specifier
|
||||
|
||||
if (use_compute_transform)
|
||||
{
|
||||
case texture::internal_format::bgr5a1:
|
||||
case texture::internal_format::rgb5a1:
|
||||
case texture::internal_format::rgb565:
|
||||
case texture::internal_format::rgba4:
|
||||
// Packed formats are a problem with image_load_store
|
||||
use_compute_transform = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
switch (dst->get_internal_format())
|
||||
{
|
||||
case texture::internal_format::bgr5a1:
|
||||
case texture::internal_format::rgb5a1:
|
||||
case texture::internal_format::rgb565:
|
||||
case texture::internal_format::rgba4:
|
||||
// Packed formats are a problem with image_load_store
|
||||
use_compute_transform = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (use_compute_transform)
|
||||
|
@ -32,6 +32,7 @@ namespace gl
|
||||
bool vendor_MESA = false; // requires CLIENT_STORAGE bit set for streaming buffers
|
||||
bool subvendor_RADEONSI = false;
|
||||
bool subvendor_NOUVEAU = false;
|
||||
bool subvendor_ATI = false;
|
||||
|
||||
bool check(const std::string& ext_name, const char* test)
|
||||
{
|
||||
@ -230,6 +231,7 @@ namespace gl
|
||||
else if (vendor_string.find("amd") != umax || vendor_string.find("ati") != umax)
|
||||
{
|
||||
vendor_AMD = true;
|
||||
subvendor_ATI = vendor_string.find("ati") != umax;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -3,12 +3,27 @@ R"(
|
||||
#extension GL_ARB_shader_stencil_export : enable
|
||||
|
||||
#define ENABLE_DEPTH_STENCIL_LOAD %stencil_export_supported
|
||||
#define LEGACY_FORMAT_SUPPORT %legacy_format_support
|
||||
|
||||
#define FMT_GL_DEPTH_COMPONENT16 0x81A5
|
||||
#define FMT_GL_DEPTH_COMPONENT32F 0x8CAC
|
||||
#define FMT_GL_DEPTH24_STENCIL8 0x88F0
|
||||
#define FMT_GL_DEPTH32F_STENCIL8 0x8CAD
|
||||
|
||||
#if LEGACY_FORMAT_SUPPORT
|
||||
#define FMT_GL_RGBA8 0x8058
|
||||
#define FMT_GL_BGRA8 0x80E1
|
||||
#define FMT_GL_R8 0x8229
|
||||
#define FMT_GL_R16 0x822A
|
||||
#define FMT_GL_R32F 0x822E
|
||||
#define FMT_GL_RG8 0x822B
|
||||
#define FMT_GL_RG8_SNORM 0x8F95
|
||||
#define FMT_GL_RG16 0x822C
|
||||
#define FMT_GL_RG16F 0x822F
|
||||
#define FMT_GL_RGBA16F 0x881A
|
||||
#define FMT_GL_RGBA32F 0x8814
|
||||
#endif
|
||||
|
||||
#define FMT_GL_RGB565 0x8D62
|
||||
#define FMT_GL_RGB5_A1 0x8057
|
||||
#define FMT_GL_BGR5_A1 0x99F0
|
||||
@ -144,6 +159,45 @@ void main()
|
||||
gl_FragStencilRefARB = int(utmp2.y);
|
||||
break;
|
||||
|
||||
#endif
|
||||
|
||||
#if LEGACY_FORMAT_SUPPORT
|
||||
|
||||
// Simple color. Provided for compatibility with old drivers.
|
||||
case FMT_GL_RGBA8:
|
||||
outColor = readFixed8x4(invocation_id);
|
||||
break;
|
||||
case FMT_GL_BGRA8:
|
||||
outColor = readFixed8x4(invocation_id).bgra;
|
||||
break;
|
||||
case FMT_GL_R8:
|
||||
outColor.r = readFixed8(invocation_id);
|
||||
break;
|
||||
case FMT_GL_R16:
|
||||
outColor.r = readFixed16(invocation_id);
|
||||
break;
|
||||
case FMT_GL_R32F:
|
||||
outColor.r = readFloat32(invocation_id);
|
||||
break;
|
||||
case FMT_GL_RG8:
|
||||
outColor.rg = readFixed8x2(invocation_id);
|
||||
break;
|
||||
case FMT_GL_RG8_SNORM:
|
||||
outColor.rg = readFixed8x2Snorm(invocation_id);
|
||||
break;
|
||||
case FMT_GL_RG16:
|
||||
outColor.rg = readFixed16x2(invocation_id);
|
||||
break;
|
||||
case FMT_GL_RG16F:
|
||||
outColor.rg = readFloat16x2(invocation_id);
|
||||
break;
|
||||
case FMT_GL_RGBA16F:
|
||||
outColor = readFloat16x4(invocation_id);
|
||||
break;
|
||||
case FMT_GL_RGBA32F:
|
||||
outColor = readFloat32x4(invocation_id);
|
||||
break;
|
||||
|
||||
#endif
|
||||
|
||||
// Packed color
|
||||
|
Loading…
Reference in New Issue
Block a user