gl: Properly initialize memory layout definition structs

- Also refactors the upload_texture function to be a bit more readable
This commit is contained in:
kd-11
2026-03-22 22:06:44 +03:00
committed by kd-11
parent bc6e01c422
commit 5acc263b73
2 changed files with 151 additions and 152 deletions
+9 -10
View File
@@ -717,9 +717,10 @@ namespace gl
}
}
}
return;
}
else
{
std::pair<void*, u32> upload_scratch_mem = {}, compute_scratch_mem = {};
image_memory_requirements mem_info;
pixel_buffer_layout mem_layout;
@@ -779,8 +780,13 @@ namespace gl
region.height = layout.height_in_texel;
region.depth = layout.depth;
if (driver_caps.ARB_compute_shader_supported)
if (!driver_caps.ARB_compute_shader_supported)
{
unpack_settings.swap_bytes(op.require_swap);
dst->copy_from(staging_buffer, static_cast<texture::format>(gl_format), static_cast<texture::type>(gl_type), layout.level, region, unpack_settings);
continue;
}
// 0. Preconf
mem_layout.alignment = static_cast<u8>(caps.alignment);
mem_layout.swap_bytes = op.require_swap;
@@ -874,13 +880,6 @@ namespace gl
// Barrier
g_compute_decode_buffer.push_barrier(compute_scratch_mem.second, static_cast<u32>(image_linear_size));
}
else
{
unpack_settings.swap_bytes(op.require_swap);
dst->copy_from(staging_buffer, static_cast<texture::format>(gl_format), static_cast<texture::type>(gl_type), layout.level, region, unpack_settings);
}
}
}
}
std::array<GLenum, 4> apply_swizzle_remap(const std::array<GLenum, 4>& swizzle_remap, const rsx::texture_channel_remap_t& decoded_remap)
+9 -9
View File
@@ -14,20 +14,20 @@ namespace gl
{
struct pixel_buffer_layout
{
GLenum format;
GLenum type;
u32 row_length;
u8 block_size;
bool swap_bytes;
u8 alignment;
GLenum format = GL_RGBA;
GLenum type = GL_UNSIGNED_BYTE;
u32 row_length = 0;
u8 block_size = 0;
bool swap_bytes = false;
u8 alignment = 0;
u8 reserved;
};
struct image_memory_requirements
{
u64 image_size_in_texels;
u64 image_size_in_bytes;
u64 memory_required;
u64 image_size_in_texels = 0;
u64 image_size_in_bytes = 0;
u64 memory_required = 0;
};
struct clear_cmd_info