Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebase #3692 #3806

Merged
merged 4 commits into from
Nov 30, 2017
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
7 changes: 5 additions & 2 deletions Utilities/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,12 @@ void cfg::encode(YAML::Emitter& out, const cfg::_base& rhs)
out << YAML::EndMap;
return;
}
default:
{
out << rhs.to_string();
return;
}
}

out << rhs.to_string();
}

void cfg::decode(const YAML::Node& data, cfg::_base& rhs)
Expand Down
2 changes: 2 additions & 0 deletions Utilities/Log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ void fmt_class_string<logs::level>::format(std::string& out, u64 arg)
case logs::level::warning: return "Warning";
case logs::level::notice: return "Notice";
case logs::level::trace: return "Trace";
case logs::level::_uninit: return unknown;
}

return unknown;
Expand Down Expand Up @@ -588,6 +589,7 @@ void logs::file_listener::log(u64 stamp, const logs::message& msg, const std::st
case level::warning: text = u8"·W "; break;
case level::notice: text = u8"·! "; break;
case level::trace: text = u8"·T "; break;
case level::_uninit: text = u8"· "; break;
}

// Print miscosecond timestamp
Expand Down
4 changes: 2 additions & 2 deletions Utilities/Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -963,8 +963,8 @@ bool put_x64_reg_value(x64_context* context, x64_reg_t reg, size_t d_size, u64 v
// save the value into x64 register
switch (d_size)
{
case 1: *X64REG(context, reg - X64R_RAX) = value & 0xff | *X64REG(context, reg - X64R_RAX) & 0xffffff00; return true;
case 2: *X64REG(context, reg - X64R_RAX) = value & 0xffff | *X64REG(context, reg - X64R_RAX) & 0xffff0000; return true;
case 1: *X64REG(context, reg - X64R_RAX) = (value & 0xff) | (*X64REG(context, reg - X64R_RAX) & 0xffffff00); return true;
case 2: *X64REG(context, reg - X64R_RAX) = (value & 0xffff) | (*X64REG(context, reg - X64R_RAX) & 0xffff0000); return true;
case 4: *X64REG(context, reg - X64R_RAX) = value & 0xffffffff; return true;
case 8: *X64REG(context, reg - X64R_RAX) = value; return true;
}
Expand Down
7 changes: 7 additions & 0 deletions rpcs3/Emu/Cell/MFC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ void fmt_class_string<MFC>::format(std::string& out, u64 arg)
case MFC_BARRIER_CMD: return "BARRIER";
case MFC_EIEIO_CMD: return "EIEIO";
case MFC_SYNC_CMD: return "SYNC";

case MFC_BARRIER_MASK:
case MFC_FENCE_MASK:
case MFC_LIST_MASK:
case MFC_START_MASK:
case MFC_RESULT_MASK:
break;
}

return unknown;
Expand Down
2 changes: 2 additions & 0 deletions rpcs3/Emu/Cell/Modules/cellCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ s32 cellCameraInit()
camera->attr[CELL_CAMERA_AGCHIGH] = { 64 };
break;
}
default:
cellCamera.todo("Trying to init cellCamera with un-researched camera type.");
}

// TODO: Some other default attributes? Need to check the actual behaviour on a real PS3.
Expand Down
6 changes: 3 additions & 3 deletions rpcs3/Emu/Cell/Modules/cellGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ s32 cellHddGameCheck(ppu_thread& ppu, u32 version, vm::cptr<char> dirName, u32 e

if (dir.size() != 9)
{
return CELL_HDDGAME_ERROR_PARAM;
return (s32)CELL_HDDGAME_ERROR_PARAM;
}

vm::var<CellHddGameCBResult> result;
Expand Down Expand Up @@ -165,7 +165,7 @@ s32 cellHddGameCheck(ppu_thread& ppu, u32 version, vm::cptr<char> dirName, u32 e

if (result->result != CELL_HDDGAME_CBRESULT_OK && result->result != CELL_HDDGAME_CBRESULT_OK_CANCEL)
{
return CELL_HDDGAME_ERROR_CBRESULT;
return (s32)CELL_HDDGAME_ERROR_CBRESULT;
}

// TODO ?
Expand All @@ -186,7 +186,7 @@ s32 cellHddGameGetSizeKB(vm::ptr<u32> size)

if (!fs::is_dir(local_dir))
{
return CELL_HDDGAME_ERROR_FAILURE;
return (s32)CELL_HDDGAME_ERROR_FAILURE;
}

*size = ::narrow<u32>(fs::get_dir_size(local_dir) / 1024);
Expand Down
16 changes: 8 additions & 8 deletions rpcs3/Emu/Cell/lv2/lv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const std::array<ppu_function_t, 1024> s_ppu_syscall_table
BIND_FUNC(sys_process_is_spu_lock_line_reservation_address), //14 (0x00E)

null_func, null_func, null_func, //15-17 UNS

BIND_FUNC(sys_process_getppid), //18 (0x012)
BIND_FUNC(sys_process_kill), //19 (0x013)
null_func, //20 (0x014) UNS
Expand All @@ -87,7 +87,7 @@ const std::array<ppu_function_t, 1024> s_ppu_syscall_table
BIND_FUNC(sys_process_get_id), //29 (0x01D) ROOT
BIND_FUNC(_sys_process_get_paramsfo), //30 (0x01E)
null_func,//BIND_FUNC(sys_process_get_ppu_guid), //31 (0x01F)

null_func, null_func, null_func, null_func, null_func, null_func, null_func, null_func, null_func, //32-40 UNS

BIND_FUNC(_sys_ppu_thread_exit), //41 (0x029)
Expand Down Expand Up @@ -292,7 +292,7 @@ const std::array<ppu_function_t, 1024> s_ppu_syscall_table
null_func, null_func, null_func, null_func, null_func, //255-259 UNS

null_func,//BIND_FUNC(sys_spu_image_open_by_fd) //260 (0x104)

null_func, null_func, null_func, null_func, //264 UNS
null_func, null_func, null_func, null_func, null_func, //269 UNS
null_func, null_func, null_func, null_func, null_func, //274 UNS
Expand All @@ -315,10 +315,10 @@ const std::array<ppu_function_t, 1024> s_ppu_syscall_table
BIND_FUNC(sys_vm_sync), //310 (0x136)
BIND_FUNC(sys_vm_test), //311 (0x137)
BIND_FUNC(sys_vm_get_statistics), //312 (0x138)
BIND_FUNC(sys_vm_memory_map_different), //313 (0x139) //BIND_FUNC(sys_vm_memory_map (different))
BIND_FUNC(sys_vm_memory_map_different), //313 (0x139) //BIND_FUNC(sys_vm_memory_map (different))
null_func,//BIND_FUNC(sys_...) //314 (0x13A)
null_func,//BIND_FUNC(sys_...) //315 (0x13B)

null_func, null_func, null_func, null_func, null_func, null_func, null_func, null_func, //316-323 UNS

BIND_FUNC(sys_memory_container_create), //324 (0x144) DBG
Expand Down Expand Up @@ -449,7 +449,7 @@ const std::array<ppu_function_t, 1024> s_ppu_syscall_table
null_func,//BIND_FUNC(sys_...) //474 (0x1DA)
null_func,//BIND_FUNC(sys_...) //475 (0x1DB) ROOT
null_func,//BIND_FUNC(sys_...) //476 (0x1DC) ROOT

null_func, null_func, null_func, //477-479 UNS

BIND_FUNC(_sys_prx_load_module), //480 (0x1E0)
Expand Down Expand Up @@ -756,11 +756,11 @@ const std::array<ppu_function_t, 1024> s_ppu_syscall_table
BIND_FUNC(sys_fs_mapped_allocate), //845 (0x34D)
BIND_FUNC(sys_fs_mapped_free), //846 (0x34E)
BIND_FUNC(sys_fs_truncate2), //847 (0x34F)

null_func, null_func, //849 UNS
null_func, null_func, null_func, null_func, null_func, //854 UNS
null_func, null_func, null_func, null_func, null_func, //859 UNS

null_func,//BIND_FUNC(syscall_sys_ss_get_cache_of_analog_sunset_flag), //860 (0x35C) AUTHID
null_func,//BIND_FUNC(syscall_...) //861 ROOT
null_func,//BIND_FUNC(syscall_...) //862 ROOT
Expand Down
4 changes: 2 additions & 2 deletions rpcs3/Emu/Cell/lv2/sys_event_flag.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ struct lv2_event_flag final : lv2_obj
}

// Check pattern
if ((mode & 0xf) == SYS_EVENT_FLAG_WAIT_AND && (pattern & bitptn) != bitptn ||
(mode & 0xf) == SYS_EVENT_FLAG_WAIT_OR && (pattern & bitptn) == 0)
if (((mode & 0xf) == SYS_EVENT_FLAG_WAIT_AND && (pattern & bitptn) != bitptn) ||
((mode & 0xf) == SYS_EVENT_FLAG_WAIT_OR && (pattern & bitptn) == 0))
{
return false;
}
Expand Down
3 changes: 3 additions & 0 deletions rpcs3/Emu/PSP2/ARMv7DisAsm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,9 @@ void ARMv7DisAsm::Write(const std::string& value)
case CPUDisAsm_InterpreterMode:
last_opcode += fmt::format(": %s", str);
break;
case CPUDisAsm_CompilerElfMode:
write("ERROR: Trying to load unimplemented CPU DisAsm mode, CompilerElfMode.");
break;
}
}

