d3d12: Rename D3D12GSRender function

Match a_b_c coding style.
This commit is contained in:
Vincent Lejeune 2015-10-28 19:02:17 +01:00
parent 124d0de325
commit c197b54774
6 changed files with 40 additions and 48 deletions

View file

@ -140,7 +140,7 @@ void D3D12GSRender::load_vertex_index_data(u32 first, u32 count)
m_renderingInfo.m_indexed = true;
}
void D3D12GSRender::setScaleOffset(size_t descriptorIndex)
void D3D12GSRender::upload_and_bind_scale_offset_matrix(size_t descriptorIndex)
{
float scale_offset_matrix[16] =
{
@ -189,7 +189,7 @@ void D3D12GSRender::setScaleOffset(size_t descriptorIndex)
.Offset((INT)descriptorIndex, g_descriptorStrideSRVCBVUAV));
}
void D3D12GSRender::FillVertexShaderConstantsBuffer(size_t descriptor_index)
void D3D12GSRender::upload_and_bind_vertex_shader_constants(size_t descriptor_index)
{
for (const auto &entry : transform_constants)
local_transform_constants[entry.first] = entry.second;
@ -222,7 +222,7 @@ void D3D12GSRender::FillVertexShaderConstantsBuffer(size_t descriptor_index)
.Offset((INT)descriptor_index, g_descriptorStrideSRVCBVUAV));
}
void D3D12GSRender::FillPixelShaderConstantsBuffer(size_t descriptor_index)
void D3D12GSRender::upload_and_bind_fragment_shader_constants(size_t descriptor_index)
{
// Get constant from fragment program
const std::vector<size_t> &fragment_constant_offsets = m_cachePSO.getFragmentConstantOffsetsCache(&fragment_program);
@ -265,7 +265,7 @@ void D3D12GSRender::FillPixelShaderConstantsBuffer(size_t descriptor_index)
.Offset((INT)descriptor_index, g_descriptorStrideSRVCBVUAV));
}
void D3D12GSRender::upload_vertex_index_data(ID3D12GraphicsCommandList *command_list)
void D3D12GSRender::upload_and_set_vertex_index_data(ID3D12GraphicsCommandList *command_list)
{
// Index count
m_renderingInfo.m_count = 0;

View file

@ -206,7 +206,7 @@ D3D12GSRender::D3D12GSRender()
m_textureUploadData.init(m_device.Get(), 1024 * 1024 * 512, D3D12_HEAP_TYPE_UPLOAD, D3D12_HEAP_FLAG_NONE);
if (rpcs3::config.rsx.d3d12.overlay.value())
InitD2DStructures();
init_d2d_structures();
}
D3D12GSRender::~D3D12GSRender()
@ -230,7 +230,7 @@ D3D12GSRender::~D3D12GSRender()
m_rtts.Release();
m_outputScalingPass.Release();
ReleaseD2DStructures();
release_d2d_structures();
}
void D3D12GSRender::onexit_thread()
@ -245,10 +245,10 @@ bool D3D12GSRender::domethod(u32 cmd, u32 arg)
clear_surface(arg);
return true;
case NV4097_TEXTURE_READ_SEMAPHORE_RELEASE:
semaphore_PGRAPH_texture_read_release();
copy_render_target_to_dma_location();
return false; //call rsx::thread method implementation
case NV4097_BACK_END_WRITE_SEMAPHORE_RELEASE:
semaphore_PGRAPH_backend_release();
copy_render_target_to_dma_location();
return false; //call rsx::thread method implementation
default:
@ -312,7 +312,7 @@ void D3D12GSRender::clear_surface(u32 arg)
std::chrono::time_point<std::chrono::system_clock> start_duration = std::chrono::system_clock::now();
std::chrono::time_point<std::chrono::system_clock> rtt_duration_start = std::chrono::system_clock::now();
PrepareRenderTargets(getCurrentResourceStorage().command_list.Get());
prepare_render_targets(getCurrentResourceStorage().command_list.Get());
std::chrono::time_point<std::chrono::system_clock> rtt_duration_end = std::chrono::system_clock::now();
m_timers.m_rttDuration += std::chrono::duration_cast<std::chrono::microseconds>(rtt_duration_end - rtt_duration_start).count();
@ -365,7 +365,7 @@ void D3D12GSRender::end()
std::chrono::time_point<std::chrono::system_clock> start_duration = std::chrono::system_clock::now();
std::chrono::time_point<std::chrono::system_clock> rtt_duration_start = std::chrono::system_clock::now();
PrepareRenderTargets(getCurrentResourceStorage().command_list.Get());
prepare_render_targets(getCurrentResourceStorage().command_list.Get());
std::chrono::time_point<std::chrono::system_clock> rtt_duration_end = std::chrono::system_clock::now();
m_timers.m_rttDuration += std::chrono::duration_cast<std::chrono::microseconds>(rtt_duration_end - rtt_duration_start).count();
@ -373,13 +373,13 @@ void D3D12GSRender::end()
std::chrono::time_point<std::chrono::system_clock> vertex_index_duration_start = std::chrono::system_clock::now();
if (!vertex_index_array.empty() || vertex_draw_count)
upload_vertex_index_data(getCurrentResourceStorage().command_list.Get());
upload_and_set_vertex_index_data(getCurrentResourceStorage().command_list.Get());
std::chrono::time_point<std::chrono::system_clock> vertex_index_duration_end = std::chrono::system_clock::now();
m_timers.m_vertexIndexDuration += 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();
if (!LoadProgram())
if (!load_program())
{
LOG_ERROR(RSX, "LoadProgram failed.");
Emu.Pause();
@ -395,9 +395,9 @@ void D3D12GSRender::end()
size_t currentDescriptorIndex = getCurrentResourceStorage().descriptors_heap_index;
// Constants
setScaleOffset(currentDescriptorIndex);
FillVertexShaderConstantsBuffer(currentDescriptorIndex + 1);
FillPixelShaderConstantsBuffer(currentDescriptorIndex + 2);
upload_and_bind_scale_offset_matrix(currentDescriptorIndex);
upload_and_bind_vertex_shader_constants(currentDescriptorIndex + 1);
upload_and_bind_fragment_shader_constants(currentDescriptorIndex + 2);
std::chrono::time_point<std::chrono::system_clock> constants_duration_end = std::chrono::system_clock::now();
m_timers.m_constantsDuration += std::chrono::duration_cast<std::chrono::microseconds>(constants_duration_end - constants_duration_start).count();
@ -645,9 +645,9 @@ void D3D12GSRender::flip(int buffer)
m_commandQueueGraphic->ExecuteCommandLists(1, (ID3D12CommandList**)getCurrentResourceStorage().command_list.GetAddressOf());
if(rpcs3::config.rsx.d3d12.overlay.value())
renderOverlay();
render_overlay();
ResetTimer();
reset_timer();
std::chrono::time_point<std::chrono::system_clock> flip_start = std::chrono::system_clock::now();
@ -695,7 +695,7 @@ void D3D12GSRender::flip(int buffer)
m_timers.m_flipDuration += std::chrono::duration_cast<std::chrono::microseconds>(flip_end - flip_start).count();
}
void D3D12GSRender::ResetTimer()
void D3D12GSRender::reset_timer()
{
m_timers.m_drawCallCount = 0;
m_timers.m_drawCallDuration = 0;
@ -785,12 +785,7 @@ void copy_readback_buffer_to_dest(void *dest, ID3D12Resource *res, size_t dst_pi
}
}
void D3D12GSRender::semaphore_PGRAPH_texture_read_release()
{
semaphore_PGRAPH_backend_release();
}
void D3D12GSRender::semaphore_PGRAPH_backend_release()
void D3D12GSRender::copy_render_target_to_dma_location()
{
// Add all buffer write
// Cell can't make any assumption about readyness of color/depth buffer

View file

@ -87,7 +87,7 @@ private:
size_t m_flipDuration;
} m_timers;
void ResetTimer();
void reset_timer();
struct Shader
{
@ -145,8 +145,6 @@ private:
// Used to fill unused texture slot
ID3D12Resource *m_dummyTexture;
size_t m_lastWidth, m_lastHeight, m_lastDepth;
// Store previous fbo addresses to detect RTT config changes.
u32 m_previous_address_a;
u32 m_previous_address_b;
@ -154,26 +152,19 @@ private:
u32 m_previous_address_d;
u32 m_previous_address_z;
public:
u32 m_draw_frames;
u32 m_skip_frames;
D3D12GSRender();
virtual ~D3D12GSRender();
void semaphore_PGRAPH_texture_read_release();
void semaphore_PGRAPH_backend_release();
private:
void InitD2DStructures();
void ReleaseD2DStructures();
void init_d2d_structures();
void release_d2d_structures();
bool LoadProgram();
bool load_program();
/**
* Create vertex and index buffers (if needed) and set them to cmdlist.
* Non native primitive type are emulated by index buffers expansion.
*/
void upload_vertex_index_data(ID3D12GraphicsCommandList *cmdlist);
void upload_and_set_vertex_index_data(ID3D12GraphicsCommandList *command_list);
std::vector<std::pair<u32, u32> > m_first_count_pairs;
/**
@ -183,9 +174,9 @@ private:
*/
void upload_vertex_attributes(const std::vector<std::pair<u32, u32> > &vertex_ranges);
void setScaleOffset(size_t descriptorIndex);
void FillVertexShaderConstantsBuffer(size_t descriptorIndex);
void FillPixelShaderConstantsBuffer(size_t descriptorIndex);
void upload_and_bind_scale_offset_matrix(size_t descriptor_index);
void upload_and_bind_vertex_shader_constants(size_t descriptor_index);
void upload_and_bind_fragment_shader_constants(size_t descriptorIndex);
/**
* Fetch all textures recorded in the state in the render target cache and in the texture cache.
* If a texture is not cached, populate cmdlist with uploads command.
@ -199,15 +190,21 @@ private:
* Populate cmdlist with render target state change (from RTT to generic read for previous rtt,
* from generic to rtt for rtt in cache).
*/
void PrepareRenderTargets(ID3D12GraphicsCommandList *cmdlist);
void prepare_render_targets(ID3D12GraphicsCommandList *command_list);
/**
* Render D2D overlay if enabled on top of the backbuffer.
*/
void renderOverlay();
void render_overlay();
void clear_surface(u32 arg);
/**
* Copy currently bound current target to the dma location affecting them.
* NOTE: We should also copy previously bound rtts.
*/
void copy_render_target_to_dma_location();
protected:
virtual void onexit_thread() override;
virtual bool domethod(u32 cmd, u32 arg) override;

View file

@ -22,7 +22,7 @@ ComPtr<ID2D1SolidColorBrush> m_textBrush;
extern PFN_D3D11ON12_CREATE_DEVICE wrapD3D11On12CreateDevice;
void D3D12GSRender::InitD2DStructures()
void D3D12GSRender::init_d2d_structures()
{
wrapD3D11On12CreateDevice(
m_device.Get(),
@ -94,7 +94,7 @@ void D3D12GSRender::InitD2DStructures()
m_textFormat->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_NEAR);
}
void D3D12GSRender::ReleaseD2DStructures()
void D3D12GSRender::release_d2d_structures()
{
d3d11Device.Reset();
m_d3d11DeviceContext.Reset();
@ -112,7 +112,7 @@ void D3D12GSRender::ReleaseD2DStructures()
m_textBrush.Reset();
}
void D3D12GSRender::renderOverlay()
void D3D12GSRender::render_overlay()
{
D2D1_SIZE_F rtSize = m_d2dRenderTargets[m_swapChain->GetCurrentBackBufferIndex()]->GetSize();
std::wstring duration = L"Draw duration : " + std::to_wstring(m_timers.m_drawCallDuration) + L" us";

View file

@ -34,7 +34,7 @@ void Shader::Compile(const std::string &code, SHADER_TYPE st)
}
}
bool D3D12GSRender::LoadProgram()
bool D3D12GSRender::load_program()
{
RSXVertexProgram vertex_program;
u32 transform_program_start = rsx::method_registers[NV4097_SET_TRANSFORM_PROGRAM_START];

View file

@ -13,7 +13,7 @@
#include "D3D12GSRender.h"
#include "D3D12Formats.h"
void D3D12GSRender::PrepareRenderTargets(ID3D12GraphicsCommandList *copycmdlist)
void D3D12GSRender::prepare_render_targets(ID3D12GraphicsCommandList *copycmdlist)
{
u32 surface_format = rsx::method_registers[NV4097_SET_SURFACE_FORMAT];