mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 11:36:13 +00:00
d3d12: Clean code + fix warnings
This commit is contained in:
parent
001dc7cf57
commit
aac93b9063
3 changed files with 7 additions and 302 deletions
|
@ -926,7 +926,7 @@ void D3D12GSRender::ExecCMD()
|
|||
}
|
||||
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE *DepthStencilHandle = &m_rtts.m_depthStencilDescriptorHeap->GetCPUDescriptorHandleForHeapStart();
|
||||
commandList->OMSetRenderTargets(numRTT, &m_rtts.m_renderTargetsDescriptorsHeap->GetCPUDescriptorHandleForHeapStart(), true, DepthStencilHandle);
|
||||
commandList->OMSetRenderTargets((UINT)numRTT, &m_rtts.m_renderTargetsDescriptorsHeap->GetCPUDescriptorHandleForHeapStart(), true, DepthStencilHandle);
|
||||
|
||||
D3D12_VIEWPORT viewport =
|
||||
{
|
||||
|
@ -996,301 +996,6 @@ void D3D12GSRender::ExecCMD()
|
|||
m_commandQueueGraphic->ExecuteCommandLists(1, (ID3D12CommandList**)&commandList);
|
||||
m_indexed_array.Reset();
|
||||
WriteDepthBuffer();
|
||||
|
||||
/* if (m_set_color_mask)
|
||||
{
|
||||
glColorMask(m_color_mask_r, m_color_mask_g, m_color_mask_b, m_color_mask_a);
|
||||
checkForGlError("glColorMask");
|
||||
}
|
||||
|
||||
if (!m_indexed_array.m_count && !m_draw_array_count)
|
||||
{
|
||||
u32 min_vertex_size = ~0;
|
||||
for (auto &i : m_vertex_data)
|
||||
{
|
||||
if (!i.size)
|
||||
continue;
|
||||
|
||||
u32 vertex_size = i.data.size() / (i.size * i.GetTypeSize());
|
||||
|
||||
if (min_vertex_size > vertex_size)
|
||||
min_vertex_size = vertex_size;
|
||||
}
|
||||
|
||||
m_draw_array_count = min_vertex_size;
|
||||
m_draw_array_first = 0;
|
||||
}
|
||||
|
||||
Enable(m_set_depth_test, GL_DEPTH_TEST);
|
||||
Enable(m_set_alpha_test, GL_ALPHA_TEST);
|
||||
Enable(m_set_blend || m_set_blend_mrt1 || m_set_blend_mrt2 || m_set_blend_mrt3, GL_BLEND);
|
||||
Enable(m_set_scissor_horizontal && m_set_scissor_vertical, GL_SCISSOR_TEST);
|
||||
Enable(m_set_logic_op, GL_LOGIC_OP);
|
||||
Enable(m_set_cull_face, GL_CULL_FACE);
|
||||
Enable(m_set_dither, GL_DITHER);
|
||||
Enable(m_set_stencil_test, GL_STENCIL_TEST);
|
||||
Enable(m_set_line_smooth, GL_LINE_SMOOTH);
|
||||
Enable(m_set_poly_smooth, GL_POLYGON_SMOOTH);
|
||||
Enable(m_set_point_sprite_control, GL_POINT_SPRITE);
|
||||
Enable(m_set_specular, GL_LIGHTING);
|
||||
Enable(m_set_poly_offset_fill, GL_POLYGON_OFFSET_FILL);
|
||||
Enable(m_set_poly_offset_line, GL_POLYGON_OFFSET_LINE);
|
||||
Enable(m_set_poly_offset_point, GL_POLYGON_OFFSET_POINT);
|
||||
Enable(m_set_restart_index, GL_PRIMITIVE_RESTART);
|
||||
Enable(m_set_line_stipple, GL_LINE_STIPPLE);
|
||||
Enable(m_set_polygon_stipple, GL_POLYGON_STIPPLE);
|
||||
|
||||
if (m_set_clip_plane)
|
||||
{
|
||||
Enable(m_clip_plane_0, GL_CLIP_PLANE0);
|
||||
Enable(m_clip_plane_1, GL_CLIP_PLANE1);
|
||||
Enable(m_clip_plane_2, GL_CLIP_PLANE2);
|
||||
Enable(m_clip_plane_3, GL_CLIP_PLANE3);
|
||||
Enable(m_clip_plane_4, GL_CLIP_PLANE4);
|
||||
Enable(m_clip_plane_5, GL_CLIP_PLANE5);
|
||||
|
||||
checkForGlError("m_set_clip_plane");
|
||||
}
|
||||
|
||||
checkForGlError("glEnable");
|
||||
|
||||
if (m_set_front_polygon_mode)
|
||||
{
|
||||
glPolygonMode(GL_FRONT, m_front_polygon_mode);
|
||||
checkForGlError("glPolygonMode(Front)");
|
||||
}
|
||||
|
||||
if (m_set_back_polygon_mode)
|
||||
{
|
||||
glPolygonMode(GL_BACK, m_back_polygon_mode);
|
||||
checkForGlError("glPolygonMode(Back)");
|
||||
}
|
||||
|
||||
if (m_set_point_size)
|
||||
{
|
||||
glPointSize(m_point_size);
|
||||
checkForGlError("glPointSize");
|
||||
}
|
||||
|
||||
if (m_set_poly_offset_mode)
|
||||
{
|
||||
glPolygonOffset(m_poly_offset_scale_factor, m_poly_offset_bias);
|
||||
checkForGlError("glPolygonOffset");
|
||||
}
|
||||
|
||||
if (m_set_logic_op)
|
||||
{
|
||||
glLogicOp(m_logic_op);
|
||||
checkForGlError("glLogicOp");
|
||||
}
|
||||
|
||||
if (m_set_scissor_horizontal && m_set_scissor_vertical)
|
||||
{
|
||||
glScissor(m_scissor_x, m_scissor_y, m_scissor_w, m_scissor_h);
|
||||
checkForGlError("glScissor");
|
||||
}
|
||||
|
||||
if (m_set_two_sided_stencil_test_enable)
|
||||
{
|
||||
if (m_set_stencil_fail && m_set_stencil_zfail && m_set_stencil_zpass)
|
||||
{
|
||||
glStencilOpSeparate(GL_FRONT, m_stencil_fail, m_stencil_zfail, m_stencil_zpass);
|
||||
checkForGlError("glStencilOpSeparate");
|
||||
}
|
||||
|
||||
if (m_set_stencil_mask)
|
||||
{
|
||||
glStencilMaskSeparate(GL_FRONT, m_stencil_mask);
|
||||
checkForGlError("glStencilMaskSeparate");
|
||||
}
|
||||
|
||||
if (m_set_stencil_func && m_set_stencil_func_ref && m_set_stencil_func_mask)
|
||||
{
|
||||
glStencilFuncSeparate(GL_FRONT, m_stencil_func, m_stencil_func_ref, m_stencil_func_mask);
|
||||
checkForGlError("glStencilFuncSeparate");
|
||||
}
|
||||
|
||||
if (m_set_back_stencil_fail && m_set_back_stencil_zfail && m_set_back_stencil_zpass)
|
||||
{
|
||||
glStencilOpSeparate(GL_BACK, m_back_stencil_fail, m_back_stencil_zfail, m_back_stencil_zpass);
|
||||
checkForGlError("glStencilOpSeparate(GL_BACK)");
|
||||
}
|
||||
|
||||
if (m_set_back_stencil_mask)
|
||||
{
|
||||
glStencilMaskSeparate(GL_BACK, m_back_stencil_mask);
|
||||
checkForGlError("glStencilMaskSeparate(GL_BACK)");
|
||||
}
|
||||
|
||||
if (m_set_back_stencil_func && m_set_back_stencil_func_ref && m_set_back_stencil_func_mask)
|
||||
{
|
||||
glStencilFuncSeparate(GL_BACK, m_back_stencil_func, m_back_stencil_func_ref, m_back_stencil_func_mask);
|
||||
checkForGlError("glStencilFuncSeparate(GL_BACK)");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_set_stencil_fail && m_set_stencil_zfail && m_set_stencil_zpass)
|
||||
{
|
||||
glStencilOp(m_stencil_fail, m_stencil_zfail, m_stencil_zpass);
|
||||
checkForGlError("glStencilOp");
|
||||
}
|
||||
|
||||
if (m_set_stencil_mask)
|
||||
{
|
||||
glStencilMask(m_stencil_mask);
|
||||
checkForGlError("glStencilMask");
|
||||
}
|
||||
|
||||
if (m_set_stencil_func && m_set_stencil_func_ref && m_set_stencil_func_mask)
|
||||
{
|
||||
glStencilFunc(m_stencil_func, m_stencil_func_ref, m_stencil_func_mask);
|
||||
checkForGlError("glStencilFunc");
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Use other glLightModel functions?
|
||||
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, m_set_two_side_light_enable ? GL_TRUE : GL_FALSE);
|
||||
checkForGlError("glLightModeli");
|
||||
|
||||
if (m_set_shade_mode)
|
||||
{
|
||||
glShadeModel(m_shade_mode);
|
||||
checkForGlError("glShadeModel");
|
||||
}
|
||||
|
||||
if (m_set_depth_mask)
|
||||
{
|
||||
glDepthMask(m_depth_mask);
|
||||
checkForGlError("glDepthMask");
|
||||
}
|
||||
|
||||
if (m_set_depth_func)
|
||||
{
|
||||
glDepthFunc(m_depth_func);
|
||||
checkForGlError("glDepthFunc");
|
||||
}
|
||||
|
||||
if (m_set_depth_bounds && !is_intel_vendor)
|
||||
{
|
||||
glDepthBoundsEXT(m_depth_bounds_min, m_depth_bounds_max);
|
||||
checkForGlError("glDepthBounds");
|
||||
}
|
||||
|
||||
if (m_set_clip)
|
||||
{
|
||||
glDepthRangef(m_clip_min, m_clip_max);
|
||||
checkForGlError("glDepthRangef");
|
||||
}
|
||||
|
||||
if (m_set_line_width)
|
||||
{
|
||||
glLineWidth(m_line_width);
|
||||
checkForGlError("glLineWidth");
|
||||
}
|
||||
|
||||
if (m_set_line_stipple)
|
||||
{
|
||||
glLineStipple(m_line_stipple_factor, m_line_stipple_pattern);
|
||||
checkForGlError("glLineStipple");
|
||||
}
|
||||
|
||||
if (m_set_polygon_stipple)
|
||||
{
|
||||
glPolygonStipple((const GLubyte*)m_polygon_stipple_pattern);
|
||||
checkForGlError("glPolygonStipple");
|
||||
}
|
||||
|
||||
if (m_set_blend_equation)
|
||||
{
|
||||
glBlendEquationSeparate(m_blend_equation_rgb, m_blend_equation_alpha);
|
||||
checkForGlError("glBlendEquationSeparate");
|
||||
}
|
||||
|
||||
if (m_set_blend_sfactor && m_set_blend_dfactor)
|
||||
{
|
||||
glBlendFuncSeparate(m_blend_sfactor_rgb, m_blend_dfactor_rgb, m_blend_sfactor_alpha, m_blend_dfactor_alpha);
|
||||
checkForGlError("glBlendFuncSeparate");
|
||||
}
|
||||
|
||||
if (m_set_blend_color)
|
||||
{
|
||||
glBlendColor(m_blend_color_r, m_blend_color_g, m_blend_color_b, m_blend_color_a);
|
||||
checkForGlError("glBlendColor");
|
||||
}
|
||||
|
||||
if (m_set_cull_face)
|
||||
{
|
||||
glCullFace(m_cull_face);
|
||||
checkForGlError("glCullFace");
|
||||
}
|
||||
|
||||
if (m_set_front_face)
|
||||
{
|
||||
glFrontFace(m_front_face);
|
||||
checkForGlError("glFrontFace");
|
||||
}
|
||||
|
||||
if (m_set_alpha_func && m_set_alpha_ref)
|
||||
{
|
||||
glAlphaFunc(m_alpha_func, m_alpha_ref);
|
||||
checkForGlError("glAlphaFunc");
|
||||
}
|
||||
|
||||
if (m_set_fog_mode)
|
||||
{
|
||||
glFogi(GL_FOG_MODE, m_fog_mode);
|
||||
checkForGlError("glFogi(GL_FOG_MODE)");
|
||||
}
|
||||
|
||||
if (m_set_fog_params)
|
||||
{
|
||||
glFogf(GL_FOG_START, m_fog_param0);
|
||||
checkForGlError("glFogf(GL_FOG_START)");
|
||||
glFogf(GL_FOG_END, m_fog_param1);
|
||||
checkForGlError("glFogf(GL_FOG_END)");
|
||||
}
|
||||
|
||||
if (m_set_restart_index)
|
||||
{
|
||||
glPrimitiveRestartIndex(m_restart_index);
|
||||
checkForGlError("glPrimitiveRestartIndex");
|
||||
}
|
||||
|
||||
if (m_indexed_array.m_count && m_draw_array_count)
|
||||
{
|
||||
LOG_WARNING(RSX, "m_indexed_array.m_count && draw_array_count");
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < m_textures_count; ++i)
|
||||
{
|
||||
if (!m_textures[i].IsEnabled()) continue;
|
||||
|
||||
glActiveTexture(GL_TEXTURE0 + i);
|
||||
checkForGlError("glActiveTexture");
|
||||
m_gl_textures[i].Create();
|
||||
m_gl_textures[i].Bind();
|
||||
checkForGlError(fmt::Format("m_gl_textures[%d].Bind", i));
|
||||
m_program.SetTex(i);
|
||||
m_gl_textures[i].Init(m_textures[i]);
|
||||
checkForGlError(fmt::Format("m_gl_textures[%d].Init", i));
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < m_textures_count; ++i)
|
||||
{
|
||||
if (!m_vertex_textures[i].IsEnabled()) continue;
|
||||
|
||||
glActiveTexture(GL_TEXTURE0 + m_textures_count + i);
|
||||
checkForGlError("glActiveTexture");
|
||||
m_gl_vertex_textures[i].Create();
|
||||
m_gl_vertex_textures[i].Bind();
|
||||
checkForGlError(fmt::Format("m_gl_vertex_textures[%d].Bind", i));
|
||||
m_program.SetVTex(i);
|
||||
m_gl_vertex_textures[i].Init(m_vertex_textures[i]);
|
||||
checkForGlError(fmt::Format("m_gl_vertex_textures[%d].Init", i));
|
||||
}*/
|
||||
|
||||
// WriteBuffers();
|
||||
}
|
||||
|
||||
void D3D12GSRender::Flip()
|
||||
|
|
|
@ -98,7 +98,7 @@ private:
|
|||
struct UAVHeap
|
||||
{
|
||||
ID3D12Heap *m_heap;
|
||||
std::atomic<int> m_putPos, // Start of free space
|
||||
std::atomic<size_t> m_putPos, // Start of free space
|
||||
m_getPos; // End of free space
|
||||
};
|
||||
|
||||
|
@ -107,7 +107,7 @@ private:
|
|||
struct ReadbackHeap
|
||||
{
|
||||
ID3D12Heap *m_heap;
|
||||
std::atomic<int> m_putPos, // Start of free space
|
||||
std::atomic<size_t> m_putPos, // Start of free space
|
||||
m_getPos; // End of free space
|
||||
};
|
||||
|
||||
|
|
|
@ -304,11 +304,11 @@ size_t D3D12GSRender::UploadTextures()
|
|||
samplerDesc.AddressV = GetWrap(m_textures[i].GetWrapT());
|
||||
samplerDesc.AddressW = GetWrap(m_textures[i].GetWrapR());
|
||||
samplerDesc.ComparisonFunc = ComparisonFunc[m_textures[i].GetZfunc()];
|
||||
samplerDesc.MaxAnisotropy = GetMaxAniso(m_textures[i].GetMaxAniso());
|
||||
samplerDesc.MaxAnisotropy = (UINT)GetMaxAniso(m_textures[i].GetMaxAniso());
|
||||
samplerDesc.MipLODBias = m_textures[i].GetBias();
|
||||
samplerDesc.BorderColor[4] = m_textures[i].GetBorderColor();
|
||||
samplerDesc.MinLOD = m_textures[i].GetMinLOD() >> 8;
|
||||
samplerDesc.MaxLOD = m_textures[i].GetMaxLOD() >> 8;
|
||||
samplerDesc.BorderColor[4] = (FLOAT)m_textures[i].GetBorderColor();
|
||||
samplerDesc.MinLOD = (FLOAT)(m_textures[i].GetMinLOD() >> 8);
|
||||
samplerDesc.MaxLOD = (FLOAT)(m_textures[i].GetMaxLOD() >> 8);
|
||||
Handle = m_perFrameStorage.m_samplerDescriptorHeap->GetCPUDescriptorHandleForHeapStart();
|
||||
Handle.ptr += (m_perFrameStorage.m_currentTextureIndex + usedTexture) * m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER);
|
||||
m_device->CreateSampler(&samplerDesc, Handle);
|
||||
|
|
Loading…
Add table
Reference in a new issue