Expand Down
22 changes: 15 additions & 7 deletions rpcs3/Emu/RSX/Common/BufferUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ namespace
{
const __m128i mask = _mm_set_epi8(
0xC, 0xD, 0xE, 0xF,
0x8, 0x9, 0xA, 0xB,
0x4, 0x5, 0x6, 0x7,
0x8, 0x9, 0xA, 0xB,
0x4, 0x5, 0x6, 0x7,
0x0, 0x1, 0x2, 0x3);

__m128i* dst_ptr = (__m128i*)dst;
Expand All @@ -48,7 +48,7 @@ namespace
const u32 dword_count = (vertex_count * (stride >> 2));
const u32 iterations = dword_count >> 2;
const u32 remaining = dword_count % 4;

for (u32 i = 0; i < iterations; ++i)
{
u32 *src_words = (u32*)src_ptr;
Expand Down Expand Up @@ -121,7 +121,7 @@ namespace

//Count vertices to copy
const bool is_128_aligned = !((dst_stride | src_stride) & 15);

u32 min_block_size = std::min(src_stride, dst_stride);
if (min_block_size == 0) min_block_size = dst_stride;

Expand Down Expand Up @@ -382,9 +382,9 @@ void write_vertex_array_data_to_buffer(gsl::span<gsl::byte> raw_dst_span, gsl::s

const u64 src_address = (u64)src_ptr.data();
const bool sse_aligned = ((src_address & 15) == 0);

#if !DEBUG_VERTEX_STREAMING

if (real_count >= count || real_count == 1)
{
if (attribute_src_stride == dst_stride && src_read_stride == dst_stride)
Expand Down Expand Up @@ -604,7 +604,10 @@ bool is_primitive_native(rsx::primitive_type draw_mode)
case rsx::primitive_type::triangle_fan:
case rsx::primitive_type::quads:
return false;
case rsx::primitive_type::invalid:
break;
}

fmt::throw_exception("Wrong primitive type" HERE);
}

Expand Down Expand Up @@ -682,7 +685,11 @@ void write_index_array_for_non_indexed_non_native_primitive_to_buffer(char* dst,
case rsx::primitive_type::triangles:
case rsx::primitive_type::triangle_strip:
fmt::throw_exception("Native primitive type doesn't require expansion" HERE);
case rsx::primitive_type::invalid:
break;
}

fmt::throw_exception("Tried to load invalid primitive type" HERE);
}


Expand Down Expand Up @@ -725,8 +732,9 @@ namespace
return expand_indexed_triangle_fan<T>(src, dst, restart_index_enabled, restart_index);
case rsx::primitive_type::quads:
return expand_indexed_quads<T>(src, dst, restart_index_enabled, restart_index);
default:
fmt::throw_exception("Unknown draw mode (0x%x)" HERE, (u32)draw_mode);
}
fmt::throw_exception("Unknown draw mode (0x%x)" HERE, (u32)draw_mode);
}
}

