mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-22 02:32:36 +01:00
rsx: Preserve the texcoord transform around destructive modifications
This commit is contained in:
parent
4b12c9a9fc
commit
c325017675
@ -1,10 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "io_buffer.h"
|
||||
#include "../RSXTexture.h"
|
||||
|
||||
#include <span>
|
||||
#include <stack>
|
||||
#include <vector>
|
||||
#include "io_buffer.h"
|
||||
|
||||
namespace rsx
|
||||
{
|
||||
@ -123,9 +124,39 @@ namespace rsx
|
||||
|
||||
using namespace format_class_;
|
||||
|
||||
//Sampled image descriptor
|
||||
struct sampled_image_descriptor_base
|
||||
// Sampled image descriptor
|
||||
class sampled_image_descriptor_base
|
||||
{
|
||||
#pragma pack(push, 1)
|
||||
struct texcoord_xform_t
|
||||
{
|
||||
f32 scale[3];
|
||||
f32 bias[3];
|
||||
f32 clamp_min[2];
|
||||
f32 clamp_max[2];
|
||||
bool clamp = false;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
// Texure matrix stack
|
||||
std::stack<texcoord_xform_t> m_texcoord_xform_stack;
|
||||
|
||||
public:
|
||||
virtual ~sampled_image_descriptor_base() = default;
|
||||
virtual u32 encoded_component_map() const = 0;
|
||||
|
||||
void push_texcoord_xform()
|
||||
{
|
||||
m_texcoord_xform_stack.push(texcoord_xform);
|
||||
}
|
||||
|
||||
void pop_texcoord_xform()
|
||||
{
|
||||
ensure(!m_texcoord_xform_stack.empty());
|
||||
std::memcpy(&texcoord_xform, &m_texcoord_xform_stack.top(), sizeof(texcoord_xform_t));
|
||||
m_texcoord_xform_stack.pop();
|
||||
}
|
||||
|
||||
texture_upload_context upload_context = texture_upload_context::shader_read;
|
||||
rsx::texture_dimension_extended image_type = texture_dimension_extended::texture_dimension_2d;
|
||||
rsx::format_class format_class = RSX_FORMAT_CLASS_UNDEFINED;
|
||||
@ -134,19 +165,7 @@ namespace rsx
|
||||
u32 ref_address = 0;
|
||||
u64 surface_cache_tag = 0;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct
|
||||
{
|
||||
f32 scale[3];
|
||||
f32 bias[3];
|
||||
f32 clamp_min[2];
|
||||
f32 clamp_max[2];
|
||||
bool clamp = false;
|
||||
} texcoord_xform;
|
||||
#pragma pack(pop)
|
||||
|
||||
virtual ~sampled_image_descriptor_base() = default;
|
||||
virtual u32 encoded_component_map() const = 0;
|
||||
texcoord_xform_t texcoord_xform;
|
||||
};
|
||||
|
||||
struct typeless_xfer
|
||||
|
@ -2416,6 +2416,12 @@ namespace rsx
|
||||
result.external_subresource_desc = { 0, deferred_request_command::mipmap_gather, attributes, {}, tex.decoded_remap() };
|
||||
result.format_class = rsx::classify_format(attributes.gcm_format);
|
||||
|
||||
if (result.texcoord_xform.clamp)
|
||||
{
|
||||
// Revert clamp configuration
|
||||
result.pop_texcoord_xform();
|
||||
}
|
||||
|
||||
if (use_upscaling)
|
||||
{
|
||||
// Grab the correct image dimensions from the base mipmap level
|
||||
|
@ -514,6 +514,9 @@ namespace rsx
|
||||
const size2i& desired_dimensions,
|
||||
const size2i& actual_dimensions)
|
||||
{
|
||||
// Back up the transformation before we destructively modify it.
|
||||
desc.push_texcoord_xform();
|
||||
|
||||
desc.texcoord_xform.scale[0] *= f32(desired_dimensions.width) / actual_dimensions.width;
|
||||
desc.texcoord_xform.scale[1] *= f32(desired_dimensions.height) / actual_dimensions.height;
|
||||
desc.texcoord_xform.bias[0] += f32(offset.x) / actual_dimensions.width;
|
||||
|
@ -6,7 +6,7 @@ namespace rsx
|
||||
{
|
||||
class fragment_texture;
|
||||
class vertex_texture;
|
||||
struct sampled_image_descriptor_base;
|
||||
class sampled_image_descriptor_base;
|
||||
}
|
||||
|
||||
namespace gl
|
||||
|
@ -138,7 +138,7 @@ namespace rsx
|
||||
bool supports_normalized_barycentrics; // Basically all GPUs except NVIDIA have properly normalized barycentrics
|
||||
};
|
||||
|
||||
struct sampled_image_descriptor_base;
|
||||
class sampled_image_descriptor_base;
|
||||
|
||||
struct desync_fifo_cmd_info
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user