@ -61,7 +61,6 @@ struct FormatTuple {
GLenum internal_format ;
GLenum format = GL_NONE ;
GLenum type = GL_NONE ;
GLenum store_format = internal_format ;
} ;
constexpr std : : array < FormatTuple , MaxPixelFormat > FORMAT_TABLE = { {
@ -114,7 +113,7 @@ constexpr std::array<FormatTuple, MaxPixelFormat> FORMAT_TABLE = {{
{ GL_RG16I , GL_RG_INTEGER , GL_SHORT } , // R16G16_SINT
{ GL_RG16_SNORM , GL_RG , GL_SHORT } , // R16G16_SNORM
{ GL_RGB32F , GL_RGB , GL_FLOAT } , // R32G32B32_FLOAT
{ GL_SRGB8_ALPHA8 , GL_RGBA , GL_UNSIGNED_INT_8_8_8_8_REV , GL_RGBA8 }, // A8B8G8R8_SRGB
{ GL_SRGB8_ALPHA8 , GL_RGBA , GL_UNSIGNED_INT_8_8_8_8_REV }, // A8B8G8R8_SRGB
{ GL_RG8 , GL_RG , GL_UNSIGNED_BYTE } , // R8G8_UNORM
{ GL_RG8_SNORM , GL_RG , GL_BYTE } , // R8G8_SNORM
{ GL_RG8I , GL_RG_INTEGER , GL_BYTE } , // R8G8_SINT
@ -126,7 +125,7 @@ constexpr std::array<FormatTuple, MaxPixelFormat> FORMAT_TABLE = {{
{ GL_COMPRESSED_RGBA_ASTC_8x8_KHR } , // ASTC_2D_8X8_UNORM
{ GL_COMPRESSED_RGBA_ASTC_8x5_KHR } , // ASTC_2D_8X5_UNORM
{ GL_COMPRESSED_RGBA_ASTC_5x4_KHR } , // ASTC_2D_5X4_UNORM
{ GL_SRGB8_ALPHA8 , GL_BGRA , GL_UNSIGNED_BYTE , GL_RGBA8 }, // B8G8R8A8_UNORM
{ GL_SRGB8_ALPHA8 , GL_BGRA , GL_UNSIGNED_BYTE }, // B8G8R8A8_UNORM
{ GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT } , // BC1_RGBA_SRGB
{ GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT } , // BC2_SRGB
{ GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT } , // BC3_SRGB
@ -651,13 +650,11 @@ Image::Image(TextureCacheRuntime& runtime, const VideoCommon::ImageInfo& info_,
if ( IsConverted ( runtime . device , info . format , info . type ) ) {
flags | = ImageFlagBits : : Converted ;
gl_internal_format = IsPixelFormatSRGB ( info . format ) ? GL_SRGB8_ALPHA8 : GL_RGBA8 ;
gl_store_format = GL_RGBA8 ;
gl_format = GL_RGBA ;
gl_type = GL_UNSIGNED_INT_8_8_8_8_REV ;
} else {
const auto & tuple = GetFormatTuple ( info . format ) ;
gl_internal_format = tuple . internal_format ;
gl_store_format = tuple . store_format ;
gl_format = tuple . format ;
gl_type = tuple . type ;
}
@ -677,23 +674,23 @@ Image::Image(TextureCacheRuntime& runtime, const VideoCommon::ImageInfo& info_,
}
switch ( target ) {
case GL_TEXTURE_1D_ARRAY :
glTextureStorage2D ( handle , num_levels , gl_ store _format, width , num_layers ) ;
glTextureStorage2D ( handle , num_levels , gl_ internal _format, width , num_layers ) ;
break ;
case GL_TEXTURE_2D_ARRAY :
glTextureStorage3D ( handle , num_levels , gl_ store _format, width , height , num_layers ) ;
glTextureStorage3D ( handle , num_levels , gl_ internal _format, width , height , num_layers ) ;
break ;
case GL_TEXTURE_2D_MULTISAMPLE_ARRAY : {
// TODO: Where should 'fixedsamplelocations' come from?
const auto [ samples_x , samples_y ] = SamplesLog2 ( info . num_samples ) ;
glTextureStorage3DMultisample ( handle , num_samples , gl_ store _format, width > > samples_x ,
glTextureStorage3DMultisample ( handle , num_samples , gl_ internal _format, width > > samples_x ,
height > > samples_y , num_layers , GL_FALSE ) ;
break ;
}
case GL_TEXTURE_RECTANGLE :
glTextureStorage2D ( handle , num_levels , gl_ store _format, width , height ) ;
glTextureStorage2D ( handle , num_levels , gl_ internal _format, width , height ) ;
break ;
case GL_TEXTURE_3D :
glTextureStorage3D ( handle , num_levels , gl_ store _format, width , height , depth ) ;
glTextureStorage3D ( handle , num_levels , gl_ internal _format, width , height , depth ) ;
break ;
case GL_TEXTURE_BUFFER :
buffer . Create ( ) ;