Expand Down
3 changes: 2 additions & 1 deletion rpcs3/Emu/RSX/Common/ProgramStateCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,8 @@ class program_state_cache
for (auto& e : patch_table.db)
{
//TODO: Use fp comparison with fabsf without hurting performance
if (patched = e.second.test_and_set(tmp[i], &dst[i]))
patched = e.second.test_and_set(tmp[i], &dst[i]);
if (patched)
{
break;
}
Expand Down
14 changes: 7 additions & 7 deletions rpcs3/Emu/RSX/Common/texture_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ namespace rsx
class texture_cache
{
private:
std::pair<std::array<u8, 4>, std::array<u8, 4>> default_remap_vector =
std::pair<std::array<u8, 4>, std::array<u8, 4>> default_remap_vector =
{
{ CELL_GCM_TEXTURE_REMAP_FROM_A, CELL_GCM_TEXTURE_REMAP_FROM_R, CELL_GCM_TEXTURE_REMAP_FROM_G, CELL_GCM_TEXTURE_REMAP_FROM_B },
{ CELL_GCM_TEXTURE_REMAP_REMAP, CELL_GCM_TEXTURE_REMAP_REMAP, CELL_GCM_TEXTURE_REMAP_REMAP, CELL_GCM_TEXTURE_REMAP_REMAP }
Expand Down Expand Up @@ -271,12 +271,12 @@ namespace rsx

//Set when a hw blit engine incompatibility is detected
bool blit_engine_incompatibility_warning_raised = false;

//Memory usage
const s32 m_max_zombie_objects = 64; //Limit on how many texture objects to keep around for reuse after they are invalidated
std::atomic<s32> m_unreleased_texture_objects = { 0 }; //Number of invalidated objects not yet freed from memory
std::atomic<u32> m_texture_memory_in_use = { 0 };

/* Helpers */
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;
Expand Down Expand Up @@ -606,7 +606,7 @@ namespace rsx

texture_cache() {}
~texture_cache() {}

virtual void destroy() = 0;
virtual bool is_depth_texture(const u32, const u32) = 0;
virtual void on_frame_end() = 0;
Expand Down Expand Up @@ -768,7 +768,7 @@ namespace rsx
region->copy_texture(false, std::forward<Args>(extra)...);
return true;
}

template <typename ...Args>
bool load_memory_from_cache(const u32 memory_address, const u32 memory_size, Args&&... extras)
{
Expand Down Expand Up @@ -970,7 +970,7 @@ namespace rsx
value.misses--;
}
}

void purge_dirty()
{
writer_lock lock(m_cache_mutex);
Expand Down Expand Up @@ -1001,7 +1001,7 @@ namespace rsx
{
m_cache.erase(address);
}

m_unreleased_texture_objects = 0;
}

Expand Down
9 changes: 7 additions & 2 deletions rpcs3/Emu/RSX/GL/GLHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ namespace gl
case rsx::primitive_type::quads: return GL_TRIANGLES;
case rsx::primitive_type::quad_strip: return GL_TRIANGLE_STRIP;
case rsx::primitive_type::polygon: return GL_TRIANGLES;
default:
fmt::throw_exception("unknown primitive type" HERE);
}
fmt::throw_exception("unknow primitive type" HERE);
}

#ifdef WIN32
Expand Down Expand Up @@ -320,6 +321,9 @@ namespace gl
case texture::internal_format::compressed_rgba_s3tc_dxt5:
compressed_image_size = ((m_width + 3) / 4) * ((m_height + 3) / 4) * 16;
break;
default:
fmt::throw_exception("Tried to load unimplemented internal_format type." HERE);
break;
}
}

Expand Down Expand Up @@ -549,7 +553,8 @@ namespace gl
case rsx::primitive_type::quads:
case rsx::primitive_type::polygon:
return false;
default:
fmt::throw_exception("unknown primitive type" HERE);
}
fmt::throw_exception("unknown primitive type" HERE);
}
}
11 changes: 8 additions & 3 deletions rpcs3/Emu/RSX/GL/GLHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -1379,9 +1379,9 @@ namespace gl
case internal_format::compressed_rgba_s3tc_dxt3:
case internal_format::compressed_rgba_s3tc_dxt5:
return true;
default:
return false;
}

return false;
}

uint id() const noexcept
Expand Down Expand Up @@ -1964,6 +1964,8 @@ namespace gl
case texture::target::texture1D: glFramebufferTexture1D(GL_FRAMEBUFFER, m_id, GL_TEXTURE_1D, rhs.id(), rhs.level()); break;
case texture::target::texture2D: glFramebufferTexture2D(GL_FRAMEBUFFER, m_id, GL_TEXTURE_2D, rhs.id(), rhs.level()); break;
case texture::target::texture3D: glFramebufferTexture3D(GL_FRAMEBUFFER, m_id, GL_TEXTURE_3D, rhs.id(), rhs.level(), 0); break;
case texture::target::textureBuffer:
fmt::throw_exception("Tried to assign unsupported texture of type textureBuffer to fbo." HERE);
}
}

Expand Down Expand Up @@ -2162,9 +2164,12 @@ namespace gl
const GLint length = (GLint)src.length();

{
std::string base_name = "shaderlog/VertexProgram";
std::string base_name;
switch (shader_type)
{
case type::vertex:
base_name = "shaderlog/VertexProgram";
break;
case type::fragment:
base_name = "shaderlog/FragmentProgram";
break;
Expand Down
2 changes: 2 additions & 0 deletions rpcs3/Emu/RSX/GL/GLTextureCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ namespace gl
case texture::type::uint:
size = 4;
break;
default:
LOG_ERROR(RSX, "Unsupported texture type");
}

switch (fmt_)
Expand Down
Loading