gl: Properly initialize memory layout definition structs
- Also refactors the upload_texture function to be a bit more readable
This commit is contained in:
@@ -717,9 +717,10 @@ namespace gl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
std::pair<void*, u32> upload_scratch_mem = {}, compute_scratch_mem = {};
|
std::pair<void*, u32> upload_scratch_mem = {}, compute_scratch_mem = {};
|
||||||
image_memory_requirements mem_info;
|
image_memory_requirements mem_info;
|
||||||
pixel_buffer_layout mem_layout;
|
pixel_buffer_layout mem_layout;
|
||||||
@@ -779,8 +780,13 @@ namespace gl
|
|||||||
region.height = layout.height_in_texel;
|
region.height = layout.height_in_texel;
|
||||||
region.depth = layout.depth;
|
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
|
// 0. Preconf
|
||||||
mem_layout.alignment = static_cast<u8>(caps.alignment);
|
mem_layout.alignment = static_cast<u8>(caps.alignment);
|
||||||
mem_layout.swap_bytes = op.require_swap;
|
mem_layout.swap_bytes = op.require_swap;
|
||||||
@@ -874,13 +880,6 @@ namespace gl
|
|||||||
// Barrier
|
// Barrier
|
||||||
g_compute_decode_buffer.push_barrier(compute_scratch_mem.second, static_cast<u32>(image_linear_size));
|
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)
|
std::array<GLenum, 4> apply_swizzle_remap(const std::array<GLenum, 4>& swizzle_remap, const rsx::texture_channel_remap_t& decoded_remap)
|
||||||
|
|||||||
@@ -14,20 +14,20 @@ namespace gl
|
|||||||
{
|
{
|
||||||
struct pixel_buffer_layout
|
struct pixel_buffer_layout
|
||||||
{
|
{
|
||||||
GLenum format;
|
GLenum format = GL_RGBA;
|
||||||
GLenum type;
|
GLenum type = GL_UNSIGNED_BYTE;
|
||||||
u32 row_length;
|
u32 row_length = 0;
|
||||||
u8 block_size;
|
u8 block_size = 0;
|
||||||
bool swap_bytes;
|
bool swap_bytes = false;
|
||||||
u8 alignment;
|
u8 alignment = 0;
|
||||||
u8 reserved;
|
u8 reserved;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct image_memory_requirements
|
struct image_memory_requirements
|
||||||
{
|
{
|
||||||
u64 image_size_in_texels;
|
u64 image_size_in_texels = 0;
|
||||||
u64 image_size_in_bytes;
|
u64 image_size_in_bytes = 0;
|
||||||
u64 memory_required;
|
u64 memory_required = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct clear_cmd_info
|
struct clear_cmd_info
|
||||||
|
|||||||
Reference in New Issue
Block a user