Skip to content

Commit 9bc39bb

Browse files
committed
fix for AMD gpus
1 parent e998b0f commit 9bc39bb

14 files changed

Lines changed: 42 additions & 23 deletions

File tree

sources/HAL/API/D3D12/HAL.D3D12.RootSignature.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace HAL
2828
ranges.emplace_back();
2929
auto& range = ranges.back();
3030

31-
range.Init(static_cast<D3D12_DESCRIPTOR_RANGE_TYPE>(table.range), table.count, table.offset, table.space, D3D12_DESCRIPTOR_RANGE_FLAGS::D3D12_DESCRIPTOR_RANGE_FLAG_DESCRIPTORS_VOLATILE);
31+
range.Init(static_cast<D3D12_DESCRIPTOR_RANGE_TYPE>(table.range), table.count, table.offset, table.space, D3D12_DESCRIPTOR_RANGE_FLAGS::D3D12_DESCRIPTOR_RANGE_FLAG_DATA_STATIC_WHILE_SET_AT_EXECUTE);
3232
param.InitAsDescriptorTable(1, &range, static_cast<D3D12_SHADER_VISIBILITY>(table.visibility));
3333

3434
},

sources/HAL/API/D3D12/HAL.Impl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ namespace HAL
2020
ComPtr<ID3D12Debug> debugController;
2121
ComPtr<ID3D12Debug1> spDebugController1;
2222

23-
/* if constexpr (Debug::CheckErrors)
23+
if constexpr (Debug::CheckErrors)
2424
if (SUCCEEDED(D3D12GetDebugInterface(IID_PPV_ARGS(&debugController))))
2525
{
2626
debugController->QueryInterface(IID_PPV_ARGS(&spDebugController1));
2727
debugController->EnableDebugLayer();
2828
// spDebugController1->SetEnableGPUBasedValidation(true);
29-
}*/
29+
}
3030

3131
}
3232

sources/HAL/autogen/pso.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,15 @@ void init_pso(HAL::Device& device, enum_array<PSO, PSOBase::ptr>& pso)
102102
tasks.emplace_back(PSOBase::create<PSOS::DenoiserDownsample>(device, pso[PSO::DenoiserDownsample]));
103103

104104

105-
106-
#ifndef HAL_BACKEND_VULKAN
107-
108-
109-
110-
tasks.emplace_back(PSOBase::create<PSOS::WorkGR>(device, pso[PSO::WorkGR]));
111-
105+
if (device.get_properties().work_graph)
106+
{
107+
}
112108

109+
#ifndef HAL_BACKEND_VULKAN
110+
if (device.get_properties().work_graph)
111+
{
112+
tasks.emplace_back(PSOBase::create<PSOS::WorkGR>(device, pso[PSO::WorkGR]));
113+
}
113114
#endif // !HAL_BACKEND_VULKAN
114115

115116
when_all(begin(tasks), end(tasks)).wait();

