summaryrefslogtreecommitdiffstats
path: root/src/video_core/texture_cache/surface_params.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/texture_cache/surface_params.h')
-rw-r--r--src/video_core/texture_cache/surface_params.h31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/video_core/texture_cache/surface_params.h b/src/video_core/texture_cache/surface_params.h
index c58e7f8a4..992b5c022 100644
--- a/src/video_core/texture_cache/surface_params.h
+++ b/src/video_core/texture_cache/surface_params.h
@@ -4,6 +4,8 @@
#pragma once
+#include <utility>
+
#include "common/alignment.h"
#include "common/bit_util.h"
#include "common/cityhash.h"
@@ -16,16 +18,20 @@
namespace VideoCommon {
+class FormatLookupTable;
+
using VideoCore::Surface::SurfaceCompression;
class SurfaceParams {
public:
/// Creates SurfaceCachedParams from a texture configuration.
- static SurfaceParams CreateForTexture(const Tegra::Texture::TICEntry& tic,
+ static SurfaceParams CreateForTexture(const FormatLookupTable& lookup_table,
+ const Tegra::Texture::TICEntry& tic,
const VideoCommon::Shader::Sampler& entry);
/// Creates SurfaceCachedParams from an image configuration.
- static SurfaceParams CreateForImage(const Tegra::Texture::TICEntry& tic,
+ static SurfaceParams CreateForImage(const FormatLookupTable& lookup_table,
+ const Tegra::Texture::TICEntry& tic,
const VideoCommon::Shader::Image& entry);
/// Creates SurfaceCachedParams for a depth buffer configuration.
@@ -41,6 +47,14 @@ public:
static SurfaceParams CreateForFermiCopySurface(
const Tegra::Engines::Fermi2D::Regs::Surface& config);
+ /// Obtains the texture target from a shader's sampler entry.
+ static VideoCore::Surface::SurfaceTarget ExpectedTarget(
+ const VideoCommon::Shader::Sampler& entry);
+
+ /// Obtains the texture target from a shader's sampler entry.
+ static VideoCore::Surface::SurfaceTarget ExpectedTarget(
+ const VideoCommon::Shader::Image& entry);
+
std::size_t Hash() const {
return static_cast<std::size_t>(
Common::CityHash64(reinterpret_cast<const char*>(this), sizeof(*this)));
@@ -124,6 +138,15 @@ public:
std::size_t GetConvertedMipmapSize(u32 level) const;
+ /// Get this texture Tegra Block size in guest memory layout
+ u32 GetBlockSize() const;
+
+ /// Get X, Y coordinates max sizes of a single block.
+ std::pair<u32, u32> GetBlockXY() const;
+
+ /// Get the offset in x, y, z coordinates from a memory offset
+ std::tuple<u32, u32, u32> GetBlockOffsetXYZ(u32 offset) const;
+
/// Returns the size of a layer in bytes in guest memory.
std::size_t GetGuestLayerSize() const {
return GetLayerSize(false, false);
@@ -248,7 +271,6 @@ public:
u32 num_levels;
u32 emulated_levels;
VideoCore::Surface::PixelFormat pixel_format;
- VideoCore::Surface::ComponentType component_type;
VideoCore::Surface::SurfaceType type;
VideoCore::Surface::SurfaceTarget target;
@@ -258,7 +280,8 @@ private:
/// Returns the size of all mipmap levels and aligns as needed.
std::size_t GetInnerMemorySize(bool as_host_size, bool layer_only, bool uncompressed) const {
- return GetLayerSize(as_host_size, uncompressed) * (layer_only ? 1U : depth);
+ return GetLayerSize(as_host_size, uncompressed) *
+ (layer_only ? 1U : (is_layered ? depth : 1U));
}
/// Returns the size of a layer