mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-21 03:55:32 +00:00
Partial commit: RSX
This commit is contained in:
parent
4cf41305e0
commit
b85a68e8a1
40 changed files with 200 additions and 274 deletions
|
@ -6,7 +6,7 @@
|
|||
|
||||
void CgBinaryDisasm::AddCodeAsm(const std::string& code)
|
||||
{
|
||||
assert(m_opcode < 70);
|
||||
Expects(m_opcode < 70);
|
||||
std::string op_name = "";
|
||||
|
||||
if (dst.dest_reg == 63)
|
||||
|
@ -223,7 +223,7 @@ void CgBinaryDisasm::TaskFP()
|
|||
{
|
||||
m_size = 0;
|
||||
u32* data = (u32*)&m_buffer[m_offset];
|
||||
assert((m_buffer_size - m_offset) % sizeof(u32) == 0);
|
||||
Expects((m_buffer_size - m_offset) % sizeof(u32) == 0);
|
||||
for (u32 i = 0; i < (m_buffer_size - m_offset) / sizeof(u32); i++)
|
||||
{
|
||||
data[i] = se_storage<u32>::swap(data[i]); // WTF, cannot use be_t<> there?
|
||||
|
@ -471,7 +471,7 @@ void CgBinaryDisasm::TaskFP()
|
|||
break;
|
||||
}
|
||||
|
||||
assert(m_step % sizeof(u32) == 0);
|
||||
Ensures(m_step % sizeof(u32) == 0);
|
||||
data += m_step / sizeof(u32);
|
||||
}
|
||||
}
|
|
@ -373,7 +373,7 @@ public:
|
|||
m_offset = prog.ucode;
|
||||
|
||||
u32* vdata = (u32*)&m_buffer[m_offset];
|
||||
assert((m_buffer_size - m_offset) % sizeof(u32) == 0);
|
||||
Ensures((m_buffer_size - m_offset) % sizeof(u32) == 0);
|
||||
for (u32 i = 0; i < (m_buffer_size - m_offset) / sizeof(u32); i++)
|
||||
{
|
||||
vdata[i] = se_storage<u32>::swap(vdata[i]); // WTF, cannot use be_t<> there?
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
|
||||
void CgBinaryDisasm::AddScaCodeDisasm(const std::string& code)
|
||||
{
|
||||
assert(m_sca_opcode < 21);
|
||||
Expects(m_sca_opcode < 21);
|
||||
m_arb_shader += rsx_vp_sca_op_names[m_sca_opcode] + code + " ";
|
||||
}
|
||||
|
||||
void CgBinaryDisasm::AddVecCodeDisasm(const std::string& code)
|
||||
{
|
||||
assert(m_vec_opcode < 26);
|
||||
Expects(m_vec_opcode < 26);
|
||||
m_arb_shader += rsx_vp_vec_op_names[m_vec_opcode] + code + " ";
|
||||
}
|
||||
|
||||
|
|
|
@ -254,7 +254,7 @@ bool is_primitive_native(rsx::primitive_type draw_mode)
|
|||
case rsx::primitive_type::quad_strip:
|
||||
return false;
|
||||
}
|
||||
throw new EXCEPTION("Wrong primitive type");
|
||||
throw EXCEPTION("Wrong primitive type");
|
||||
}
|
||||
|
||||
/** We assume that polygon is convex in polygon mode (constraints in OpenGL)
|
||||
|
@ -289,7 +289,7 @@ size_t get_index_type_size(rsx::index_array_type type)
|
|||
case rsx::index_array_type::u16: return sizeof(u16);
|
||||
case rsx::index_array_type::u32: return sizeof(u32);
|
||||
}
|
||||
throw new EXCEPTION("Wrong index type");
|
||||
throw EXCEPTION("Wrong index type");
|
||||
}
|
||||
|
||||
void write_index_array_for_non_indexed_non_native_primitive_to_buffer(char* dst, rsx::primitive_type draw_mode, unsigned first, unsigned count)
|
||||
|
@ -386,7 +386,7 @@ std::tuple<T, T> write_index_array_data_to_buffer_impl(gsl::span<T, gsl::dynamic
|
|||
return expand_indexed_quads<T>({ ptr, count }, dst, is_primitive_restart_enabled, primitive_restart_index);
|
||||
}
|
||||
|
||||
throw new EXCEPTION("Unknow draw mode");
|
||||
throw EXCEPTION("Unknow draw mode");
|
||||
}
|
||||
|
||||
std::tuple<u32, u32> write_index_array_data_to_buffer(gsl::span<gsl::byte> dst, rsx::index_array_type type, rsx::primitive_type draw_mode, const std::vector<std::pair<u32, u32> > &first_count_arguments)
|
||||
|
|
|
@ -644,7 +644,7 @@ std::string FragmentProgramDecompiler::Decompile()
|
|||
|
||||
if (dst.end) break;
|
||||
|
||||
assert(m_offset % sizeof(u32) == 0);
|
||||
Ensures(m_offset % sizeof(u32) == 0);
|
||||
data += m_offset / sizeof(u32);
|
||||
}
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ public:
|
|||
auto I = m_vertex_shader_cache.find(rsx_vp);
|
||||
if (I != m_vertex_shader_cache.end())
|
||||
return I->second;
|
||||
throw new EXCEPTION("Trying to get unknow transform program");
|
||||
throw EXCEPTION("Trying to get unknown transform program");
|
||||
}
|
||||
|
||||
const fragment_program_type& get_shader_program(const RSXFragmentProgram& rsx_fp) const
|
||||
|
@ -170,7 +170,7 @@ public:
|
|||
auto I = m_fragment_shader_cache.find(rsx_fp);
|
||||
if (I != m_fragment_shader_cache.end())
|
||||
return I->second;
|
||||
throw new EXCEPTION("Trying to get unknow shader program");
|
||||
throw EXCEPTION("Trying to get unknown shader program");
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
|
|
|
@ -149,10 +149,7 @@ public:
|
|||
{
|
||||
auto var_blocks = fmt::split(var, { "." });
|
||||
|
||||
if (var_blocks.size() == 0)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
Expects(var_blocks.size() != 0);
|
||||
|
||||
name = var_blocks[0];
|
||||
|
||||
|
|
|
@ -395,7 +395,6 @@ std::string VertexProgramDecompiler::BuildCode()
|
|||
{
|
||||
lvl -= m_instructions[i].close_scopes;
|
||||
if (lvl < 1) lvl = 1;
|
||||
//assert(lvl >= 1);
|
||||
for (int j = 0; j < m_instructions[i].put_close_scopes; ++j)
|
||||
{
|
||||
--lvl;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
#include "Emu/RSX/RSXVertexProgram.h"
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
#include "ShaderParam.h"
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <gsl.h>
|
||||
#include "../GCM.h"
|
||||
#include <list>
|
||||
|
||||
namespace rsx
|
||||
{
|
||||
|
|
|
@ -350,7 +350,7 @@ std::tuple<bool, size_t, std::vector<D3D12_SHADER_RESOURCE_VIEW_DESC>> D3D12GSRe
|
|||
return std::make_tuple(true, index_count, upload_vertex_attributes(first_count_commands, command_list));
|
||||
}
|
||||
|
||||
assert(draw_command == rsx::draw_command::indexed);
|
||||
Expects(draw_command == rsx::draw_command::indexed);
|
||||
|
||||
// Index count
|
||||
size_t index_count = get_index_count(draw_mode, gsl::narrow<int>(get_vertex_count(first_count_commands)));
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "D3D12CommonDecompiler.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include <set>
|
||||
|
||||
D3D12FragmentDecompiler::D3D12FragmentDecompiler(const RSXFragmentProgram &prog, u32& size) :
|
||||
FragmentProgramDecompiler(prog, size)
|
||||
|
|
|
@ -1,17 +1,27 @@
|
|||
#include "stdafx.h"
|
||||
#include "stdafx_d3d12.h"
|
||||
#ifdef _MSC_VER
|
||||
#include "Utilities/Config.h"
|
||||
#include "D3D12GSRender.h"
|
||||
#include <wrl/client.h>
|
||||
#include <dxgi1_4.h>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
#include <locale>
|
||||
#include <codecvt>
|
||||
#include "d3dx12.h"
|
||||
#include <d3d11on12.h>
|
||||
#include "Emu/state.h"
|
||||
#include "D3D12Formats.h"
|
||||
#include "../rsx_methods.h"
|
||||
|
||||
extern cfg::bool_entry g_cfg_rsx_vsync;
|
||||
extern cfg::bool_entry g_cfg_rsx_debug_output;
|
||||
extern cfg::bool_entry g_cfg_rsx_overlay;
|
||||
|
||||
static cfg::node s_cfg_d3d12(cfg::root.video, "D3D12");
|
||||
|
||||
cfg::string_entry g_cfg_d3d12_adapter(s_cfg_d3d12, "Adapter");
|
||||
|
||||
PFN_D3D12_CREATE_DEVICE wrapD3D12CreateDevice;
|
||||
PFN_D3D12_GET_DEBUG_INTERFACE wrapD3D12GetDebugInterface;
|
||||
PFN_D3D12_SERIALIZE_ROOT_SIGNATURE wrapD3D12SerializeRootSignature;
|
||||
|
@ -33,13 +43,13 @@ HMODULE D3DCompiler;
|
|||
|
||||
void loadD3D12FunctionPointers()
|
||||
{
|
||||
CHECK_ASSERTION(D3D12Module = LoadLibrary(L"d3d12.dll"));
|
||||
ASSERT(D3D12Module = LoadLibrary(L"d3d12.dll"));
|
||||
wrapD3D12CreateDevice = (PFN_D3D12_CREATE_DEVICE)GetProcAddress(D3D12Module, "D3D12CreateDevice");
|
||||
wrapD3D12GetDebugInterface = (PFN_D3D12_GET_DEBUG_INTERFACE)GetProcAddress(D3D12Module, "D3D12GetDebugInterface");
|
||||
wrapD3D12SerializeRootSignature = (PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)GetProcAddress(D3D12Module, "D3D12SerializeRootSignature");
|
||||
CHECK_ASSERTION(D3D11Module = LoadLibrary(L"d3d11.dll"));
|
||||
ASSERT(D3D11Module = LoadLibrary(L"d3d11.dll"));
|
||||
wrapD3D11On12CreateDevice = (PFN_D3D11ON12_CREATE_DEVICE)GetProcAddress(D3D11Module, "D3D11On12CreateDevice");
|
||||
CHECK_ASSERTION(D3DCompiler = LoadLibrary(L"d3dcompiler_47.dll"));
|
||||
ASSERT(D3DCompiler = LoadLibrary(L"d3dcompiler_47.dll"));
|
||||
wrapD3DCompile = (pD3DCompile)GetProcAddress(D3DCompiler, "D3DCompile");
|
||||
}
|
||||
|
||||
|
@ -130,9 +140,11 @@ namespace
|
|||
}
|
||||
|
||||
D3D12GSRender::D3D12GSRender()
|
||||
: GSRender(frame_type::DX12), m_d3d12_lib(), m_current_pso({})
|
||||
: GSRender(frame_type::DX12)
|
||||
, m_d3d12_lib()
|
||||
, m_current_pso({})
|
||||
{
|
||||
if (rpcs3::config.rsx.d3d12.debug_output.value())
|
||||
if (g_cfg_rsx_debug_output)
|
||||
{
|
||||
Microsoft::WRL::ComPtr<ID3D12Debug> debugInterface;
|
||||
wrapD3D12GetDebugInterface(IID_PPV_ARGS(&debugInterface));
|
||||
|
@ -141,10 +153,30 @@ D3D12GSRender::D3D12GSRender()
|
|||
|
||||
Microsoft::WRL::ComPtr<IDXGIFactory4> dxgi_factory;
|
||||
CHECK_HRESULT(CreateDXGIFactory(IID_PPV_ARGS(&dxgi_factory)));
|
||||
|
||||
// Create adapter
|
||||
ComPtr<IDXGIAdapter> adaptater = nullptr;
|
||||
CHECK_HRESULT(dxgi_factory->EnumAdapters(rpcs3::state.config.rsx.d3d12.adaptater.value(), adaptater.GetAddressOf()));
|
||||
CHECK_HRESULT(wrapD3D12CreateDevice(adaptater.Get(), D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&m_device)));
|
||||
ComPtr<IDXGIAdapter> adapter;
|
||||
const std::wstring& adapter_name = std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>>().from_bytes(g_cfg_d3d12_adapter);
|
||||
|
||||
for (UINT id = 0; dxgi_factory->EnumAdapters(id, adapter.ReleaseAndGetAddressOf()) != DXGI_ERROR_NOT_FOUND; id++)
|
||||
{
|
||||
DXGI_ADAPTER_DESC desc;
|
||||
adapter->GetDesc(&desc);
|
||||
|
||||
// Adapter with specified name
|
||||
if (adapter_name == desc.Description)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Default adapter
|
||||
if (id == 1 && adapter_name.empty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CHECK_HRESULT(wrapD3D12CreateDevice(adapter.Get(), D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&m_device)));
|
||||
|
||||
// Queues
|
||||
D3D12_COMMAND_QUEUE_DESC graphic_queue_desc = { D3D12_COMMAND_LIST_TYPE_DIRECT };
|
||||
|
@ -224,7 +256,7 @@ D3D12GSRender::D3D12GSRender()
|
|||
)
|
||||
);
|
||||
|
||||
if (rpcs3::config.rsx.d3d12.overlay.value())
|
||||
if (g_cfg_rsx_overlay)
|
||||
init_d2d_structures();
|
||||
}
|
||||
|
||||
|
@ -418,7 +450,7 @@ void D3D12GSRender::end()
|
|||
m_timers.draw_calls_duration += std::chrono::duration_cast<std::chrono::microseconds>(end_duration - start_duration).count();
|
||||
m_timers.draw_calls_count++;
|
||||
|
||||
if (rpcs3::config.rsx.d3d12.debug_output.value())
|
||||
if (g_cfg_rsx_debug_output)
|
||||
{
|
||||
CHECK_HRESULT(get_current_resource_storage().command_list->Close());
|
||||
m_command_queue->ExecuteCommandLists(1, (ID3D12CommandList**)get_current_resource_storage().command_list.GetAddressOf());
|
||||
|
@ -454,7 +486,7 @@ void D3D12GSRender::flip(int buffer)
|
|||
if (!is_flip_surface_in_global_memory(rsx::to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET])))
|
||||
{
|
||||
resource_storage &storage = get_current_resource_storage();
|
||||
assert(storage.ram_framebuffer == nullptr);
|
||||
ASSERT(storage.ram_framebuffer == nullptr);
|
||||
|
||||
size_t w = 0, h = 0, row_pitch = 0;
|
||||
|
||||
|
@ -583,21 +615,21 @@ void D3D12GSRender::flip(int buffer)
|
|||
if (resource_to_flip)
|
||||
get_current_resource_storage().command_list->DrawInstanced(4, 1, 0, 0);
|
||||
|
||||
if (!rpcs3::config.rsx.d3d12.overlay.value())
|
||||
if (!g_cfg_rsx_overlay)
|
||||
get_current_resource_storage().command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(m_backbuffer[m_swap_chain->GetCurrentBackBufferIndex()].Get(), D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PRESENT));
|
||||
if (is_flip_surface_in_global_memory(rsx::to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET])) && resource_to_flip != nullptr)
|
||||
get_current_resource_storage().command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(resource_to_flip, D3D12_RESOURCE_STATE_GENERIC_READ, D3D12_RESOURCE_STATE_RENDER_TARGET));
|
||||
CHECK_HRESULT(get_current_resource_storage().command_list->Close());
|
||||
m_command_queue->ExecuteCommandLists(1, (ID3D12CommandList**)get_current_resource_storage().command_list.GetAddressOf());
|
||||
|
||||
if(rpcs3::config.rsx.d3d12.overlay.value())
|
||||
if (g_cfg_rsx_overlay)
|
||||
render_overlay();
|
||||
|
||||
reset_timer();
|
||||
|
||||
std::chrono::time_point<std::chrono::system_clock> flip_start = std::chrono::system_clock::now();
|
||||
|
||||
CHECK_HRESULT(m_swap_chain->Present(rpcs3::state.config.rsx.vsync.value() ? 1 : 0, 0));
|
||||
CHECK_HRESULT(m_swap_chain->Present(g_cfg_rsx_vsync ? 1 : 0, 0));
|
||||
// Add an event signaling queue completion
|
||||
|
||||
resource_storage &storage = get_non_current_resource_storage();
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "D3D12Utils.h"
|
||||
#include "Utilities/rPlatform.h" // only for rImage
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/RSX/GSRender.h"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "D3D12Utils.h"
|
||||
#include "d3dx12.h"
|
||||
#include "../Common/ring_buffer_helper.h"
|
||||
#include <list>
|
||||
|
||||
struct d3d12_data_heap : public data_heap
|
||||
{
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
#include "stdafx.h"
|
||||
#include "stdafx_d3d12.h"
|
||||
#ifdef _MSC_VER
|
||||
#include "Utilities/Config.h"
|
||||
#include "D3D12PipelineState.h"
|
||||
#include "D3D12GSRender.h"
|
||||
#include "Emu/state.h"
|
||||
#include "D3D12Formats.h"
|
||||
#include "../rsx_methods.h"
|
||||
|
||||
#define TO_STRING(x) #x
|
||||
|
||||
extern cfg::bool_entry g_cfg_rsx_debug_output;
|
||||
|
||||
extern pD3DCompile wrapD3DCompile;
|
||||
|
||||
void Shader::Compile(const std::string &code, SHADER_TYPE st)
|
||||
|
@ -17,7 +19,7 @@ void Shader::Compile(const std::string &code, SHADER_TYPE st)
|
|||
HRESULT hr;
|
||||
ComPtr<ID3DBlob> errorBlob;
|
||||
UINT compileFlags;
|
||||
if (rpcs3::config.rsx.d3d12.debug_output.value())
|
||||
if (g_cfg_rsx_debug_output)
|
||||
compileFlags = D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION;
|
||||
else
|
||||
compileFlags = 0;
|
||||
|
|
|
@ -130,7 +130,7 @@ struct D3D12Traits
|
|||
}
|
||||
}
|
||||
|
||||
fs::file(fs::get_config_dir() + "FragmentProgram" + std::to_string(ID) + ".hlsl", fom::rewrite).write(shader);
|
||||
fs::file(fs::get_config_dir() + "FragmentProgram" + std::to_string(ID) + ".hlsl", fs::rewrite).write(shader);
|
||||
fragmentProgramData.id = (u32)ID;
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ struct D3D12Traits
|
|||
std::string shaderCode = VS.Decompile();
|
||||
vertexProgramData.Compile(shaderCode, Shader::SHADER_TYPE::SHADER_TYPE_VERTEX);
|
||||
vertexProgramData.vertex_shader_input_count = RSXVP.rsx_vertex_inputs.size();
|
||||
fs::file(fs::get_config_dir() + "VertexProgram" + std::to_string(ID) + ".hlsl", fom::rewrite).write(shaderCode);
|
||||
fs::file(fs::get_config_dir() + "VertexProgram" + std::to_string(ID) + ".hlsl", fs::rewrite).write(shaderCode);
|
||||
vertexProgramData.id = (u32)ID;
|
||||
}
|
||||
|
||||
|
@ -154,12 +154,12 @@ struct D3D12Traits
|
|||
D3D12_GRAPHICS_PIPELINE_STATE_DESC graphicPipelineStateDesc = {};
|
||||
|
||||
if (vertexProgramData.bytecode == nullptr)
|
||||
throw new EXCEPTION("Vertex program compilation failure");
|
||||
throw EXCEPTION("Vertex program compilation failure");
|
||||
graphicPipelineStateDesc.VS.BytecodeLength = vertexProgramData.bytecode->GetBufferSize();
|
||||
graphicPipelineStateDesc.VS.pShaderBytecode = vertexProgramData.bytecode->GetBufferPointer();
|
||||
|
||||
if (fragmentProgramData.bytecode == nullptr)
|
||||
throw new EXCEPTION("fragment program compilation failure");
|
||||
throw EXCEPTION("fragment program compilation failure");
|
||||
graphicPipelineStateDesc.PS.BytecodeLength = fragmentProgramData.bytecode->GetBufferSize();
|
||||
graphicPipelineStateDesc.PS.pShaderBytecode = fragmentProgramData.bytecode->GetBufferPointer();
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
#include "stdafx.h"
|
||||
#include "stdafx_d3d12.h"
|
||||
#ifdef _MSC_VER
|
||||
#include "Utilities/Config.h"
|
||||
#include "D3D12RenderTargetSets.h"
|
||||
#include "Utilities/rPlatform.h" // only for rImage
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/state.h"
|
||||
#include "Emu/RSX/GSRender.h"
|
||||
#include "../rsx_methods.h"
|
||||
|
||||
|
@ -13,6 +12,10 @@
|
|||
#include "D3D12GSRender.h"
|
||||
#include "D3D12Formats.h"
|
||||
|
||||
extern cfg::bool_entry g_cfg_rsx_debug_output;
|
||||
extern cfg::bool_entry g_cfg_rsx_write_color_buffers;
|
||||
extern cfg::bool_entry g_cfg_rsx_write_depth_buffer;
|
||||
|
||||
namespace
|
||||
{
|
||||
u32 get_max_depth_value(rsx::surface_depth_format format)
|
||||
|
@ -159,7 +162,7 @@ void D3D12GSRender::clear_surface(u32 arg)
|
|||
m_timers.draw_calls_duration += std::chrono::duration_cast<std::chrono::microseconds>(end_duration - start_duration).count();
|
||||
m_timers.draw_calls_count++;
|
||||
|
||||
if (rpcs3::config.rsx.d3d12.debug_output.value())
|
||||
if (g_cfg_rsx_debug_output)
|
||||
{
|
||||
CHECK_HRESULT(get_current_resource_storage().command_list->Close());
|
||||
m_command_queue->ExecuteCommandLists(1, (ID3D12CommandList**)get_current_resource_storage().command_list.GetAddressOf());
|
||||
|
@ -330,7 +333,7 @@ void D3D12GSRender::copy_render_target_to_dma_location()
|
|||
|
||||
bool need_transfer = false;
|
||||
|
||||
if (m_context_dma_z && rpcs3::state.config.rsx.opengl.write_depth_buffer)
|
||||
if (m_context_dma_z && g_cfg_rsx_write_depth_buffer)
|
||||
{
|
||||
get_current_resource_storage().command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(std::get<1>(m_rtts.m_bound_depth_stencil), D3D12_RESOURCE_STATE_DEPTH_WRITE, D3D12_RESOURCE_STATE_COPY_SOURCE));
|
||||
get_current_resource_storage().command_list->CopyTextureRegion(&CD3DX12_TEXTURE_COPY_LOCATION(m_readback_resources.get_heap(), { depth_buffer_offset_in_heap,{ DXGI_FORMAT_R32_TYPELESS, (UINT)clip_w, (UINT)clip_h, 1, (UINT)depth_row_pitch } }), 0, 0, 0,
|
||||
|
@ -342,7 +345,7 @@ void D3D12GSRender::copy_render_target_to_dma_location()
|
|||
}
|
||||
|
||||
size_t color_buffer_offset_in_heap[4];
|
||||
if (rpcs3::state.config.rsx.opengl.write_color_buffers)
|
||||
if (g_cfg_rsx_write_color_buffers)
|
||||
{
|
||||
for (u8 i : get_rtt_indexes(rsx::to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET])))
|
||||
{
|
||||
|
@ -363,7 +366,7 @@ void D3D12GSRender::copy_render_target_to_dma_location()
|
|||
//Wait for result
|
||||
wait_for_command_queue(m_device.Get(), m_command_queue.Get());
|
||||
|
||||
if (address_z && rpcs3::state.config.rsx.opengl.write_depth_buffer)
|
||||
if (address_z && g_cfg_rsx_write_depth_buffer)
|
||||
{
|
||||
auto ptr = vm::base(address_z);
|
||||
char *depth_buffer = (char*)ptr;
|
||||
|
@ -383,7 +386,7 @@ void D3D12GSRender::copy_render_target_to_dma_location()
|
|||
m_readback_resources.unmap();
|
||||
}
|
||||
|
||||
if (rpcs3::state.config.rsx.opengl.write_color_buffers)
|
||||
if (g_cfg_rsx_write_color_buffers)
|
||||
{
|
||||
size_t srcPitch = get_aligned_pitch(m_surface.color_format, clip_w);
|
||||
size_t dstPitch = get_packed_pitch(m_surface.color_format, clip_w);
|
||||
|
|
|
@ -731,7 +731,7 @@ rsx::vertex_base_type rsx::to_vertex_base_type(u8 in)
|
|||
case 6: return rsx::vertex_base_type::cmp;
|
||||
case 7: return rsx::vertex_base_type::ub256;
|
||||
}
|
||||
throw new EXCEPTION("Unknow vertex base type %d", in);
|
||||
throw EXCEPTION("Unknow vertex base type %d", in);
|
||||
}
|
||||
|
||||
rsx::index_array_type rsx::to_index_array_type(u8 in)
|
||||
|
@ -741,7 +741,7 @@ rsx::index_array_type rsx::to_index_array_type(u8 in)
|
|||
case 0: return rsx::index_array_type::u32;
|
||||
case 1: return rsx::index_array_type::u16;
|
||||
}
|
||||
throw new EXCEPTION("Unknown index array type %d", in);
|
||||
throw EXCEPTION("Unknown index array type %d", in);
|
||||
}
|
||||
|
||||
rsx::primitive_type rsx::to_primitive_type(u8 in)
|
||||
|
@ -759,7 +759,7 @@ rsx::primitive_type rsx::to_primitive_type(u8 in)
|
|||
case 9: return rsx::primitive_type::quad_strip;
|
||||
case 10: return rsx::primitive_type::polygon;
|
||||
}
|
||||
throw new EXCEPTION("Unknow primitive type %d", in);
|
||||
throw EXCEPTION("Unknow primitive type %d", in);
|
||||
}
|
||||
|
||||
enum
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include "../Common/ShaderParam.h"
|
||||
#include <ostream>
|
||||
|
||||
std::string getFloatTypeNameImpl(size_t elementCount);
|
||||
std::string getFunctionImpl(FUNCTION f);
|
||||
std::string compareFunctionImpl(COMPARE f, const std::string &Op0, const std::string &Op1);
|
||||
void insert_glsl_legacy_function(std::ostream& OS);
|
||||
void insert_glsl_legacy_function(std::ostream& OS);
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
#include "stdafx.h"
|
||||
#include "Utilities/rPlatform.h" // only for rImage
|
||||
#include "Utilities/Config.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/state.h"
|
||||
#include "GLGSRender.h"
|
||||
#include "../rsx_methods.h"
|
||||
#include "../Common/BufferUtils.h"
|
||||
|
||||
extern cfg::bool_entry g_cfg_rsx_debug_output;
|
||||
|
||||
#define DUMP_VERTEX_DATA 0
|
||||
|
||||
namespace
|
||||
|
@ -366,7 +367,7 @@ void GLGSRender::on_init_thread()
|
|||
GSRender::on_init_thread();
|
||||
|
||||
gl::init();
|
||||
if (rpcs3::config.rsx.d3d12.debug_output.value())
|
||||
if (g_cfg_rsx_debug_output)
|
||||
gl::enable_debugging();
|
||||
LOG_NOTICE(RSX, "%s", (const char*)glGetString(GL_VERSION));
|
||||
LOG_NOTICE(RSX, "%s", (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION));
|
||||
|
@ -737,4 +738,4 @@ bool GLGSRender::on_access_violation(u32 address, bool is_writing)
|
|||
{
|
||||
if (is_writing) return m_gl_texture_cache.mark_as_dirty(address);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ struct GLTraits
|
|||
fragmentProgramData.Compile();
|
||||
//checkForGlError("m_fragment_prog.Compile");
|
||||
|
||||
fs::file(fs::get_config_dir() + "FragmentProgram.txt", fom::rewrite).write(fragmentProgramData.shader);
|
||||
fs::file(fs::get_config_dir() + "FragmentProgram.txt", fs::rewrite).write(fragmentProgramData.shader);
|
||||
}
|
||||
|
||||
static
|
||||
|
@ -27,7 +27,7 @@ struct GLTraits
|
|||
vertexProgramData.Compile();
|
||||
//checkForGlError("m_vertex_prog.Compile");
|
||||
|
||||
fs::file(fs::get_config_dir() + "VertexProgram.txt", fom::rewrite).write(vertexProgramData.shader);
|
||||
fs::file(fs::get_config_dir() + "VertexProgram.txt", fs::rewrite).write(vertexProgramData.shader);
|
||||
}
|
||||
|
||||
static
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace gl
|
|||
case rsx::primitive_type::quad_strip: return GL_TRIANGLES;
|
||||
case rsx::primitive_type::polygon: return GL_TRIANGLES;
|
||||
}
|
||||
throw new EXCEPTION("unknow primitive type");
|
||||
throw EXCEPTION("unknow primitive type");
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
|
|
|
@ -7,9 +7,6 @@
|
|||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
#include "OpenGL.h"
|
||||
#include "../GCM.h"
|
||||
|
||||
|
@ -1778,23 +1775,6 @@ namespace gl
|
|||
void operator = (const color4i& rhs) const { m_program.use(); glUniform4i(location(), rhs.r, rhs.g, rhs.b, rhs.a); }
|
||||
void operator = (const color4f& rhs) const { m_program.use(); glUniform4f(location(), rhs.r, rhs.g, rhs.b, rhs.a); }
|
||||
//void operator = (const color4d& rhs) const { m_program.use(); glUniform4d(location(), rhs.r, rhs.g, rhs.b, rhs.a); }
|
||||
|
||||
void operator = (const glm::ivec2& rhs) const { m_program.use(); glUniform2i(location(), rhs.r, rhs.g); }
|
||||
void operator = (const glm::vec2& rhs) const { m_program.use(); glUniform2f(location(), rhs.r, rhs.g); }
|
||||
//void operator = (const glm::dvec2& rhs) const { m_program.use(); glUniform2d(location(), rhs.r, rhs.g); }
|
||||
void operator = (const glm::ivec3& rhs) const { m_program.use(); glUniform3i(location(), rhs.r, rhs.g, rhs.b); }
|
||||
void operator = (const glm::vec3& rhs) const { m_program.use(); glUniform3f(location(), rhs.r, rhs.g, rhs.b); }
|
||||
//void operator = (const glm::dvec3& rhs) const { m_program.use(); glUniform3d(location(), rhs.r, rhs.g, rhs.b); }
|
||||
void operator = (const glm::ivec4& rhs) const { m_program.use(); glUniform4i(location(), rhs.r, rhs.g, rhs.b, rhs.a); }
|
||||
void operator = (const glm::vec4& rhs) const { m_program.use(); glUniform4f(location(), rhs.r, rhs.g, rhs.b, rhs.a); }
|
||||
//void operator = (const glm::dvec4& rhs) const { m_program.use(); glUniform4d(location(), rhs.r, rhs.g, rhs.b, rhs.a); }
|
||||
|
||||
void operator = (const glm::mat2& rhs) const { m_program.use(); glUniformMatrix2fv(location(), 1, GL_FALSE, glm::value_ptr(rhs)); }
|
||||
//void operator = (const glm::dmat2& rhs) const { m_program.use(); glUniformMatrix2dv(location(), 1, GL_FALSE, glm::value_ptr(rhs)); }
|
||||
void operator = (const glm::mat3& rhs) const { m_program.use(); glUniformMatrix3fv(location(), 1, GL_FALSE, glm::value_ptr(rhs)); }
|
||||
//void operator = (const glm::dmat3& rhs) const { m_program.use(); glUniformMatrix3dv(location(), 1, GL_FALSE, glm::value_ptr(rhs)); }
|
||||
void operator = (const glm::mat4& rhs) const { m_program.use(); glUniformMatrix4fv(location(), 1, GL_FALSE, glm::value_ptr(rhs)); }
|
||||
//void operator = (const glm::dmat4& rhs) const { m_program.use(); glUniformMatrix4dv(location(), 1, GL_FALSE, glm::value_ptr(rhs)); }
|
||||
};
|
||||
|
||||
class attrib_t
|
||||
|
@ -1826,13 +1806,6 @@ namespace gl
|
|||
void operator = (const color4f& rhs) const { glDisableVertexAttribArray(location()); glVertexAttrib4f(location(), rhs.r, rhs.g, rhs.b, rhs.a); }
|
||||
void operator = (const color4d& rhs) const { glDisableVertexAttribArray(location()); glVertexAttrib4d(location(), rhs.r, rhs.g, rhs.b, rhs.a); }
|
||||
|
||||
void operator = (const glm::vec2& rhs) const { glDisableVertexAttribArray(location()); glVertexAttrib2f(location(), rhs.r, rhs.g); }
|
||||
void operator = (const glm::dvec2& rhs) const { glDisableVertexAttribArray(location()); glVertexAttrib2d(location(), rhs.r, rhs.g); }
|
||||
void operator = (const glm::vec3& rhs) const { glDisableVertexAttribArray(location()); glVertexAttrib3f(location(), rhs.r, rhs.g, rhs.b); }
|
||||
void operator = (const glm::dvec3& rhs) const { glDisableVertexAttribArray(location()); glVertexAttrib3d(location(), rhs.r, rhs.g, rhs.b); }
|
||||
void operator = (const glm::vec4& rhs) const { glDisableVertexAttribArray(location()); glVertexAttrib4f(location(), rhs.r, rhs.g, rhs.b, rhs.a); }
|
||||
void operator = (const glm::dvec4& rhs) const { glDisableVertexAttribArray(location()); glVertexAttrib4d(location(), rhs.r, rhs.g, rhs.b, rhs.a); }
|
||||
|
||||
void operator =(buffer_pointer& pointer) const
|
||||
{
|
||||
pointer.get_vao().enable_for_attribute(location());
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
#include "stdafx.h"
|
||||
#include "Utilities/Config.h"
|
||||
#include "../rsx_methods.h"
|
||||
#include "GLGSRender.h"
|
||||
#include "Emu/state.h"
|
||||
|
||||
extern cfg::bool_entry g_cfg_rsx_write_color_buffers;
|
||||
extern cfg::bool_entry g_cfg_rsx_write_depth_buffer;
|
||||
extern cfg::bool_entry g_cfg_rsx_read_color_buffers;
|
||||
extern cfg::bool_entry g_cfg_rsx_read_depth_buffer;
|
||||
|
||||
color_format rsx::internals::surface_color_format_to_gl(rsx::surface_color_format color_format)
|
||||
{
|
||||
|
@ -151,7 +156,7 @@ void GLGSRender::read_buffers()
|
|||
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
|
||||
if (rpcs3::state.config.rsx.opengl.read_color_buffers)
|
||||
if (g_cfg_rsx_read_color_buffers)
|
||||
{
|
||||
auto color_format = rsx::internals::surface_color_format_to_gl(m_surface.color_format);
|
||||
|
||||
|
@ -222,7 +227,7 @@ void GLGSRender::read_buffers()
|
|||
}
|
||||
}
|
||||
|
||||
if (rpcs3::state.config.rsx.opengl.read_depth_buffer)
|
||||
if (g_cfg_rsx_read_depth_buffer)
|
||||
{
|
||||
//TODO: use pitch
|
||||
u32 pitch = rsx::method_registers[NV4097_SET_SURFACE_PITCH_Z];
|
||||
|
@ -279,7 +284,7 @@ void GLGSRender::write_buffers()
|
|||
//TODO: Detect when the data is actually being used by cell and issue download command on-demand (mark as not present?)
|
||||
//Should also mark cached resources as dirty so that read buffers works out-of-the-box without modification
|
||||
|
||||
if (rpcs3::state.config.rsx.opengl.write_color_buffers)
|
||||
if (g_cfg_rsx_write_color_buffers)
|
||||
{
|
||||
auto color_format = rsx::internals::surface_color_format_to_gl(m_surface.color_format);
|
||||
|
||||
|
@ -337,7 +342,7 @@ void GLGSRender::write_buffers()
|
|||
}
|
||||
}
|
||||
|
||||
if (rpcs3::state.config.rsx.opengl.write_depth_buffer)
|
||||
if (g_cfg_rsx_write_depth_buffer)
|
||||
{
|
||||
//TODO: use pitch
|
||||
u32 pitch = rsx::method_registers[NV4097_SET_SURFACE_PITCH_Z];
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
#include "stdafx.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/SysCalls/Modules/cellVideoOut.h"
|
||||
#include "Emu/state.h"
|
||||
|
||||
#include "GSManager.h"
|
||||
|
||||
void GSInfo::Init()
|
||||
{
|
||||
mode.resolutionId = (u8)rpcs3::state.config.rsx.resolution.value();
|
||||
mode.scanMode = CELL_VIDEO_OUT_SCAN_MODE_INTERLACE;
|
||||
mode.conversion = CELL_VIDEO_OUT_DISPLAY_CONVERSION_NONE;
|
||||
mode.aspect = (u8)rpcs3::state.config.rsx.aspect_ratio.value();
|
||||
mode.refreshRates = CELL_VIDEO_OUT_REFRESH_RATE_50HZ;
|
||||
mode.format = CELL_VIDEO_OUT_BUFFER_COLOR_FORMAT_X8R8G8B8;
|
||||
mode.pitch = 4;
|
||||
}
|
||||
|
||||
void GSManager::Init()
|
||||
{
|
||||
if (m_render) return;
|
||||
|
||||
m_info.Init();
|
||||
|
||||
m_render = Emu.GetCallbacks().get_gs_render();
|
||||
|
||||
//m_render->Init(GetInfo().outresolution.width, GetInfo().outresolution.height);
|
||||
}
|
||||
|
||||
void GSManager::Close()
|
||||
{
|
||||
m_render.reset();
|
||||
}
|
||||
|
||||
u8 GSManager::GetState()
|
||||
{
|
||||
return CELL_VIDEO_OUT_OUTPUT_STATE_ENABLED;
|
||||
}
|
||||
|
||||
u8 GSManager::GetColorSpace()
|
||||
{
|
||||
return CELL_VIDEO_OUT_COLOR_SPACE_RGB;
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
class GSRender;
|
||||
|
||||
struct GSInfo
|
||||
{
|
||||
struct
|
||||
{
|
||||
u8 resolutionId;
|
||||
u8 scanMode;
|
||||
u8 conversion;
|
||||
u8 aspect;
|
||||
u8 format;
|
||||
u16 refreshRates;
|
||||
u32 pitch;
|
||||
} mode;
|
||||
|
||||
GSInfo()
|
||||
{
|
||||
}
|
||||
|
||||
void Init();
|
||||
};
|
||||
|
||||
class GSManager
|
||||
{
|
||||
GSInfo m_info;
|
||||
std::shared_ptr<GSRender> m_render;
|
||||
|
||||
public:
|
||||
void Init();
|
||||
void Close();
|
||||
|
||||
bool IsInited() const { return m_render != nullptr; }
|
||||
|
||||
GSInfo& GetInfo() { return m_info; }
|
||||
GSRender& GetRender() { return *m_render; }
|
||||
|
||||
u8 GetState();
|
||||
u8 GetColorSpace();
|
||||
};
|
|
@ -1,10 +1,13 @@
|
|||
#include "stdafx.h"
|
||||
#include "Utilities/Config.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
|
||||
#include "GSManager.h"
|
||||
#include "GSRender.h"
|
||||
|
||||
// temporarily (u8 value is really CellVideoOutResolutionId, but HLE declarations shouldn't be available for the rest of emu, even indirectly)
|
||||
extern cfg::map_entry<u8> g_cfg_video_out_resolution;
|
||||
extern const std::unordered_map<u8, size2i> g_video_out_resolution_map;
|
||||
|
||||
draw_context_t GSFrameBase::new_context()
|
||||
{
|
||||
|
@ -16,12 +19,8 @@ draw_context_t GSFrameBase::new_context()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void GSFrameBase::title_message(const std::wstring& msg)
|
||||
{
|
||||
m_title_message = msg;
|
||||
}
|
||||
|
||||
GSRender::GSRender(frame_type type) : m_frame(Emu.GetCallbacks().get_gs_frame(type).release())
|
||||
GSRender::GSRender(frame_type type)
|
||||
: m_frame(Emu.GetCallbacks().get_gs_frame(type, g_video_out_resolution_map.at(g_cfg_video_out_resolution.get())).release())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -36,7 +35,7 @@ GSRender::~GSRender()
|
|||
}
|
||||
}
|
||||
|
||||
void GSRender::on_init()
|
||||
void GSRender::on_init_rsx()
|
||||
{
|
||||
if (m_frame)
|
||||
{
|
||||
|
|
|
@ -1,14 +1,29 @@
|
|||
#pragma once
|
||||
|
||||
#include "Emu/RSX/RSXThread.h"
|
||||
#include <memory>
|
||||
|
||||
struct RSXDebuggerProgram
|
||||
{
|
||||
u32 id;
|
||||
u32 vp_id;
|
||||
u32 fp_id;
|
||||
std::string vp_shader;
|
||||
std::string fp_shader;
|
||||
bool modified;
|
||||
|
||||
RSXDebuggerProgram()
|
||||
: modified(false)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
using RSXDebuggerPrograms = std::vector<RSXDebuggerProgram>;
|
||||
|
||||
using draw_context_t = std::shared_ptr<void>;
|
||||
|
||||
class GSFrameBase
|
||||
{
|
||||
protected:
|
||||
std::wstring m_title_message;
|
||||
|
||||
public:
|
||||
GSFrameBase() = default;
|
||||
GSFrameBase(const GSFrameBase&) = delete;
|
||||
|
@ -25,7 +40,6 @@ public:
|
|||
virtual size2i client_size() = 0;
|
||||
|
||||
virtual void* handle() const = 0;
|
||||
void title_message(const std::wstring&);
|
||||
|
||||
protected:
|
||||
virtual void delete_context(void* ctx) = 0;
|
||||
|
@ -50,7 +64,7 @@ public:
|
|||
GSRender(frame_type type);
|
||||
virtual ~GSRender();
|
||||
|
||||
void on_init() override;
|
||||
void on_init_rsx() override;
|
||||
void on_init_thread() override;
|
||||
|
||||
void flip(int buffer) override;
|
||||
|
|
|
@ -1,22 +1,31 @@
|
|||
#include "stdafx.h"
|
||||
#include "Utilities/Config.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/state.h"
|
||||
#include "Emu/RSX/GSManager.h"
|
||||
#include "RSXThread.h"
|
||||
|
||||
#include "Emu/SysCalls/Callback.h"
|
||||
#include "Emu/SysCalls/CB_FUNC.h"
|
||||
#include "Emu/SysCalls/lv2/sys_time.h"
|
||||
#include "Emu/Cell/PPUCallback.h"
|
||||
|
||||
#include "Common/BufferUtils.h"
|
||||
#include "rsx_methods.h"
|
||||
|
||||
#define CMD_DEBUG 0
|
||||
|
||||
cfg::bool_entry g_cfg_rsx_write_color_buffers(cfg::root.video, "Write Color Buffers");
|
||||
cfg::bool_entry g_cfg_rsx_write_depth_buffer(cfg::root.video, "Write Depth Buffer");
|
||||
cfg::bool_entry g_cfg_rsx_read_color_buffers(cfg::root.video, "Read Color Buffers");
|
||||
cfg::bool_entry g_cfg_rsx_read_depth_buffer(cfg::root.video, "Read Depth Buffer");
|
||||
cfg::bool_entry g_cfg_rsx_log_programs(cfg::root.video, "Log shader programs");
|
||||
cfg::bool_entry g_cfg_rsx_vsync(cfg::root.video, "VSync");
|
||||
cfg::bool_entry g_cfg_rsx_3dtv(cfg::root.video, "3D Monitor");
|
||||
cfg::bool_entry g_cfg_rsx_debug_output(cfg::root.video, "Debug output");
|
||||
cfg::bool_entry g_cfg_rsx_overlay(cfg::root.video, "Debug overlay");
|
||||
|
||||
bool user_asked_for_frame_capture = false;
|
||||
frame_capture_data frame_debug;
|
||||
|
||||
namespace vm { using namespace ps3; }
|
||||
|
||||
namespace rsx
|
||||
{
|
||||
std::function<bool(u32 addr, bool is_writing)> g_access_violation_handler;
|
||||
|
@ -28,14 +37,14 @@ namespace rsx
|
|||
|
||||
void shaders_cache::load(const std::string &path, shader_language lang)
|
||||
{
|
||||
std::string lang_name = convert::to<std::string>(lang);
|
||||
const std::string lang_name = bijective_find<shader_language>(lang, "");
|
||||
|
||||
auto extract_hash = [](const std::string &string)
|
||||
{
|
||||
return std::stoull(string.substr(0, string.find('.')).c_str(), 0, 16);
|
||||
};
|
||||
|
||||
for (const fs::dir::entry &entry : fs::dir{ path })
|
||||
for (const auto& entry : fs::dir(path))
|
||||
{
|
||||
if (entry.name == "." || entry.name == "..")
|
||||
continue;
|
||||
|
@ -106,7 +115,7 @@ namespace rsx
|
|||
throw EXCEPTION("GetAddress(offset=0x%x, location=0x%x): RSXIO memory not mapped", offset, location);
|
||||
}
|
||||
|
||||
//if (Emu.GetGSManager().GetRender().strict_ordering[offset >> 20])
|
||||
//if (fxm::get<GSRender>()->strict_ordering[offset >> 20])
|
||||
//{
|
||||
// _mm_mfence(); // probably doesn't have any effect on current implementation
|
||||
//}
|
||||
|
@ -353,7 +362,7 @@ namespace rsx
|
|||
|
||||
last_flip_time = get_system_time() - 1000000;
|
||||
|
||||
scope_thread_t vblank(PURE_EXPR("VBlank Thread"s), [this]()
|
||||
scope_thread vblank("VBlank Thread", [this]()
|
||||
{
|
||||
const u64 start_time = get_system_time();
|
||||
|
||||
|
@ -386,8 +395,8 @@ namespace rsx
|
|||
{
|
||||
CHECK_EMU_STATUS;
|
||||
|
||||
be_t<u32> get = ctrl->get;
|
||||
be_t<u32> put = ctrl->put;
|
||||
const u32 get = ctrl->get;
|
||||
const u32 put = ctrl->put;
|
||||
|
||||
if (put == get || !Emu.IsRunning())
|
||||
{
|
||||
|
@ -442,10 +451,7 @@ namespace rsx
|
|||
u32 reg = cmd & CELL_GCM_METHOD_FLAG_NON_INCREMENT ? first_cmd : first_cmd + i;
|
||||
u32 value = args[i];
|
||||
|
||||
if (rpcs3::config.misc.log.rsx_logging.value())
|
||||
{
|
||||
LOG_NOTICE(RSX, "%s(0x%x) = 0x%x", get_method_name(reg).c_str(), reg, value);
|
||||
}
|
||||
LOG_TRACE(RSX, "%s(0x%x) = 0x%x", get_method_name(reg).c_str(), reg, value);
|
||||
|
||||
method_registers[reg] = value;
|
||||
if (capture_current_frame)
|
||||
|
@ -831,7 +837,7 @@ namespace rsx
|
|||
|
||||
m_used_gcm_commands.clear();
|
||||
|
||||
on_init();
|
||||
on_init_rsx();
|
||||
start();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
#pragma once
|
||||
|
||||
#include <stack>
|
||||
#include <deque>
|
||||
#include <set>
|
||||
#include <future>
|
||||
#include "GCM.h"
|
||||
#include "RSXTexture.h"
|
||||
#include "RSXVertexProgram.h"
|
||||
#include "RSXFragmentProgram.h"
|
||||
|
||||
#include <stack>
|
||||
#include "Utilities/Semaphore.h"
|
||||
#include "Utilities/Thread.h"
|
||||
#include "Utilities/Timer.h"
|
||||
#include "Utilities/convert.h"
|
||||
|
||||
extern u64 get_system_time();
|
||||
|
||||
|
@ -46,44 +48,20 @@ namespace rsx
|
|||
enum class shader_language
|
||||
{
|
||||
glsl,
|
||||
hlsl
|
||||
hlsl,
|
||||
};
|
||||
}
|
||||
|
||||
namespace convert
|
||||
template<>
|
||||
struct bijective<rsx::shader_language, const char*>
|
||||
{
|
||||
template<>
|
||||
struct to_impl_t<rsx::shader_language, std::string>
|
||||
static constexpr std::pair<rsx::shader_language, const char*> map[]
|
||||
{
|
||||
static rsx::shader_language func(const std::string &from)
|
||||
{
|
||||
if (from == "glsl")
|
||||
return rsx::shader_language::glsl;
|
||||
|
||||
if (from == "hlsl")
|
||||
return rsx::shader_language::hlsl;
|
||||
|
||||
throw;
|
||||
}
|
||||
{ rsx::shader_language::glsl, "glsl" },
|
||||
{ rsx::shader_language::hlsl, "hlsl" },
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct to_impl_t<std::string, rsx::shader_language>
|
||||
{
|
||||
static std::string func(rsx::shader_language from)
|
||||
{
|
||||
switch (from)
|
||||
{
|
||||
case rsx::shader_language::glsl:
|
||||
return "glsl";
|
||||
case rsx::shader_language::hlsl:
|
||||
return "hlsl";
|
||||
}
|
||||
|
||||
throw;
|
||||
}
|
||||
};
|
||||
}
|
||||
namespace rsx
|
||||
{
|
||||
namespace limits
|
||||
|
@ -212,7 +190,7 @@ namespace rsx
|
|||
indexed,
|
||||
};
|
||||
|
||||
class thread : public named_thread_t
|
||||
class thread : public named_thread
|
||||
{
|
||||
protected:
|
||||
std::stack<u32> m_call_stack;
|
||||
|
@ -280,7 +258,6 @@ namespace rsx
|
|||
u32 gcm_buffers_count;
|
||||
u32 gcm_current_buffer;
|
||||
u32 ctxt_addr;
|
||||
u32 report_main_addr;
|
||||
u32 label_addr;
|
||||
rsx::draw_command draw_command;
|
||||
primitive_type draw_mode;
|
||||
|
@ -324,10 +301,13 @@ namespace rsx
|
|||
public:
|
||||
virtual std::string get_name() const override;
|
||||
|
||||
virtual void on_init() override {} // disable start() (TODO)
|
||||
virtual void on_stop() override {} // disable join()
|
||||
|
||||
virtual void begin();
|
||||
virtual void end();
|
||||
|
||||
virtual void on_init() = 0;
|
||||
virtual void on_init_rsx() = 0;
|
||||
virtual void on_init_thread() = 0;
|
||||
virtual bool do_method(u32 cmd, u32 value) { return false; }
|
||||
virtual void flip(int buffer) = 0;
|
||||
|
|
|
@ -17,4 +17,4 @@ namespace vk
|
|||
|
||||
const varying_register_t& get_varying_register(const std::string& name);
|
||||
bool compile_glsl_to_spv(std::string& shader, glsl::program_domain domain, std::vector<u32> &spv);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -276,7 +276,7 @@ void VKFragmentProgram::Decompile(const RSXFragmentProgram& prog)
|
|||
|
||||
void VKFragmentProgram::Compile()
|
||||
{
|
||||
fs::file(fs::get_config_dir() + "FragmentProgram.frag", fom::rewrite).write(shader);
|
||||
fs::file(fs::get_config_dir() + "FragmentProgram.frag", fs::rewrite).write(shader);
|
||||
|
||||
std::vector<u32> spir_v;
|
||||
if (!vk::compile_glsl_to_spv(shader, vk::glsl::glsl_fragment_program, spir_v))
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#include "stdafx.h"
|
||||
#include "Utilities/rPlatform.h" // only for rImage
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/state.h"
|
||||
#include "VKGSRender.h"
|
||||
#include "../rsx_methods.h"
|
||||
#include "../Common/BufferUtils.h"
|
||||
|
|
|
@ -251,4 +251,4 @@ namespace vk
|
|||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,15 +8,14 @@
|
|||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
#include "Emu/state.h"
|
||||
#include "Utilities/Config.h"
|
||||
#include "VulkanAPI.h"
|
||||
#include "../GCM.h"
|
||||
#include "../Common/TextureUtils.h"
|
||||
#include "../Common/ring_buffer_helper.h"
|
||||
|
||||
extern cfg::bool_entry g_cfg_rsx_debug_output;
|
||||
|
||||
namespace rsx
|
||||
{
|
||||
class texture;
|
||||
|
@ -174,7 +173,7 @@ namespace vk
|
|||
|
||||
std::vector<const char *> layers;
|
||||
|
||||
if (rpcs3::config.rsx.d3d12.debug_output.value())
|
||||
if (g_cfg_rsx_debug_output)
|
||||
layers.push_back("VK_LAYER_LUNARG_standard_validation");
|
||||
|
||||
VkDeviceCreateInfo device;
|
||||
|
@ -1039,7 +1038,7 @@ namespace vk
|
|||
|
||||
std::vector<const char *> layers;
|
||||
|
||||
if (rpcs3::config.rsx.d3d12.debug_output.value())
|
||||
if (g_cfg_rsx_debug_output)
|
||||
layers.push_back("VK_LAYER_LUNARG_standard_validation");
|
||||
|
||||
VkInstanceCreateInfo instance_info = {};
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#include "stdafx.h"
|
||||
#include "Utilities/rPlatform.h" // only for rImage
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/state.h"
|
||||
#include "VKGSRender.h"
|
||||
#include "../rsx_methods.h"
|
||||
#include "../Common/BufferUtils.h"
|
||||
|
@ -590,4 +588,5 @@ VKGSRender::upload_vertex_data()
|
|||
}
|
||||
|
||||
return std::make_tuple(prims, is_indexed_draw, index_count, offset_in_index_buffer, index_format);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -253,7 +253,7 @@ void VKVertexProgram::Decompile(const RSXVertexProgram& prog)
|
|||
|
||||
void VKVertexProgram::Compile()
|
||||
{
|
||||
fs::file(fs::get_config_dir() + "VertexProgram.vert", fom::rewrite).write(shader);
|
||||
fs::file(fs::get_config_dir() + "VertexProgram.vert", fs::rewrite).write(shader);
|
||||
|
||||
std::vector<u32> spir_v;
|
||||
if (!vk::compile_glsl_to_spv(shader, vk::glsl::glsl_vertex_program, spir_v))
|
||||
|
|
|
@ -1 +1 @@
|
|||
#include "stdafx.h"
|
||||
#include "stdafx.h"
|
||||
|
|
|
@ -1,12 +1,21 @@
|
|||
#include "stdafx.h"
|
||||
#include "Utilities/Config.h"
|
||||
#include "rsx_methods.h"
|
||||
#include "RSXThread.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/state.h"
|
||||
#include "rsx_utils.h"
|
||||
#include "Emu/SysCalls/Callback.h"
|
||||
#include "Emu/SysCalls/CB_FUNC.h"
|
||||
#include "Emu/Cell/PPUCallback.h"
|
||||
|
||||
cfg::map_entry<double> g_cfg_rsx_frame_limit(cfg::root.video, "Frame limit",
|
||||
{
|
||||
{ "Off", 0. },
|
||||
{ "59.94", 59.94 },
|
||||
{ "50", 50. },
|
||||
{ "60", 60. },
|
||||
{ "30", 30. },
|
||||
{ "Auto", -1. },
|
||||
});
|
||||
|
||||
namespace rsx
|
||||
{
|
||||
|
@ -667,24 +676,14 @@ namespace rsx
|
|||
|
||||
rsx->sem_flip.post_and_wait();
|
||||
|
||||
//sync
|
||||
double limit;
|
||||
switch (rpcs3::state.config.rsx.frame_limit.value())
|
||||
if (double limit = g_cfg_rsx_frame_limit.get())
|
||||
{
|
||||
case rsx_frame_limit::_50: limit = 50.; break;
|
||||
case rsx_frame_limit::_59_94: limit = 59.94; break;
|
||||
case rsx_frame_limit::_30: limit = 30.; break;
|
||||
case rsx_frame_limit::_60: limit = 60.; break;
|
||||
case rsx_frame_limit::Auto: limit = rsx->fps_limit; break; //TODO
|
||||
if (limit < 0) limit = rsx->fps_limit; // TODO
|
||||
|
||||
case rsx_frame_limit::Off:
|
||||
default:
|
||||
return;
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds((s64)(1000.0 / limit - rsx->timer_sync.GetElapsedTimeInMilliSec())));
|
||||
rsx->timer_sync.Start();
|
||||
rsx->local_transform_constants.clear();
|
||||
}
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds((s64)(1000.0 / limit - rsx->timer_sync.GetElapsedTimeInMilliSec())));
|
||||
rsx->timer_sync.Start();
|
||||
rsx->local_transform_constants.clear();
|
||||
}
|
||||
|
||||
void user_command(thread* rsx, u32 arg)
|
||||
|
|
Loading…
Add table
Reference in a new issue