Skip to content

Commit 12a907b

Browse files
committed
[GPU] Shaders to common, xb buildshaders instead of buildhlsl
1 parent 313fb3e commit 12a907b

File tree

582 files changed

+419271
-244713
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

582 files changed

+419271
-244713
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@
77
*.csproj text eol=crlf -whitespace merge=union
88
*.vcxproj text eol=crlf -whitespace merge=union
99
*.props text eol=crlf -whitespace merge=union
10+
11+
src/**/shaders/bytecode/** linguist-generated=true

src/xenia/gpu/d3d12/d3d12_graphics_system.cc

+12-10
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ namespace xe {
2222
namespace gpu {
2323
namespace d3d12 {
2424

25-
// Generated with `xb buildhlsl`.
26-
#include "xenia/gpu/d3d12/shaders/dxbc/fullscreen_tc_vs.h"
27-
#include "xenia/gpu/d3d12/shaders/dxbc/stretch_gamma_ps.h"
28-
#include "xenia/gpu/d3d12/shaders/dxbc/stretch_ps.h"
25+
// Generated with `xb buildshaders`.
26+
namespace shaders {
27+
#include "xenia/gpu/shaders/bytecode/d3d12_5_1/fullscreen_tc_vs.h"
28+
#include "xenia/gpu/shaders/bytecode/d3d12_5_1/stretch_gamma_ps.h"
29+
#include "xenia/gpu/shaders/bytecode/d3d12_5_1/stretch_ps.h"
30+
} // namespace shaders
2931

3032
D3D12GraphicsSystem::D3D12GraphicsSystem() {}
3133

@@ -140,10 +142,10 @@ X_STATUS D3D12GraphicsSystem::Setup(cpu::Processor* processor,
140142
// Create the stretch pipelines.
141143
D3D12_GRAPHICS_PIPELINE_STATE_DESC stretch_pipeline_desc = {};
142144
stretch_pipeline_desc.pRootSignature = stretch_root_signature_;
143-
stretch_pipeline_desc.VS.pShaderBytecode = fullscreen_tc_vs;
144-
stretch_pipeline_desc.VS.BytecodeLength = sizeof(fullscreen_tc_vs);
145-
stretch_pipeline_desc.PS.pShaderBytecode = stretch_ps;
146-
stretch_pipeline_desc.PS.BytecodeLength = sizeof(stretch_ps);
145+
stretch_pipeline_desc.VS.pShaderBytecode = shaders::fullscreen_tc_vs;
146+
stretch_pipeline_desc.VS.BytecodeLength = sizeof(shaders::fullscreen_tc_vs);
147+
stretch_pipeline_desc.PS.pShaderBytecode = shaders::stretch_ps;
148+
stretch_pipeline_desc.PS.BytecodeLength = sizeof(shaders::stretch_ps);
147149
// The shader will set alpha to 1, don't use output-merger to preserve it.
148150
stretch_pipeline_desc.BlendState.RenderTarget[0].RenderTargetWriteMask =
149151
D3D12_COLOR_WRITE_ENABLE_ALL;
@@ -167,8 +169,8 @@ X_STATUS D3D12GraphicsSystem::Setup(cpu::Processor* processor,
167169
return X_STATUS_UNSUCCESSFUL;
168170
}
169171
stretch_pipeline_desc.pRootSignature = stretch_gamma_root_signature_;
170-
stretch_pipeline_desc.PS.pShaderBytecode = stretch_gamma_ps;
171-
stretch_pipeline_desc.PS.BytecodeLength = sizeof(stretch_gamma_ps);
172+
stretch_pipeline_desc.PS.pShaderBytecode = shaders::stretch_gamma_ps;
173+
stretch_pipeline_desc.PS.BytecodeLength = sizeof(shaders::stretch_gamma_ps);
172174
if (FAILED(device->CreateGraphicsPipelineState(
173175
&stretch_pipeline_desc, IID_PPV_ARGS(&stretch_gamma_pipeline_)))) {
174176
XELOGE(

src/xenia/gpu/d3d12/d3d12_render_target_cache.cc

+127-102
Large diffs are not rendered by default.

src/xenia/gpu/d3d12/d3d12_render_target_cache.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ class D3D12RenderTargetCache final : public RenderTargetCache {
296296
// Parameter 1 - destination (shared memory or a part of it).
297297
// Parameter 2 - source (EDRAM).
298298
ID3D12RootSignature* resolve_copy_root_signature_ = nullptr;
299-
static const std::pair<const uint8_t*, size_t>
299+
static const std::pair<const void*, size_t>
300300
kResolveCopyShaders[size_t(draw_util::ResolveCopyShaderIndex::kCount)];
301301
ID3D12PipelineState* resolve_copy_pipelines_[size_t(
302302
draw_util::ResolveCopyShaderIndex::kCount)] = {};

src/xenia/gpu/d3d12/pipeline_cache.cc

+46-40
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,22 @@ namespace xe {
6161
namespace gpu {
6262
namespace d3d12 {
6363

64-
// Generated with `xb buildhlsl`.
65-
#include "xenia/gpu/d3d12/shaders/dxbc/adaptive_quad_hs.h"
66-
#include "xenia/gpu/d3d12/shaders/dxbc/adaptive_triangle_hs.h"
67-
#include "xenia/gpu/d3d12/shaders/dxbc/continuous_quad_hs.h"
68-
#include "xenia/gpu/d3d12/shaders/dxbc/continuous_triangle_hs.h"
69-
#include "xenia/gpu/d3d12/shaders/dxbc/discrete_quad_hs.h"
70-
#include "xenia/gpu/d3d12/shaders/dxbc/discrete_triangle_hs.h"
71-
#include "xenia/gpu/d3d12/shaders/dxbc/float24_round_ps.h"
72-
#include "xenia/gpu/d3d12/shaders/dxbc/float24_truncate_ps.h"
73-
#include "xenia/gpu/d3d12/shaders/dxbc/primitive_point_list_gs.h"
74-
#include "xenia/gpu/d3d12/shaders/dxbc/primitive_quad_list_gs.h"
75-
#include "xenia/gpu/d3d12/shaders/dxbc/primitive_rectangle_list_gs.h"
76-
#include "xenia/gpu/d3d12/shaders/dxbc/tessellation_adaptive_vs.h"
77-
#include "xenia/gpu/d3d12/shaders/dxbc/tessellation_indexed_vs.h"
64+
// Generated with `xb buildshaders`.
65+
namespace shaders {
66+
#include "xenia/gpu/shaders/bytecode/d3d12_5_1/adaptive_quad_hs.h"
67+
#include "xenia/gpu/shaders/bytecode/d3d12_5_1/adaptive_triangle_hs.h"
68+
#include "xenia/gpu/shaders/bytecode/d3d12_5_1/continuous_quad_hs.h"
69+
#include "xenia/gpu/shaders/bytecode/d3d12_5_1/continuous_triangle_hs.h"
70+
#include "xenia/gpu/shaders/bytecode/d3d12_5_1/discrete_quad_hs.h"
71+
#include "xenia/gpu/shaders/bytecode/d3d12_5_1/discrete_triangle_hs.h"
72+
#include "xenia/gpu/shaders/bytecode/d3d12_5_1/float24_round_ps.h"
73+
#include "xenia/gpu/shaders/bytecode/d3d12_5_1/float24_truncate_ps.h"
74+
#include "xenia/gpu/shaders/bytecode/d3d12_5_1/primitive_point_list_gs.h"
75+
#include "xenia/gpu/shaders/bytecode/d3d12_5_1/primitive_quad_list_gs.h"
76+
#include "xenia/gpu/shaders/bytecode/d3d12_5_1/primitive_rectangle_list_gs.h"
77+
#include "xenia/gpu/shaders/bytecode/d3d12_5_1/tessellation_adaptive_vs.h"
78+
#include "xenia/gpu/shaders/bytecode/d3d12_5_1/tessellation_indexed_vs.h"
79+
} // namespace shaders
7880

7981
PipelineCache::PipelineCache(D3D12CommandProcessor& command_processor,
8082
const RegisterFile& register_file,
@@ -1746,16 +1748,17 @@ ID3D12PipelineState* PipelineCache::CreateD3D12Pipeline(
17461748
}
17471749
switch (description.geometry_shader) {
17481750
case PipelineGeometryShader::kPointList:
1749-
state_desc.GS.pShaderBytecode = primitive_point_list_gs;
1750-
state_desc.GS.BytecodeLength = sizeof(primitive_point_list_gs);
1751+
state_desc.GS.pShaderBytecode = shaders::primitive_point_list_gs;
1752+
state_desc.GS.BytecodeLength = sizeof(shaders::primitive_point_list_gs);
17511753
break;
17521754
case PipelineGeometryShader::kRectangleList:
1753-
state_desc.GS.pShaderBytecode = primitive_rectangle_list_gs;
1754-
state_desc.GS.BytecodeLength = sizeof(primitive_rectangle_list_gs);
1755+
state_desc.GS.pShaderBytecode = shaders::primitive_rectangle_list_gs;
1756+
state_desc.GS.BytecodeLength =
1757+
sizeof(shaders::primitive_rectangle_list_gs);
17551758
break;
17561759
case PipelineGeometryShader::kQuadList:
1757-
state_desc.GS.pShaderBytecode = primitive_quad_list_gs;
1758-
state_desc.GS.BytecodeLength = sizeof(primitive_quad_list_gs);
1760+
state_desc.GS.pShaderBytecode = shaders::primitive_quad_list_gs;
1761+
state_desc.GS.BytecodeLength = sizeof(shaders::primitive_quad_list_gs);
17591762
break;
17601763
default:
17611764
break;
@@ -1765,24 +1768,25 @@ ID3D12PipelineState* PipelineCache::CreateD3D12Pipeline(
17651768
xenos::TessellationMode tessellation_mode = xenos::TessellationMode(
17661769
description.primitive_topology_type_or_tessellation_mode);
17671770
if (tessellation_mode == xenos::TessellationMode::kAdaptive) {
1768-
state_desc.VS.pShaderBytecode = tessellation_adaptive_vs;
1769-
state_desc.VS.BytecodeLength = sizeof(tessellation_adaptive_vs);
1771+
state_desc.VS.pShaderBytecode = shaders::tessellation_adaptive_vs;
1772+
state_desc.VS.BytecodeLength = sizeof(shaders::tessellation_adaptive_vs);
17701773
} else {
1771-
state_desc.VS.pShaderBytecode = tessellation_indexed_vs;
1772-
state_desc.VS.BytecodeLength = sizeof(tessellation_indexed_vs);
1774+
state_desc.VS.pShaderBytecode = shaders::tessellation_indexed_vs;
1775+
state_desc.VS.BytecodeLength = sizeof(shaders::tessellation_indexed_vs);
17731776
}
17741777
switch (tessellation_mode) {
17751778
case xenos::TessellationMode::kDiscrete:
17761779
switch (host_vertex_shader_type) {
17771780
case Shader::HostVertexShaderType::kTriangleDomainCPIndexed:
17781781
case Shader::HostVertexShaderType::kTriangleDomainPatchIndexed:
1779-
state_desc.HS.pShaderBytecode = discrete_triangle_hs;
1780-
state_desc.HS.BytecodeLength = sizeof(discrete_triangle_hs);
1782+
state_desc.HS.pShaderBytecode = shaders::discrete_triangle_hs;
1783+
state_desc.HS.BytecodeLength =
1784+
sizeof(shaders::discrete_triangle_hs);
17811785
break;
17821786
case Shader::HostVertexShaderType::kQuadDomainCPIndexed:
17831787
case Shader::HostVertexShaderType::kQuadDomainPatchIndexed:
1784-
state_desc.HS.pShaderBytecode = discrete_quad_hs;
1785-
state_desc.HS.BytecodeLength = sizeof(discrete_quad_hs);
1788+
state_desc.HS.pShaderBytecode = shaders::discrete_quad_hs;
1789+
state_desc.HS.BytecodeLength = sizeof(shaders::discrete_quad_hs);
17861790
break;
17871791
default:
17881792
assert_unhandled_case(host_vertex_shader_type);
@@ -1793,13 +1797,14 @@ ID3D12PipelineState* PipelineCache::CreateD3D12Pipeline(
17931797
switch (host_vertex_shader_type) {
17941798
case Shader::HostVertexShaderType::kTriangleDomainCPIndexed:
17951799
case Shader::HostVertexShaderType::kTriangleDomainPatchIndexed:
1796-
state_desc.HS.pShaderBytecode = continuous_triangle_hs;
1797-
state_desc.HS.BytecodeLength = sizeof(continuous_triangle_hs);
1800+
state_desc.HS.pShaderBytecode = shaders::continuous_triangle_hs;
1801+
state_desc.HS.BytecodeLength =
1802+
sizeof(shaders::continuous_triangle_hs);
17981803
break;
17991804
case Shader::HostVertexShaderType::kQuadDomainCPIndexed:
18001805
case Shader::HostVertexShaderType::kQuadDomainPatchIndexed:
1801-
state_desc.HS.pShaderBytecode = continuous_quad_hs;
1802-
state_desc.HS.BytecodeLength = sizeof(continuous_quad_hs);
1806+
state_desc.HS.pShaderBytecode = shaders::continuous_quad_hs;
1807+
state_desc.HS.BytecodeLength = sizeof(shaders::continuous_quad_hs);
18031808
break;
18041809
default:
18051810
assert_unhandled_case(host_vertex_shader_type);
@@ -1809,12 +1814,13 @@ ID3D12PipelineState* PipelineCache::CreateD3D12Pipeline(
18091814
case xenos::TessellationMode::kAdaptive:
18101815
switch (host_vertex_shader_type) {
18111816
case Shader::HostVertexShaderType::kTriangleDomainPatchIndexed:
1812-
state_desc.HS.pShaderBytecode = adaptive_triangle_hs;
1813-
state_desc.HS.BytecodeLength = sizeof(adaptive_triangle_hs);
1817+
state_desc.HS.pShaderBytecode = shaders::adaptive_triangle_hs;
1818+
state_desc.HS.BytecodeLength =
1819+
sizeof(shaders::adaptive_triangle_hs);
18141820
break;
18151821
case Shader::HostVertexShaderType::kQuadDomainPatchIndexed:
1816-
state_desc.HS.pShaderBytecode = adaptive_quad_hs;
1817-
state_desc.HS.BytecodeLength = sizeof(adaptive_quad_hs);
1822+
state_desc.HS.pShaderBytecode = shaders::adaptive_quad_hs;
1823+
state_desc.HS.BytecodeLength = sizeof(shaders::adaptive_quad_hs);
18181824
break;
18191825
default:
18201826
assert_unhandled_case(host_vertex_shader_type);
@@ -1852,12 +1858,12 @@ ID3D12PipelineState* PipelineCache::CreateD3D12Pipeline(
18521858
description.depth_format == xenos::DepthRenderTargetFormat::kD24FS8) {
18531859
switch (render_target_cache_.depth_float24_conversion()) {
18541860
case RenderTargetCache::DepthFloat24Conversion::kOnOutputTruncating:
1855-
state_desc.PS.pShaderBytecode = float24_truncate_ps;
1856-
state_desc.PS.BytecodeLength = sizeof(float24_truncate_ps);
1861+
state_desc.PS.pShaderBytecode = shaders::float24_truncate_ps;
1862+
state_desc.PS.BytecodeLength = sizeof(shaders::float24_truncate_ps);
18571863
break;
18581864
case RenderTargetCache::DepthFloat24Conversion::kOnOutputRounding:
1859-
state_desc.PS.pShaderBytecode = float24_round_ps;
1860-
state_desc.PS.BytecodeLength = sizeof(float24_round_ps);
1865+
state_desc.PS.pShaderBytecode = shaders::float24_round_ps;
1866+
state_desc.PS.BytecodeLength = sizeof(shaders::float24_round_ps);
18611867
break;
18621868
default:
18631869
break;
Binary file not shown.

src/xenia/gpu/d3d12/shaders/dxbc/adaptive_quad_hs.h

-104
This file was deleted.

0 commit comments

Comments
 (0)