mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-06 00:40:11 +00:00
gl: Implement row alignment in CopyBufferToImage routines
This commit is contained in:
parent
9cc15be7f2
commit
1483941bea
@ -373,16 +373,16 @@ namespace gl
|
||||
|
||||
void cs_ssbo_to_color_image::run(gl::command_context& cmd, const buffer* src, const texture_view* dst, const u32 src_offset, const coordu& dst_region, const pixel_buffer_layout& layout)
|
||||
{
|
||||
const auto row_pitch = static_cast<u32>(dst_region.width);
|
||||
const u32 bpp = dst->image()->pitch() / dst->image()->width();
|
||||
const u32 row_length = utils::align(dst_region.width * bpp, std::max<int>(layout.alignment, 1)) / bpp;
|
||||
|
||||
m_program.uniforms["swap_bytes"] = layout.swap_bytes;
|
||||
m_program.uniforms["src_pitch"] = row_pitch;
|
||||
m_program.uniforms["src_pitch"] = row_length;
|
||||
m_program.uniforms["format"] = static_cast<GLenum>(dst->image()->get_internal_format());
|
||||
m_program.uniforms["region_offset"] = color2i(dst_region.x, dst_region.y);
|
||||
m_program.uniforms["region_size"] = color2i(dst_region.width, dst_region.height);
|
||||
|
||||
src->bind_range(gl::buffer::target::ssbo, GL_COMPUTE_BUFFER_SLOT(0), src_offset, row_pitch * bpp * dst_region.height);
|
||||
src->bind_range(gl::buffer::target::ssbo, GL_COMPUTE_BUFFER_SLOT(0), src_offset, row_length * bpp * dst_region.height);
|
||||
glBindImageTexture(GL_COMPUTE_IMAGE_SLOT(0), dst->id(), 0, GL_FALSE, 0, GL_WRITE_ONLY, dst->view_format());
|
||||
|
||||
const int num_invocations = utils::aligned_div(dst_region.width * dst_region.height, optimal_kernel_size);
|
||||
|
@ -621,8 +621,8 @@ namespace gl
|
||||
const u32 src_offset, const coordu& dst_region,
|
||||
const pixel_buffer_layout& layout)
|
||||
{
|
||||
const u32 row_length = static_cast<u32>(dst_region.width);
|
||||
const u32 bpp = dst->image()->pitch() / dst->image()->width();
|
||||
const u32 row_length = utils::align(dst_region.width * bpp, std::max<int>(layout.alignment, 1)) / bpp;
|
||||
|
||||
program_handle.uniforms["src_pitch"] = row_length;
|
||||
program_handle.uniforms["swap_bytes"] = layout.swap_bytes;
|
||||
|
@ -856,6 +856,7 @@ namespace gl
|
||||
if (driver_caps.ARB_compute_shader_supported)
|
||||
{
|
||||
// 0. Preconf
|
||||
mem_layout.alignment = caps.alignment;
|
||||
mem_layout.swap_bytes = op.require_swap;
|
||||
mem_layout.format = gl_format;
|
||||
mem_layout.type = gl_type;
|
||||
|
@ -21,6 +21,7 @@ namespace gl
|
||||
GLenum type;
|
||||
u8 size;
|
||||
bool swap_bytes;
|
||||
u8 alignment;
|
||||
};
|
||||
|
||||
struct image_memory_requirements
|
||||
|
Loading…
x
Reference in New Issue
Block a user