sources/RenderSystem/FrameGraph/PassDefaults.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ void PassDefault<Passes::Profiler>::render(
7171
bool PassDefault<Passes::RTXPass>::setup(
7272
Passes::RTXPass::Context& data, FrameGraph::TaskBuilder& builder)
7373
{
74+
if (!RenderSystem::get().device().get_properties().work_graph)
75+
return false;
76+
7477
auto& frame = builder.graph->get_context<ViewportInfo>();
7578
auto work_pso = RenderSystem::get().device().get_engine_pso_holder().GetPSO<PSOS::WorkGR>();
7679
auto size = frame.frame_size;

sources/RenderSystem/GUI/Base.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1633,7 +1633,10 @@ void PassDefault<Passes::UI_Render>::render(
16331633
{
16341634
RT::SingleColor rt;
16351635
rt.GetColor() = texture.renderTarget;
1636-
command_list->get_graphics().set_rtv(rt);
1636+
const auto rt_options = (slot == 0)
1637+
? HAL::RTOptions::Default | HAL::RTOptions::ClearColor
1638+
: HAL::RTOptions::Default;
1639+
command_list->get_graphics().set_rtv(rt, rt_options);
16371640
}
16381641

16391642
Renderer renderer;

sources/RenderSystem/GUI/Skin.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ Skin::Skin()
112112
Virtual = EngineAssets::virtualtex.get_asset()->get_texture()->texture_2d();
113113
Shadow = EngineAssets::shadow.get_asset()->get_texture()->texture_2d();
114114
Fill = EngineAssets::back_fill.get_asset()->get_texture()->texture_2d();
115+
116+
Edit = EngineAssets::back_fill.get_asset()->get_texture()->texture_2d();
115117
Edit.padding = { 5, 5, 5, 5 };
116118
Virtual.padding = { 5, 5, 5, 5 };
117119

sources/RenderSystem/RenderSystem.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ std::shared_ptr<HAL::Device> RenderSystem::select_adapter()
1414
Log::get() << "adapter: " << desc.Description << Log::endl;
1515

1616
const auto props = HAL::Device::probe(adapter);
17+
18+
// if (std::wstring(desc.Description).find(L"AMD") == std::wstring::npos) return;
19+
20+
1721
if (!result && props.mesh_shader && props.full_bindless &&
1822
std::wstring(desc.Description).find(L"Basic") == std::wstring::npos)
1923
{

sources/SIGParser/templates/cpp/psos.jinja

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,15 @@ void init_pso(HAL::Device& device, enum_array<PSO, PSOBase::ptr>& pso)
4949
{%- endif %}
5050
{%- endfor %}
5151

52-
{% for v in parsed.workgraph_pso -%}
53-
{%- set t = parsed.workgraph_pso[v] -%}
52+
if (device.get_properties().work_graph)
53+
{
54+
{%- for v in parsed.workgraph_pso %}
55+
{%- set t = parsed.workgraph_pso[v] %}
5456
{%- if t.options.ExcludeVulkan is undefined %}
55-
tasks.emplace_back(PSOBase::create<PSOS::{{t.name}}>(device, pso[PSO::{{t.name}}]));
57+
tasks.emplace_back(PSOBase::create<PSOS::{{t.name}}>(device, pso[PSO::{{t.name}}]));
5658
{%- endif %}
5759
{%- endfor %}
60+
}
5861

5962
#ifndef HAL_BACKEND_VULKAN
6063
{% for v in parsed.compute_pso -%}
@@ -71,12 +74,15 @@ void init_pso(HAL::Device& device, enum_array<PSO, PSOBase::ptr>& pso)
7174
{%- endif %}
7275
{%- endfor %}
7376

74-
{% for v in parsed.workgraph_pso -%}
75-
{%- set t = parsed.workgraph_pso[v] -%}
77+
if (device.get_properties().work_graph)
78+
{
79+
{%- for v in parsed.workgraph_pso %}
80+
{%- set t = parsed.workgraph_pso[v] %}
7681
{%- if t.options.ExcludeVulkan is defined %}
77-
tasks.emplace_back(PSOBase::create<PSOS::{{t.name}}>(device, pso[PSO::{{t.name}}]));
82+
tasks.emplace_back(PSOBase::create<PSOS::{{t.name}}>(device, pso[PSO::{{t.name}}]));
7883
{%- endif %}
7984
{%- endfor %}
85+
}
8086
#endif // !HAL_BACKEND_VULKAN
8187

8288
when_all(begin(tasks), end(tasks)).wait();

sources/SIGParser/templates/hlsl/table.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ struct {{"[raypayload]" if table.options.raypayload is defined}}{{table.name}}
5454
{{type}} Get{{v.name|camel}}(int i)
5555
{
5656
StructuredBuffer<uint> indirection = ResourceDescriptorHeap[{{v.name}}];
57-
uint id = indirection.Load(i);
58-
return ResourceDescriptorHeap[id];
57+
uint id = indirection[NonUniformResourceIndex(i)];
58+
return ResourceDescriptorHeap[NonUniformResourceIndex(id)];
5959
}
6060
{%elif v.as_array and v.array_count > 1 %}
6161
{{type}} Get{{v.name|camel}}(int i) { return ResourceDescriptorHeap[{{v.name}}[i]]; }

workdir/shaders/autogen/tables/NinePatch.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ struct NinePatch
1515
Texture2D<float4> GetTextures(int i)
1616
{
1717
StructuredBuffer<uint> indirection = ResourceDescriptorHeap[textures];
18-
uint id = indirection.Load(i);
19-
return ResourceDescriptorHeap[id];
18+
uint id = indirection[NonUniformResourceIndex(i)];
19+
return ResourceDescriptorHeap[NonUniformResourceIndex(id)];
2020
}
2121

2222
};

0 commit comments

Comments
 (0)