1
0
Fork 0
forked from suyu/suyu

texture_cache: Style and Corrections

This commit is contained in:
Fernando Sahmkow 2019-06-20 21:22:20 -04:00 committed by FernandoS27
parent 51ba60b27e
commit d1812316e1
7 changed files with 75 additions and 71 deletions

View file

@ -104,7 +104,7 @@ constexpr std::tuple<const char*, const char*, u32> GetPrimitiveDescription(GLen
std::size_t CalculateProgramSize(const GLShader::ProgramCode& program) { std::size_t CalculateProgramSize(const GLShader::ProgramCode& program) {
constexpr std::size_t start_offset = 10; constexpr std::size_t start_offset = 10;
constexpr u64 key = 0xE2400FFFFF07000FULL; constexpr u64 key = 0xE2400FFFFF07000FULL;
constexpr u64 mask =0xFFFFFFFFFF7FFFFFULL; constexpr u64 mask = 0xFFFFFFFFFF7FFFFFULL;
std::size_t offset = start_offset; std::size_t offset = start_offset;
std::size_t size = start_offset * sizeof(u64); std::size_t size = start_offset * sizeof(u64);
while (offset < program.size()) { while (offset < program.size()) {

View file

@ -339,7 +339,8 @@ struct MetaImage {
}; };
/// Parameters that modify an operation but are not part of any particular operand /// Parameters that modify an operation but are not part of any particular operand
using Meta = std::variant<MetaArithmetic, MetaTexture, MetaImage, MetaStackClass, Tegra::Shader::HalfType>; using Meta =
std::variant<MetaArithmetic, MetaTexture, MetaImage, MetaStackClass, Tegra::Shader::HalfType>;
/// Holds any kind of operation that can be done in the IR /// Holds any kind of operation that can be done in the IR
class OperationNode final { class OperationNode final {

View file

@ -101,7 +101,7 @@ MatchStructureResult SurfaceBaseImpl::MatchesStructure(const SurfaceParams& rhs)
std::optional<std::pair<u32, u32>> SurfaceBaseImpl::GetLayerMipmap( std::optional<std::pair<u32, u32>> SurfaceBaseImpl::GetLayerMipmap(
const GPUVAddr candidate_gpu_addr) const { const GPUVAddr candidate_gpu_addr) const {
if (gpu_addr == candidate_gpu_addr) { if (gpu_addr == candidate_gpu_addr) {
return {{0,0}}; return {{0, 0}};
} }
if (candidate_gpu_addr < gpu_addr) { if (candidate_gpu_addr < gpu_addr) {
return {}; return {};

View file

@ -254,7 +254,8 @@ public:
} }
return {}; return {};
} else { } else {
return GetView(ViewParams(view_params.target, layer, 1, mipmap, end_mipmap - mipmap + 1)); return GetView(
ViewParams(view_params.target, layer, 1, mipmap, end_mipmap - mipmap + 1));
} }
} }

View file

@ -18,6 +18,7 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "common/math_util.h" #include "common/math_util.h"
#include "core/memory.h" #include "core/memory.h"
#include "core/settings.h"
#include "video_core/engines/fermi_2d.h" #include "video_core/engines/fermi_2d.h"
#include "video_core/engines/maxwell_3d.h" #include "video_core/engines/maxwell_3d.h"
#include "video_core/gpu.h" #include "video_core/gpu.h"

View file

@ -256,7 +256,8 @@ std::vector<u8> UnswizzleTexture(u8* address, u32 tile_size_x, u32 tile_size_y,
} }
void SwizzleSubrect(u32 subrect_width, u32 subrect_height, u32 source_pitch, u32 swizzled_width, void SwizzleSubrect(u32 subrect_width, u32 subrect_height, u32 source_pitch, u32 swizzled_width,
u32 bytes_per_pixel, u8* swizzled_data, u8* unswizzled_data, u32 block_height_bit) { u32 bytes_per_pixel, u8* swizzled_data, u8* unswizzled_data,
u32 block_height_bit) {
const u32 block_height = 1U << block_height_bit; const u32 block_height = 1U << block_height_bit;
const u32 image_width_in_gobs{(swizzled_width * bytes_per_pixel + (gob_size_x - 1)) / const u32 image_width_in_gobs{(swizzled_width * bytes_per_pixel + (gob_size_x - 1)) /
gob_size_x}; gob_size_x};
@ -278,8 +279,8 @@ void SwizzleSubrect(u32 subrect_width, u32 subrect_height, u32 source_pitch, u32
} }
void UnswizzleSubrect(u32 subrect_width, u32 subrect_height, u32 dest_pitch, u32 swizzled_width, void UnswizzleSubrect(u32 subrect_width, u32 subrect_height, u32 dest_pitch, u32 swizzled_width,
u32 bytes_per_pixel, u8* swizzled_data, u8* unswizzled_data, u32 block_height_bit, u32 bytes_per_pixel, u8* swizzled_data, u8* unswizzled_data,
u32 offset_x, u32 offset_y) { u32 block_height_bit, u32 offset_x, u32 offset_y) {
const u32 block_height = 1U << block_height_bit; const u32 block_height = 1U << block_height_bit;
for (u32 line = 0; line < subrect_height; ++line) { for (u32 line = 0; line < subrect_height; ++line) {
const u32 y2 = line + offset_y; const u32 y2 = line + offset_y;