mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-04 22:11:26 +12:00
commit
34336ebfce
7 changed files with 23 additions and 19 deletions
|
@ -38,8 +38,8 @@ D3D12_BLEND get_blend_factor(u16 factor)
|
||||||
case CELL_GCM_DST_COLOR: return D3D12_BLEND_DEST_COLOR;
|
case CELL_GCM_DST_COLOR: return D3D12_BLEND_DEST_COLOR;
|
||||||
case CELL_GCM_ONE_MINUS_DST_COLOR: return D3D12_BLEND_INV_DEST_COLOR;
|
case CELL_GCM_ONE_MINUS_DST_COLOR: return D3D12_BLEND_INV_DEST_COLOR;
|
||||||
case CELL_GCM_SRC_ALPHA_SATURATE: return D3D12_BLEND_SRC_ALPHA_SAT;
|
case CELL_GCM_SRC_ALPHA_SATURATE: return D3D12_BLEND_SRC_ALPHA_SAT;
|
||||||
case CELL_GCM_CONSTANT_COLOR:
|
case CELL_GCM_CONSTANT_COLOR: return D3D12_BLEND_DEST_COLOR;
|
||||||
case CELL_GCM_ONE_MINUS_CONSTANT_COLOR:
|
case CELL_GCM_ONE_MINUS_CONSTANT_COLOR: return D3D12_BLEND_INV_DEST_COLOR;
|
||||||
case CELL_GCM_CONSTANT_ALPHA:
|
case CELL_GCM_CONSTANT_ALPHA:
|
||||||
case CELL_GCM_ONE_MINUS_CONSTANT_ALPHA:
|
case CELL_GCM_ONE_MINUS_CONSTANT_ALPHA:
|
||||||
break;
|
break;
|
||||||
|
@ -292,8 +292,7 @@ D3D12_PRIMITIVE_TOPOLOGY_TYPE get_primitive_topology_type(u8 draw_mode)
|
||||||
case CELL_GCM_PRIMITIVE_QUADS: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
case CELL_GCM_PRIMITIVE_QUADS: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
||||||
case CELL_GCM_PRIMITIVE_QUAD_STRIP: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
case CELL_GCM_PRIMITIVE_QUAD_STRIP: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
||||||
case CELL_GCM_PRIMITIVE_POLYGON: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
case CELL_GCM_PRIMITIVE_POLYGON: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
||||||
case CELL_GCM_PRIMITIVE_LINE_LOOP:
|
case CELL_GCM_PRIMITIVE_LINE_LOOP: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
throw EXCEPTION("Invalid or unsupported draw mode (0x%x)", draw_mode);
|
throw EXCEPTION("Invalid or unsupported draw mode (0x%x)", draw_mode);
|
||||||
}
|
}
|
||||||
|
@ -303,9 +302,11 @@ DXGI_FORMAT get_color_surface_format(u8 format)
|
||||||
switch (format)
|
switch (format)
|
||||||
{
|
{
|
||||||
case CELL_GCM_SURFACE_R5G6B5: return DXGI_FORMAT_B5G6R5_UNORM;
|
case CELL_GCM_SURFACE_R5G6B5: return DXGI_FORMAT_B5G6R5_UNORM;
|
||||||
|
case CELL_GCM_SURFACE_X8R8G8B8_O8R8G8B8: return DXGI_FORMAT_B8G8R8X8_UNORM; //BIT.TRIP Runner2 use this
|
||||||
case CELL_GCM_SURFACE_A8R8G8B8: return DXGI_FORMAT_R8G8B8A8_UNORM;
|
case CELL_GCM_SURFACE_A8R8G8B8: return DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||||
case CELL_GCM_SURFACE_F_W16Z16Y16X16: return DXGI_FORMAT_R16G16B16A16_FLOAT;
|
case CELL_GCM_SURFACE_F_W16Z16Y16X16: return DXGI_FORMAT_R16G16B16A16_FLOAT;
|
||||||
case CELL_GCM_SURFACE_F_X32: return DXGI_FORMAT_R32_FLOAT;
|
case CELL_GCM_SURFACE_F_X32: return DXGI_FORMAT_R32_FLOAT;
|
||||||
|
case CELL_GCM_SURFACE_A8B8G8R8: return DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||||
}
|
}
|
||||||
throw EXCEPTION("Invalid format (0x%x)", format);
|
throw EXCEPTION("Invalid format (0x%x)", format);
|
||||||
}
|
}
|
||||||
|
|
|
@ -271,12 +271,7 @@ void D3D12GSRender::end()
|
||||||
m_timers.m_vertex_index_duration += std::chrono::duration_cast<std::chrono::microseconds>(vertex_index_duration_end - vertex_index_duration_start).count();
|
m_timers.m_vertex_index_duration += std::chrono::duration_cast<std::chrono::microseconds>(vertex_index_duration_end - vertex_index_duration_start).count();
|
||||||
|
|
||||||
std::chrono::time_point<std::chrono::system_clock> program_load_start = std::chrono::system_clock::now();
|
std::chrono::time_point<std::chrono::system_clock> program_load_start = std::chrono::system_clock::now();
|
||||||
if (!load_program())
|
load_program();
|
||||||
{
|
|
||||||
LOG_ERROR(RSX, "LoadProgram failed.");
|
|
||||||
Emu.Pause();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
std::chrono::time_point<std::chrono::system_clock> program_load_end = std::chrono::system_clock::now();
|
std::chrono::time_point<std::chrono::system_clock> program_load_end = std::chrono::system_clock::now();
|
||||||
m_timers.m_program_load_duration += std::chrono::duration_cast<std::chrono::microseconds>(program_load_end - program_load_start).count();
|
m_timers.m_program_load_duration += std::chrono::duration_cast<std::chrono::microseconds>(program_load_end - program_load_start).count();
|
||||||
|
|
||||||
|
@ -301,12 +296,6 @@ void D3D12GSRender::end()
|
||||||
{
|
{
|
||||||
upload_and_bind_textures(get_current_resource_storage().command_list.Get(), currentDescriptorIndex + 3, std::get<2>(*m_current_pso) > 0);
|
upload_and_bind_textures(get_current_resource_storage().command_list.Get(), currentDescriptorIndex + 3, std::get<2>(*m_current_pso) > 0);
|
||||||
|
|
||||||
ID3D12DescriptorHeap *descriptors[] =
|
|
||||||
{
|
|
||||||
get_current_resource_storage().descriptors_heap.Get(),
|
|
||||||
get_current_resource_storage().sampler_descriptor_heap[get_current_resource_storage().sampler_descriptors_heap_index].Get(),
|
|
||||||
};
|
|
||||||
get_current_resource_storage().command_list->SetDescriptorHeaps(2, descriptors);
|
|
||||||
|
|
||||||
get_current_resource_storage().command_list->SetGraphicsRootDescriptorTable(0,
|
get_current_resource_storage().command_list->SetGraphicsRootDescriptorTable(0,
|
||||||
CD3DX12_GPU_DESCRIPTOR_HANDLE(get_current_resource_storage().descriptors_heap->GetGPUDescriptorHandleForHeapStart())
|
CD3DX12_GPU_DESCRIPTOR_HANDLE(get_current_resource_storage().descriptors_heap->GetGPUDescriptorHandleForHeapStart())
|
||||||
|
|
|
@ -85,6 +85,13 @@ void resource_storage::reset()
|
||||||
void resource_storage::set_new_command_list()
|
void resource_storage::set_new_command_list()
|
||||||
{
|
{
|
||||||
CHECK_HRESULT(command_list->Reset(command_allocator.Get(), nullptr));
|
CHECK_HRESULT(command_list->Reset(command_allocator.Get(), nullptr));
|
||||||
|
|
||||||
|
ID3D12DescriptorHeap *descriptors[] =
|
||||||
|
{
|
||||||
|
descriptors_heap.Get(),
|
||||||
|
sampler_descriptor_heap[sampler_descriptors_heap_index].Get(),
|
||||||
|
};
|
||||||
|
command_list->SetDescriptorHeaps(2, descriptors);
|
||||||
}
|
}
|
||||||
|
|
||||||
void resource_storage::init(ID3D12Device *device)
|
void resource_storage::init(ID3D12Device *device)
|
||||||
|
|
|
@ -220,7 +220,7 @@ struct D3D12Traits
|
||||||
|
|
||||||
graphicPipelineStateDesc.IBStripCutValue = pipelineProperties.CutValue;
|
graphicPipelineStateDesc.IBStripCutValue = pipelineProperties.CutValue;
|
||||||
|
|
||||||
extraData.first->CreateGraphicsPipelineState(&graphicPipelineStateDesc, IID_PPV_ARGS(&std::get<0>(*result)));
|
CHECK_HRESULT(extraData.first->CreateGraphicsPipelineState(&graphicPipelineStateDesc, IID_PPV_ARGS(&std::get<0>(*result))));
|
||||||
std::get<1>(*result) = vertexProgramData.vertex_shader_inputs;
|
std::get<1>(*result) = vertexProgramData.vertex_shader_inputs;
|
||||||
|
|
||||||
std::wstring name = L"PSO_" + std::to_wstring(vertexProgramData.id) + L"_" + std::to_wstring(fragmentProgramData.id);
|
std::wstring name = L"PSO_" + std::to_wstring(vertexProgramData.id) + L"_" + std::to_wstring(fragmentProgramData.id);
|
||||||
|
|
|
@ -272,7 +272,7 @@ ID3D12Resource *render_targets::bind_address_as_render_targets(ID3D12Device *dev
|
||||||
{
|
{
|
||||||
ComPtr<ID3D12Resource> rtt;
|
ComPtr<ID3D12Resource> rtt;
|
||||||
rtt = It->second.Get();
|
rtt = It->second.Get();
|
||||||
if (rtt->GetDesc().Format == dxgi_format)
|
if (rtt->GetDesc().Format == dxgi_format && rtt->GetDesc().Width == width && rtt->GetDesc().Height == height)
|
||||||
{
|
{
|
||||||
cmdList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(rtt.Get(), D3D12_RESOURCE_STATE_GENERIC_READ, D3D12_RESOURCE_STATE_RENDER_TARGET));
|
cmdList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(rtt.Get(), D3D12_RESOURCE_STATE_GENERIC_READ, D3D12_RESOURCE_STATE_RENDER_TARGET));
|
||||||
return rtt.Get();
|
return rtt.Get();
|
||||||
|
|
|
@ -335,6 +335,13 @@ void D3D12GSRender::upload_and_bind_textures(ID3D12GraphicsCommandList *command_
|
||||||
{
|
{
|
||||||
get_current_resource_storage().sampler_descriptors_heap_index = 1;
|
get_current_resource_storage().sampler_descriptors_heap_index = 1;
|
||||||
get_current_resource_storage().current_sampler_index = 0;
|
get_current_resource_storage().current_sampler_index = 0;
|
||||||
|
|
||||||
|
ID3D12DescriptorHeap *descriptors[] =
|
||||||
|
{
|
||||||
|
get_current_resource_storage().descriptors_heap.Get(),
|
||||||
|
get_current_resource_storage().sampler_descriptor_heap[get_current_resource_storage().sampler_descriptors_heap_index].Get(),
|
||||||
|
};
|
||||||
|
command_list->SetDescriptorHeaps(2, descriptors);
|
||||||
}
|
}
|
||||||
m_device->CreateSampler(&get_sampler_desc(textures[i]),
|
m_device->CreateSampler(&get_sampler_desc(textures[i]),
|
||||||
CD3DX12_CPU_DESCRIPTOR_HANDLE(get_current_resource_storage().sampler_descriptor_heap[get_current_resource_storage().sampler_descriptors_heap_index]->GetCPUDescriptorHandleForHeapStart())
|
CD3DX12_CPU_DESCRIPTOR_HANDLE(get_current_resource_storage().sampler_descriptor_heap[get_current_resource_storage().sampler_descriptors_heap_index]->GetCPUDescriptorHandleForHeapStart())
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
using namespace Microsoft::WRL;
|
using namespace Microsoft::WRL;
|
||||||
|
|
||||||
#define CHECK_HRESULT(expr) if (HRESULT hr = (expr)) if (FAILED(hr)) throw EXCEPTION("HRESULT = 0x%x", hr)
|
#define CHECK_HRESULT(expr) { HRESULT hr = (expr); if (FAILED(hr)) throw EXCEPTION("HRESULT = 0x%x", hr); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send data to dst pointer without polluting cache.
|
* Send data to dst pointer without polluting cache.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue