Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rpcs3/Emu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ target_sources(rpcs3_emu PRIVATE
RSX/rsx_utils.cpp
RSX/Common/BufferUtils.cpp
RSX/Common/FragmentProgramDecompiler.cpp
RSX/Common/GLSLCommon.cpp
RSX/Common/ProgramStateCache.cpp
RSX/Common/surface_store.cpp
RSX/Common/TextureUtils.cpp
Expand Down
16 changes: 9 additions & 7 deletions rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -965,22 +965,24 @@ bool FragmentProgramDecompiler::handle_tex_srb(u32 opcode)
auto insert_texture_fetch = [this](const std::array<FUNCTION, 6>& functions)
{
const auto type = m_prog.get_texture_dimension(dst.tex_num);
std::string mask = "";
const auto ref_mask = (1 << dst.tex_num);
std::string swz_mask = "";
auto select = static_cast<u8>(type);

if (type == rsx::texture_dimension_extended::texture_dimension_2d)
{
if (m_prog.shadow_textures & (1 << dst.tex_num))
if (m_prog.shadow_textures & ref_mask)
{
m_shadow_sampled_textures |= (1 << dst.tex_num);
properties.shadow_sampler_mask |= ref_mask;
select = 4;
mask = ".xxxx";
swz_mask = ".xxxx";
}
else
{
m_2d_sampled_textures |= (1 << dst.tex_num);
if (m_prog.redirected_textures & (1 << dst.tex_num))
properties.tex2d_sampler_mask |= ref_mask;
if (m_prog.redirected_textures & ref_mask)
{
properties.redirected_sampler_mask |= ref_mask;
select = 5;
}
}
Expand All @@ -993,7 +995,7 @@ bool FragmentProgramDecompiler::handle_tex_srb(u32 opcode)
}

auto function = functions[select];
SetDst(getFunction(function) + mask);
SetDst(getFunction(function) + swz_mask);

if (dst.exp_tex)
{
Expand Down
10 changes: 6 additions & 4 deletions rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,6 @@ class FragmentProgramDecompiler
const RSXFragmentProgram &m_prog;
u32 m_ctrl = 0;

u32 m_2d_sampled_textures = 0; //Mask of textures sampled as texture2D (conflicts with samplerShadow fetch)
u32 m_shadow_sampled_textures = 0; //Mask of textures sampled as boolean shadow comparisons

/** returns the type name of float vectors.
*/
virtual std::string getFloatTypeName(usz elementCount) = 0;
Expand Down Expand Up @@ -273,7 +270,12 @@ class FragmentProgramDecompiler

struct
{
u16 in_register_mask = 0;
u16 in_register_mask = 0;

u16 tex2d_sampler_mask = 0;
u16 shadow_sampler_mask = 0;
u16 redirected_sampler_mask = 0;

bool has_lit_op = false;
bool has_gather_op = false;
bool has_no_output = false;
Expand Down
Loading