mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-10 17:01:24 +12:00
gl: Use DSA for compressed texture upload
This commit is contained in:
parent
964fd1095e
commit
b97557ce7b
2 changed files with 21 additions and 15 deletions
|
@ -192,6 +192,12 @@ OPENGL_PROC(PFNGLTEXTURESUBIMAGE2DEXTPROC, TextureSubImage2DEXT);
|
||||||
OPENGL_PROC(PFNGLTEXTURESUBIMAGE2DPROC, TextureSubImage2D);
|
OPENGL_PROC(PFNGLTEXTURESUBIMAGE2DPROC, TextureSubImage2D);
|
||||||
OPENGL_PROC(PFNGLTEXTURESUBIMAGE3DEXTPROC, TextureSubImage3DEXT);
|
OPENGL_PROC(PFNGLTEXTURESUBIMAGE3DEXTPROC, TextureSubImage3DEXT);
|
||||||
OPENGL_PROC(PFNGLTEXTURESUBIMAGE3DPROC, TextureSubImage3D);
|
OPENGL_PROC(PFNGLTEXTURESUBIMAGE3DPROC, TextureSubImage3D);
|
||||||
|
OPENGL_PROC(PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC, CompressedTextureSubImage1D);
|
||||||
|
OPENGL_PROC(PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC, CompressedTextureSubImage1DEXT);
|
||||||
|
OPENGL_PROC(PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC, CompressedTextureSubImage2D);
|
||||||
|
OPENGL_PROC(PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC, CompressedTextureSubImage2DEXT);
|
||||||
|
OPENGL_PROC(PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC, CompressedTextureSubImage3D);
|
||||||
|
OPENGL_PROC(PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC, CompressedTextureSubImage3DEXT);
|
||||||
|
|
||||||
OPENGL_PROC(PFNGLCLEARBUFFERFVPROC, ClearBufferfv);
|
OPENGL_PROC(PFNGLCLEARBUFFERFVPROC, ClearBufferfv);
|
||||||
|
|
||||||
|
@ -268,9 +274,5 @@ WGL_PROC(PFNWGLSWAPINTERVALEXTPROC, SwapIntervalEXT);
|
||||||
#if !defined(__GNUG__) || defined(__MINGW32__)
|
#if !defined(__GNUG__) || defined(__MINGW32__)
|
||||||
OPENGL_PROC(PFNGLBLENDCOLORPROC, BlendColor);
|
OPENGL_PROC(PFNGLBLENDCOLORPROC, BlendColor);
|
||||||
OPENGL_PROC(PFNGLBLENDEQUATIONPROC, BlendEquation);
|
OPENGL_PROC(PFNGLBLENDEQUATIONPROC, BlendEquation);
|
||||||
OPENGL_PROC(PFNGLCOMPRESSEDTEXIMAGE2DPROC, CompressedTexImage2D);
|
|
||||||
OPENGL_PROC(PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC, CompressedTexSubImage1D);
|
|
||||||
OPENGL_PROC(PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC, CompressedTexSubImage2D);
|
|
||||||
OPENGL_PROC(PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC, CompressedTexSubImage3D);
|
|
||||||
OPENGL_PROC(PFNGLACTIVETEXTUREPROC, ActiveTexture);
|
OPENGL_PROC(PFNGLACTIVETEXTUREPROC, ActiveTexture);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -671,9 +671,6 @@ namespace gl
|
||||||
caps.supports_vtc_decoding = driver_caps.vendor_NVIDIA;
|
caps.supports_vtc_decoding = driver_caps.vendor_NVIDIA;
|
||||||
unpack_settings.apply();
|
unpack_settings.apply();
|
||||||
|
|
||||||
texture::save_binding_state save(static_cast<GLenum>(dst->get_target()));
|
|
||||||
glBindTexture(static_cast<GLenum>(dst->get_target()), dst->id());
|
|
||||||
|
|
||||||
const GLsizei format_block_size = (format == CELL_GCM_TEXTURE_COMPRESSED_DXT1) ? 8 : 16;
|
const GLsizei format_block_size = (format == CELL_GCM_TEXTURE_COMPRESSED_DXT1) ? 8 : 16;
|
||||||
|
|
||||||
for (const rsx::subresource_layout& layout : input_layouts)
|
for (const rsx::subresource_layout& layout : input_layouts)
|
||||||
|
@ -686,28 +683,35 @@ namespace gl
|
||||||
{
|
{
|
||||||
const GLsizei size = layout.width_in_block * format_block_size;
|
const GLsizei size = layout.width_in_block * format_block_size;
|
||||||
ensure(usz(size) <= staging_buffer.size());
|
ensure(usz(size) <= staging_buffer.size());
|
||||||
glCompressedTexSubImage1D(GL_TEXTURE_1D, layout.level, 0, layout.width_in_texel, gl_format, size, staging_buffer.data());
|
DSA_CALL(CompressedTextureSubImage1D, dst->id(), GL_TEXTURE_1D, layout.level, 0, layout.width_in_texel, gl_format, size, staging_buffer.data());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case texture::target::texture2D:
|
case texture::target::texture2D:
|
||||||
{
|
{
|
||||||
const GLsizei size = layout.width_in_block * layout.height_in_block * format_block_size;
|
const GLsizei size = layout.width_in_block * layout.height_in_block * format_block_size;
|
||||||
ensure(usz(size) <= staging_buffer.size());
|
ensure(usz(size) <= staging_buffer.size());
|
||||||
glCompressedTexSubImage2D(GL_TEXTURE_2D, layout.level, 0, 0, layout.width_in_texel, layout.height_in_texel, gl_format, size, staging_buffer.data());
|
DSA_CALL(CompressedTextureSubImage2D, dst->id(), GL_TEXTURE_2D, layout.level, 0, 0, layout.width_in_texel, layout.height_in_texel, gl_format, size, staging_buffer.data());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case texture::target::textureCUBE:
|
case texture::target::textureCUBE:
|
||||||
{
|
{
|
||||||
const GLsizei size = layout.width_in_block * layout.height_in_block * format_block_size;
|
const GLsizei size = layout.width_in_block * layout.height_in_block * format_block_size;
|
||||||
ensure(usz(size) <= staging_buffer.size());
|
ensure(usz(size) <= staging_buffer.size());
|
||||||
glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + layout.layer, layout.level, 0, 0, layout.width_in_texel, layout.height_in_texel, gl_format, size, staging_buffer.data());
|
if (gl::get_driver_caps().ARB_dsa_supported)
|
||||||
|
{
|
||||||
|
glCompressedTextureSubImage3D(dst->id(), layout.level, 0, 0, layout.layer, layout.width_in_texel, layout.height_in_texel, 1, gl_format, size, staging_buffer.data());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
glCompressedTextureSubImage2DEXT(dst->id(), GL_TEXTURE_CUBE_MAP_POSITIVE_X + layout.layer, layout.level, 0, 0, layout.width_in_texel, layout.height_in_texel, gl_format, size, staging_buffer.data());
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case texture::target::texture3D:
|
case texture::target::texture3D:
|
||||||
{
|
{
|
||||||
const GLsizei size = layout.width_in_block * layout.height_in_block * layout.depth * format_block_size;
|
const GLsizei size = layout.width_in_block * layout.height_in_block * layout.depth * format_block_size;
|
||||||
ensure(usz(size) <= staging_buffer.size());
|
ensure(usz(size) <= staging_buffer.size());
|
||||||
glCompressedTexSubImage3D(GL_TEXTURE_3D, layout.level, 0, 0, 0, layout.width_in_texel, layout.height_in_texel, layout.depth, gl_format, size, staging_buffer.data());
|
DSA_CALL(CompressedTextureSubImage3D, dst->id(), GL_TEXTURE_3D, layout.level, 0, 0, 0, layout.width_in_texel, layout.height_in_texel, layout.depth, gl_format, size, staging_buffer.data());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -811,22 +815,22 @@ namespace gl
|
||||||
|
|
||||||
if (op.element_size == 4) [[ likely ]]
|
if (op.element_size == 4) [[ likely ]]
|
||||||
{
|
{
|
||||||
do_deswizzle_transformation<u32, true>(cmd, block_size, compute_scratch_mem, &g_deswizzle_scratch_buffer, image_linear_size, layout.width_in_texel, layout.height_in_texel, layout.depth);
|
do_deswizzle_transformation<u32, true>(cmd, block_size, compute_scratch_mem, &g_deswizzle_scratch_buffer, static_cast<u32>(image_linear_size), layout.width_in_texel, layout.height_in_texel, layout.depth);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
do_deswizzle_transformation<u16, true>(cmd, block_size, compute_scratch_mem, &g_deswizzle_scratch_buffer, image_linear_size, layout.width_in_texel, layout.height_in_texel, layout.depth);
|
do_deswizzle_transformation<u16, true>(cmd, block_size, compute_scratch_mem, &g_deswizzle_scratch_buffer, static_cast<u32>(image_linear_size), layout.width_in_texel, layout.height_in_texel, layout.depth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (op.element_size == 4) [[ likely ]]
|
if (op.element_size == 4) [[ likely ]]
|
||||||
{
|
{
|
||||||
do_deswizzle_transformation<u32, false>(cmd, block_size, compute_scratch_mem, &g_deswizzle_scratch_buffer, image_linear_size, layout.width_in_texel, layout.height_in_texel, layout.depth);
|
do_deswizzle_transformation<u32, false>(cmd, block_size, compute_scratch_mem, &g_deswizzle_scratch_buffer, static_cast<u32>(image_linear_size), layout.width_in_texel, layout.height_in_texel, layout.depth);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
do_deswizzle_transformation<u16, false>(cmd, block_size, compute_scratch_mem, &g_deswizzle_scratch_buffer, image_linear_size, layout.width_in_texel, layout.height_in_texel, layout.depth);
|
do_deswizzle_transformation<u16, false>(cmd, block_size, compute_scratch_mem, &g_deswizzle_scratch_buffer, static_cast<u32>(image_linear_size), layout.width_in_texel, layout.height_in_texel, layout.depth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue