2020-12-05 13:08:24 +01:00
|
|
|
#pragma once
|
2019-05-11 10:58:45 +02:00
|
|
|
|
|
|
|
|
#include "OpenGL.h"
|
2016-03-30 18:55:43 +02:00
|
|
|
#include "../GCM.h"
|
2017-09-08 16:52:13 +02:00
|
|
|
#include "../Common/TextureUtils.h"
|
2018-04-07 17:16:52 +02:00
|
|
|
#include "GLHelpers.h"
|
2015-12-21 03:14:56 +01:00
|
|
|
|
2020-12-22 16:04:08 +01:00
|
|
|
#include <unordered_map>
|
|
|
|
|
|
2015-12-21 03:14:56 +01:00
|
|
|
namespace rsx
|
|
|
|
|
{
|
2016-06-28 11:58:44 +02:00
|
|
|
class vertex_texture;
|
2016-09-19 03:25:49 +02:00
|
|
|
class fragment_texture;
|
2017-03-29 21:27:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace gl
|
|
|
|
|
{
|
2019-10-02 02:47:19 +02:00
|
|
|
struct pixel_buffer_layout
|
|
|
|
|
{
|
|
|
|
|
GLenum format;
|
|
|
|
|
GLenum type;
|
|
|
|
|
u8 size;
|
|
|
|
|
bool swap_bytes;
|
2022-07-12 23:17:50 +02:00
|
|
|
u8 alignment;
|
2019-10-02 02:47:19 +02:00
|
|
|
};
|
|
|
|
|
|
2020-09-06 17:17:08 +02:00
|
|
|
struct image_memory_requirements
|
|
|
|
|
{
|
|
|
|
|
u64 image_size_in_texels;
|
|
|
|
|
u64 image_size_in_bytes;
|
|
|
|
|
u64 memory_required;
|
|
|
|
|
};
|
|
|
|
|
|
2023-04-19 02:09:41 +02:00
|
|
|
struct clear_cmd_info
|
|
|
|
|
{
|
|
|
|
|
GLbitfield aspect_mask = 0;
|
|
|
|
|
|
|
|
|
|
struct
|
|
|
|
|
{
|
2023-04-19 02:44:39 +02:00
|
|
|
f32 value;
|
2023-04-19 02:09:41 +02:00
|
|
|
}
|
2023-04-19 02:44:39 +02:00
|
|
|
clear_depth{};
|
2023-04-19 02:09:41 +02:00
|
|
|
|
|
|
|
|
struct
|
|
|
|
|
{
|
2023-04-19 02:44:39 +02:00
|
|
|
u8 mask;
|
|
|
|
|
u8 value;
|
2023-04-19 02:09:41 +02:00
|
|
|
}
|
2023-04-19 02:44:39 +02:00
|
|
|
clear_stencil{};
|
2023-04-19 02:09:41 +02:00
|
|
|
|
2023-04-19 02:44:39 +02:00
|
|
|
struct
|
|
|
|
|
{
|
|
|
|
|
u32 mask;
|
|
|
|
|
u8 attachment_count;
|
|
|
|
|
u8 r;
|
|
|
|
|
u8 g;
|
|
|
|
|
u8 b;
|
|
|
|
|
u8 a;
|
2023-04-19 02:09:41 +02:00
|
|
|
}
|
2023-04-19 02:44:39 +02:00
|
|
|
clear_color{};
|
2023-04-19 02:09:41 +02:00
|
|
|
};
|
|
|
|
|
|
2018-01-31 17:11:03 +01:00
|
|
|
GLenum get_target(rsx::texture_dimension_extended type);
|
2019-06-08 08:22:09 +02:00
|
|
|
GLenum get_sized_internal_format(u32 texture_format);
|
2017-03-29 21:27:29 +02:00
|
|
|
std::tuple<GLenum, GLenum> get_format_type(u32 texture_format);
|
2019-10-02 02:47:19 +02:00
|
|
|
pixel_buffer_layout get_format_type(texture::internal_format format);
|
2017-12-07 13:08:11 +01:00
|
|
|
std::array<GLenum, 4> get_swizzle_remap(u32 texture_format);
|
2017-03-29 21:27:29 +02:00
|
|
|
|
2018-07-17 18:42:51 +02:00
|
|
|
viewable_image* create_texture(u32 gcm_format, u16 width, u16 height, u16 depth, u16 mipmaps, rsx::texture_dimension_extended type);
|
2017-09-08 16:52:13 +02:00
|
|
|
|
2022-01-25 19:53:53 +01:00
|
|
|
bool formats_are_bitcast_compatible(const texture* texture1, const texture* texture2);
|
2022-05-26 00:50:42 +02:00
|
|
|
void copy_typeless(gl::command_context& cmd, texture* dst, const texture* src, const coord3u& dst_region, const coord3u& src_region);
|
|
|
|
|
void copy_typeless(gl::command_context& cmd, texture* dst, const texture* src);
|
2019-10-12 00:05:05 +02:00
|
|
|
|
2022-05-26 00:50:42 +02:00
|
|
|
void* copy_image_to_buffer(gl::command_context& cmd, const pixel_buffer_layout& pack_info, const gl::texture* src, gl::buffer* dst,
|
2022-06-02 21:20:20 +02:00
|
|
|
u32 dst_offset, const int src_level, const coord3u& src_region, image_memory_requirements* mem_info);
|
2020-09-06 17:17:08 +02:00
|
|
|
|
2022-05-26 00:50:42 +02:00
|
|
|
void copy_buffer_to_image(gl::command_context& cmd, const pixel_buffer_layout& unpack_info, gl::buffer* src, gl::texture* dst,
|
2020-09-06 17:17:08 +02:00
|
|
|
const void* src_offset, const int dst_level, const coord3u& dst_region, image_memory_requirements* mem_info);
|
|
|
|
|
|
2022-05-26 00:50:42 +02:00
|
|
|
void upload_texture(gl::command_context& cmd, texture* dst, u32 gcm_format, bool is_swizzled, const std::vector<rsx::subresource_layout>& subresources_layout);
|
2017-09-08 16:52:13 +02:00
|
|
|
|
2023-04-19 02:09:41 +02:00
|
|
|
void clear_attachments(gl::command_context& cmd, const clear_cmd_info& info);
|
|
|
|
|
|
2021-06-05 16:27:03 +02:00
|
|
|
namespace debug
|
|
|
|
|
{
|
|
|
|
|
extern std::unique_ptr<texture> g_vis_texture;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-27 19:02:45 +02:00
|
|
|
void destroy_global_texture_resources();
|
2017-03-29 21:27:29 +02:00
|
|
|
}
|