diff --git a/rpcs3/Emu/RSX/Common/texture_cache.h b/rpcs3/Emu/RSX/Common/texture_cache.h index 59176a8ca5..84d6025a52 100644 --- a/rpcs3/Emu/RSX/Common/texture_cache.h +++ b/rpcs3/Emu/RSX/Common/texture_cache.h @@ -42,12 +42,12 @@ namespace rsx rsx::texture_dimension_extended image_type = rsx::texture_dimension_extended::texture_dimension_2d; rsx::texture_sampler_status sampler_status = rsx::texture_sampler_status::status_uninitialized; - bool matches(const u32 rsx_address, const u32 rsx_size) + bool matches(u32 rsx_address, u32 rsx_size) { return rsx::buffered_section::matches(rsx_address, rsx_size); } - bool matches(const u32 rsx_address, const u32 width, const u32 height, const u32 depth, const u32 mipmaps) + bool matches(u32 rsx_address, u32 width, u32 height, u32 depth, u32 mipmaps) { if (rsx_address == cpu_address_base) { @@ -72,22 +72,22 @@ namespace rsx return false; } - void set_view_flags(const rsx::texture_create_flags flags) + void set_view_flags(rsx::texture_create_flags flags) { view_flags = flags; } - void set_context(const rsx::texture_upload_context upload_context) + void set_context(rsx::texture_upload_context upload_context) { context = upload_context; } - void set_image_type(const rsx::texture_dimension_extended type) + void set_image_type(rsx::texture_dimension_extended type) { image_type = type; } - void set_sampler_status(const rsx::texture_sampler_status status) + void set_sampler_status(rsx::texture_sampler_status status) { sampler_status = status; } @@ -223,7 +223,7 @@ namespace rsx sampled_image_descriptor() {} - sampled_image_descriptor(image_view_type handle, const texture_upload_context ctx, const bool is_depth, const f32 x_scale, const f32 y_scale, const rsx::texture_dimension_extended type) + sampled_image_descriptor(image_view_type handle, texture_upload_context ctx, bool is_depth, f32 x_scale, f32 y_scale, rsx::texture_dimension_extended type) { image_handle = handle; upload_context = ctx; @@ -234,7 +234,7 @@ namespace rsx } sampled_image_descriptor(image_resource_type external_handle, u32 base_address, u32 gcm_format, u16 x_offset, u16 y_offset, u16 width, u16 height, - const texture_upload_context ctx, const bool is_depth, const f32 x_scale, const f32 y_scale, const rsx::texture_dimension_extended type) + texture_upload_context ctx, bool is_depth, f32 x_scale, f32 y_scale, rsx::texture_dimension_extended type) { external_subresource_desc = { external_handle, base_address, gcm_format, x_offset, y_offset, width, height }; @@ -283,14 +283,14 @@ namespace rsx virtual void free_texture_section(section_storage_type&) = 0; virtual image_view_type create_temporary_subresource_view(commandbuffer_type&, image_resource_type* src, u32 gcm_format, u16 x, u16 y, u16 w, u16 h) = 0; virtual image_view_type create_temporary_subresource_view(commandbuffer_type&, image_storage_type* src, u32 gcm_format, u16 x, u16 y, u16 w, u16 h) = 0; - virtual section_storage_type* create_new_texture(commandbuffer_type&, u32 rsx_address, u32 rsx_size, u16 width, u16 height, u16 depth, u16 mipmaps, const u32 gcm_format, - const rsx::texture_upload_context context, const rsx::texture_dimension_extended type, const texture_create_flags flags, const std::pair, std::array>& remap_vector) = 0; - virtual section_storage_type* upload_image_from_cpu(commandbuffer_type&, u32 rsx_address, u16 width, u16 height, u16 depth, u16 mipmaps, u16 pitch, const u32 gcm_format, const texture_upload_context context, - std::vector& subresource_layout, const rsx::texture_dimension_extended type, const bool swizzled, const std::pair, std::array>& remap_vector) = 0; - virtual void enforce_surface_creation_type(section_storage_type& section, const u32 gcm_format, const texture_create_flags expected) = 0; + virtual section_storage_type* create_new_texture(commandbuffer_type&, u32 rsx_address, u32 rsx_size, u16 width, u16 height, u16 depth, u16 mipmaps, u32 gcm_format, + rsx::texture_upload_context context, rsx::texture_dimension_extended type, texture_create_flags flags, const std::pair, std::array>& remap_vector) = 0; + virtual section_storage_type* upload_image_from_cpu(commandbuffer_type&, u32 rsx_address, u16 width, u16 height, u16 depth, u16 mipmaps, u16 pitch, u32 gcm_format, texture_upload_context context, + const std::vector& subresource_layout, rsx::texture_dimension_extended type, bool swizzled, const std::pair, std::array>& remap_vector) = 0; + virtual void enforce_surface_creation_type(section_storage_type& section, u32 gcm_format, texture_create_flags expected) = 0; virtual void set_up_remap_vector(section_storage_type& section, const std::pair, std::array>& remap_vector) = 0; virtual void insert_texture_barrier() = 0; - virtual image_view_type generate_cubemap_from_images(commandbuffer_type&, const u32 gcm_format, u16 size, std::array& sources) = 0; + virtual image_view_type generate_cubemap_from_images(commandbuffer_type&, u32 gcm_format, u16 size, const std::array& sources) = 0; constexpr u32 get_block_size() const { return 0x1000000; } inline u32 get_block_address(u32 address) const { return (address & ~0xFFFFFF); } @@ -539,7 +539,7 @@ namespace rsx return {}; } - inline bool is_hw_blit_engine_compatible(const u32 format) const + inline bool is_hw_blit_engine_compatible(u32 format) const { switch (format) { @@ -633,7 +633,7 @@ namespace rsx ~texture_cache() {} virtual void destroy() = 0; - virtual bool is_depth_texture(const u32, const u32) = 0; + virtual bool is_depth_texture(u32, u32) = 0; virtual void on_frame_end() = 0; std::vector find_texture_from_range(u32 rsx_address, u32 range) @@ -752,7 +752,7 @@ namespace rsx return m_cache[block_address].data.back(); } - section_storage_type* find_flushable_section(const u32 address, const u32 range) + section_storage_type* find_flushable_section(u32 address, u32 range) { auto found = m_cache.find(get_block_address(address)); if (found != m_cache.end()) @@ -772,7 +772,7 @@ namespace rsx } template - void lock_memory_region(image_storage_type* image, const u32 memory_address, const u32 memory_size, const u32 width, const u32 height, const u32 pitch, Args&&... extras) + void lock_memory_region(image_storage_type* image, u32 memory_address, u32 memory_size, u32 width, u32 height, u32 pitch, Args&&... extras) { writer_lock lock(m_cache_mutex); section_storage_type& region = find_cached_texture(memory_address, memory_size, false); @@ -802,7 +802,7 @@ namespace rsx } template - bool flush_memory_to_cache(const u32 memory_address, const u32 memory_size, bool skip_synchronized, Args&&... extra) + bool flush_memory_to_cache(u32 memory_address, u32 memory_size, bool skip_synchronized, Args&&... extra) { writer_lock lock(m_cache_mutex); section_storage_type* region = find_flushable_section(memory_address, memory_size); @@ -822,7 +822,7 @@ namespace rsx } template - bool load_memory_from_cache(const u32 memory_address, const u32 memory_size, Args&&... extras) + bool load_memory_from_cache(u32 memory_address, u32 memory_size, Args&&... extras) { reader_lock lock(m_cache_mutex); section_storage_type *region = find_flushable_section(memory_address, memory_size); @@ -1012,7 +1012,7 @@ namespace rsx } template - void flush_if_cache_miss_likely(const texture_format fmt, const u32 memory_address, const u32 memory_size, Args&&... extras) + void flush_if_cache_miss_likely(texture_format fmt, u32 memory_address, u32 memory_size, Args&&... extras) { auto It = m_cache_miss_statistics_table.find(memory_address); if (It == m_cache_miss_statistics_table.end()) @@ -1116,8 +1116,8 @@ namespace rsx } template - sampled_image_descriptor process_framebuffer_resource(render_target_type texptr, const u32 texaddr, const u32 gcm_format, surface_store_type& m_rtts, - const u16 tex_width, const u16 tex_height, const rsx::texture_dimension_extended extended_dimension, const bool is_depth) + sampled_image_descriptor process_framebuffer_resource(render_target_type texptr, u32 texaddr, u32 gcm_format, surface_store_type& m_rtts, + u16 tex_width, u16 tex_height, rsx::texture_dimension_extended extended_dimension, bool is_depth) { const u32 format = gcm_format & ~(CELL_GCM_TEXTURE_UN | CELL_GCM_TEXTURE_LN); const auto surface_width = texptr->get_surface_width(); diff --git a/rpcs3/Emu/RSX/GL/GLTexture.cpp b/rpcs3/Emu/RSX/GL/GLTexture.cpp index 247073c188..8cd6c342cc 100644 --- a/rpcs3/Emu/RSX/GL/GLTexture.cpp +++ b/rpcs3/Emu/RSX/GL/GLTexture.cpp @@ -338,7 +338,7 @@ namespace gl } void fill_texture(rsx::texture_dimension_extended dim, u16 mipmap_count, int format, u16 width, u16 height, u16 depth, - const std::vector &input_layouts, bool is_swizzled, GLenum gl_format, GLenum gl_type, std::vector staging_buffer) + const std::vector &input_layouts, bool is_swizzled, GLenum gl_format, GLenum gl_type, std::vector& staging_buffer) { int mip_level = 0; if (is_compressed_format(format)) @@ -443,7 +443,7 @@ namespace gl } } - void apply_swizzle_remap(const GLenum target, const std::array& swizzle_remap, const std::pair, std::array>& decoded_remap) + void apply_swizzle_remap(GLenum target, const std::array& swizzle_remap, const std::pair, std::array>& decoded_remap) { //Remapping tables; format is A-R-G-B //Remap input table. Contains channel index to read color from @@ -478,8 +478,8 @@ namespace gl glTexParameteri(target, GL_TEXTURE_SWIZZLE_B, remap_values[3]); } - void upload_texture(const GLuint id, const u32 texaddr, const u32 gcm_format, u16 width, u16 height, u16 depth, u16 mipmaps, bool is_swizzled, rsx::texture_dimension_extended type, - std::vector& subresources_layout, const std::pair, std::array>& decoded_remap, bool static_state) + void upload_texture(GLuint id, u32 texaddr, u32 gcm_format, u16 width, u16 height, u16 depth, u16 mipmaps, bool is_swizzled, rsx::texture_dimension_extended type, + const std::vector& subresources_layout, const std::pair, std::array>& decoded_remap, bool static_state) { const bool is_cubemap = type == rsx::texture_dimension_extended::texture_dimension_cubemap; diff --git a/rpcs3/Emu/RSX/GL/GLTexture.h b/rpcs3/Emu/RSX/GL/GLTexture.h index c2a0eb203c..7e49de3a93 100644 --- a/rpcs3/Emu/RSX/GL/GLTexture.h +++ b/rpcs3/Emu/RSX/GL/GLTexture.h @@ -26,10 +26,10 @@ namespace gl * - second vector contains overrides to force the value to either 0 or 1 instead of reading from texture * static_state - set up the texture without consideration for sampler state (useful for vertex textures which have no real sampler state on RSX) */ - void upload_texture(const GLuint id, const u32 texaddr, const u32 gcm_format, u16 width, u16 height, u16 depth, u16 mipmaps, bool is_swizzled, rsx::texture_dimension_extended type, - std::vector& subresources_layout, const std::pair, std::array>& decoded_remap, bool static_state); + void upload_texture(GLuint id, u32 texaddr, u32 gcm_format, u16 width, u16 height, u16 depth, u16 mipmaps, bool is_swizzled, rsx::texture_dimension_extended type, + const std::vector& subresources_layout, const std::pair, std::array>& decoded_remap, bool static_state); - void apply_swizzle_remap(const GLenum target, const std::array& swizzle_remap, const std::pair, std::array>& decoded_remap); + void apply_swizzle_remap(GLenum target, const std::array& swizzle_remap, const std::pair, std::array>& decoded_remap); class sampler_state { diff --git a/rpcs3/Emu/RSX/GL/GLTextureCache.h b/rpcs3/Emu/RSX/GL/GLTextureCache.h index 05613ebaf4..ca54ff8077 100644 --- a/rpcs3/Emu/RSX/GL/GLTextureCache.h +++ b/rpcs3/Emu/RSX/GL/GLTextureCache.h @@ -48,7 +48,7 @@ namespace gl blit_src.remove(); } - u32 scale_image(u32 src, u32 dst, const areai src_rect, const areai dst_rect, bool linear_interpolation, bool is_depth_copy) + u32 scale_image(u32 src, u32 dst, areai src_rect, areai dst_rect, bool linear_interpolation, bool is_depth_copy) { s32 old_fbo = 0; glGetIntegerv(GL_FRAMEBUFFER_BINDING, &old_fbo); @@ -195,7 +195,7 @@ namespace gl public: - void reset(const u32 base, const u32 size, const bool flushable=false) + void reset(u32 base, u32 size, bool flushable=false) { rsx::protection_policy policy = g_cfg.video.strict_rendering_mode ? rsx::protection_policy::protect_policy_full_range : rsx::protection_policy::protect_policy_conservative; rsx::buffered_section::reset(base, size, policy); @@ -210,8 +210,8 @@ namespace gl vram_texture = 0; } - void create(const u16 w, const u16 h, const u16 depth, const u16 mipmaps, void*, - gl::texture* image, const u32 rsx_pitch, bool read_only, + void create(u16 w, u16 h, u16 depth, u16 mipmaps, void*, + gl::texture* image, u32 rsx_pitch, bool read_only, gl::texture::format gl_format, gl::texture::type gl_type, bool swap_bytes) { if (read_only) @@ -240,7 +240,7 @@ namespace gl set_format(gl_format, gl_type, swap_bytes); } - void create_read_only(const u32 id, const u32 width, const u32 height, const u32 depth, const u32 mipmaps) + void create_read_only(u32 id, u32 width, u32 height, u32 depth, u32 mipmaps) { //Only to be used for ro memory, we dont care about most members, just dimensions and the vram texture handle this->width = width; @@ -261,7 +261,7 @@ namespace gl real_pitch = width * get_pixel_size(format, type); } - void set_format(const texture::format gl_format, const texture::type gl_type, const bool swap_bytes) + void set_format(texture::format gl_format, texture::type gl_type, bool swap_bytes) { format = gl_format; type = gl_type; @@ -535,7 +535,7 @@ namespace gl return copied; } - void set_flushed(const bool state) + void set_flushed(bool state) { flushed = state; } @@ -618,7 +618,7 @@ namespace gl m_temporary_surfaces.resize(0); } - u32 create_temporary_subresource_impl(u32 src_id, GLenum sized_internal_fmt, const GLenum dst_type, u16 x, u16 y, u16 width, u16 height) + u32 create_temporary_subresource_impl(u32 src_id, GLenum sized_internal_fmt, GLenum dst_type, u16 x, u16 y, u16 width, u16 height) { u32 dst_id = 0; @@ -666,7 +666,7 @@ namespace gl return dst_id; } - void apply_component_mapping_flags(const GLenum target, const u32 gcm_format, const rsx::texture_create_flags flags) + void apply_component_mapping_flags(GLenum target, u32 gcm_format, rsx::texture_create_flags flags) { switch (flags) { @@ -724,7 +724,7 @@ namespace gl } } - u32 generate_cubemap_from_images(void*&, const u32 gcm_format, u16 size, std::array& sources) override + u32 generate_cubemap_from_images(void*&, u32 gcm_format, u16 size, const std::array& sources) override { const GLenum ifmt = gl::get_sized_internal_format(gcm_format); GLuint dst_id = 0; @@ -761,8 +761,8 @@ namespace gl return dst_id; } - cached_texture_section* create_new_texture(void*&, u32 rsx_address, u32 rsx_size, u16 width, u16 height, u16 depth, u16 mipmaps, const u32 gcm_format, - const rsx::texture_upload_context context, const rsx::texture_dimension_extended type, const rsx::texture_create_flags flags, + cached_texture_section* create_new_texture(void*&, u32 rsx_address, u32 rsx_size, u16 width, u16 height, u16 depth, u16 mipmaps, u32 gcm_format, + rsx::texture_upload_context context, rsx::texture_dimension_extended type, rsx::texture_create_flags flags, const std::pair, std::array>& /*remap_vector*/) override { u32 vram_texture = gl::create_texture(gcm_format, width, height, depth, mipmaps, type); @@ -797,8 +797,8 @@ namespace gl return &cached; } - cached_texture_section* upload_image_from_cpu(void*&, u32 rsx_address, u16 width, u16 height, u16 depth, u16 mipmaps, u16 pitch, const u32 gcm_format, - const rsx::texture_upload_context context, std::vector& subresource_layout, const rsx::texture_dimension_extended type, const bool swizzled, + cached_texture_section* upload_image_from_cpu(void*&, u32 rsx_address, u16 width, u16 height, u16 depth, u16 mipmaps, u16 pitch, u32 gcm_format, + rsx::texture_upload_context context, const std::vector& subresource_layout, rsx::texture_dimension_extended type, bool swizzled, const std::pair, std::array>& remap_vector) override { void* unused = nullptr; @@ -822,7 +822,7 @@ namespace gl return section; } - void enforce_surface_creation_type(cached_texture_section& section, const u32 gcm_format, const rsx::texture_create_flags flags) override + void enforce_surface_creation_type(cached_texture_section& section, u32 gcm_format, rsx::texture_create_flags flags) override { if (flags == section.get_view_flags()) return; @@ -876,7 +876,7 @@ namespace gl m_hw_blitter.destroy(); } - bool is_depth_texture(const u32 rsx_address, const u32 rsx_size) override + bool is_depth_texture(u32 rsx_address, u32 rsx_size) override { reader_lock lock(m_cache_mutex); diff --git a/rpcs3/Emu/RSX/VK/VKTextureCache.h b/rpcs3/Emu/RSX/VK/VKTextureCache.h index 682defa7db..a2cd9b75eb 100644 --- a/rpcs3/Emu/RSX/VK/VKTextureCache.h +++ b/rpcs3/Emu/RSX/VK/VKTextureCache.h @@ -41,7 +41,7 @@ namespace vk rsx::buffered_section::reset(base, length, policy); } - void create(const u16 w, const u16 h, const u16 depth, const u16 mipmaps, vk::image_view *view, vk::image *image, const u32 rsx_pitch, bool managed, const u32 gcm_format, bool pack_swap_bytes = false) + void create(u16 w, u16 h, u16 depth, u16 mipmaps, vk::image_view *view, vk::image *image, u32 rsx_pitch, bool managed, u32 gcm_format, bool pack_swap_bytes = false) { width = w; height = h; @@ -483,7 +483,7 @@ namespace vk return { final_mapping[1], final_mapping[2], final_mapping[3], final_mapping[0] }; } - VkComponentMapping apply_component_mapping_flags(const u32 gcm_format, const rsx::texture_create_flags flags, const std::pair, std::array>& remap_vector) + VkComponentMapping apply_component_mapping_flags(u32 gcm_format, rsx::texture_create_flags flags, const std::pair, std::array>& remap_vector) { VkComponentMapping mapping = {}; switch (flags) @@ -589,7 +589,7 @@ namespace vk return create_temporary_subresource_view(cmd, *source, gcm_format, x, y, w, h); } - vk::image_view* generate_cubemap_from_images(vk::command_buffer& cmd, const u32 gcm_format, u16 size, std::array& sources) override + vk::image_view* generate_cubemap_from_images(vk::command_buffer& cmd, u32 gcm_format, u16 size, const std::array& sources) override { std::unique_ptr image; std::unique_ptr view; @@ -661,8 +661,8 @@ namespace vk return m_discardable_storage.back().view.get(); } - cached_texture_section* create_new_texture(vk::command_buffer& cmd, u32 rsx_address, u32 rsx_size, u16 width, u16 height, u16 depth, u16 mipmaps, const u32 gcm_format, - const rsx::texture_upload_context context, const rsx::texture_dimension_extended type, const rsx::texture_create_flags flags, + cached_texture_section* create_new_texture(vk::command_buffer& cmd, u32 rsx_address, u32 rsx_size, u16 width, u16 height, u16 depth, u16 mipmaps, u32 gcm_format, + rsx::texture_upload_context context, rsx::texture_dimension_extended type, rsx::texture_create_flags flags, const std::pair, std::array>& remap_vector) override { const u16 section_depth = depth; @@ -751,8 +751,8 @@ namespace vk return ®ion; } - cached_texture_section* upload_image_from_cpu(vk::command_buffer& cmd, u32 rsx_address, u16 width, u16 height, u16 depth, u16 mipmaps, u16 pitch, const u32 gcm_format, - const rsx::texture_upload_context context, std::vector& subresource_layout, const rsx::texture_dimension_extended type, const bool swizzled, + cached_texture_section* upload_image_from_cpu(vk::command_buffer& cmd, u32 rsx_address, u16 width, u16 height, u16 depth, u16 mipmaps, u16 pitch, u32 gcm_format, + rsx::texture_upload_context context, const std::vector& subresource_layout, rsx::texture_dimension_extended type, bool swizzled, const std::pair, std::array>& remap_vector) override { auto section = create_new_texture(cmd, rsx_address, pitch * height, width, height, depth, mipmaps, gcm_format, context, type, @@ -796,7 +796,7 @@ namespace vk return section; } - void enforce_surface_creation_type(cached_texture_section& section, const u32 gcm_format, const rsx::texture_create_flags expected_flags) override + void enforce_surface_creation_type(cached_texture_section& section, u32 gcm_format, rsx::texture_create_flags expected_flags) override { if (expected_flags == section.get_view_flags()) return; @@ -863,7 +863,7 @@ namespace vk purge_cache(); } - bool is_depth_texture(const u32 rsx_address, const u32 rsx_size) override + bool is_depth_texture(u32 rsx_address, u32 rsx_size) override { reader_lock lock(m_cache_mutex);