Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ projects/

workdir/cache/
workdir/Assets/
workdir/test_results/
workdir/pso
workdir/assert.txt

Expand Down
3 changes: 2 additions & 1 deletion sources/HAL/API/D3D12/HAL.D3D12.CommandList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,8 @@ namespace HAL
void CommandList::update_texture(HAL::Resource* resource, ivec3 offset, ivec3 box, UINT sub_resource, ResourceAddress address, texture_layout layout)
{
auto buffer_desc = address.resource->get_desc().as_buffer();
auto size = box.z * box.y * layout.row_stride;
// rows_count, not box.y: block-compressed formats have box.y / 4 rows
auto size = static_cast<uint64>(box.z) * layout.rows_count * layout.row_stride;

ASSERT(address.resource_offset + size <= buffer_desc.SizeInBytes);
ASSERT(box.z > 0);
Expand Down
4 changes: 2 additions & 2 deletions sources/HAL/DXGI/HAL.DXGI.Swapchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ namespace HAL

auto native = m_swapChain;
device.get_queue(CommandListType::DIRECT)->run([native, this](){
PROFILE(L"Present")
native->Present(1, 0);
PROFILE(L"Present");
native->Present(1, 0);
});

frames[m_frameIndex].fence_event = device.get_queue(CommandListType::DIRECT)->signal();
Expand Down
1 change: 1 addition & 0 deletions sources/HAL/HAL.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export import :Utils;
export import :Device;
export import :Queue;
export import :Shader;
export import :ShaderCompiler;
export import :HLSL;

export import :Fence;
Expand Down
16 changes: 16 additions & 0 deletions sources/HAL/autogen/autogen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ std::optional<SlotID> get_slot(std::string_view slot_name)
if(slot_name == "SMAA_Global") return SlotID::SMAA_Global;
if(slot_name == "SMAA_Weights") return SlotID::SMAA_Weights;
if(slot_name == "SMAA_Blend") return SlotID::SMAA_Blend;
if(slot_name == "SSSClassifyParams") return SlotID::SSSClassifyParams;
if(slot_name == "SSSTilesAppend") return SlotID::SSSTilesAppend;
if(slot_name == "SSSTilesRead") return SlotID::SSSTilesRead;
if(slot_name == "SSSBlurParams") return SlotID::SSSBlurParams;
if(slot_name == "DispatchParameters") return SlotID::DispatchParameters;
if(slot_name == "Countour") return SlotID::Countour;
if(slot_name == "DrawStencil") return SlotID::DrawStencil;
Expand Down Expand Up @@ -382,6 +386,14 @@ uint get_table_index(SlotID id)

if(id == SlotID::SMAA_Blend) return Slots::Post::AA::SMAA_Blend::Slot::ID;

if(id == SlotID::SSSClassifyParams) return Slots::Subsurface::SSSClassifyParams::Slot::ID;

if(id == SlotID::SSSTilesAppend) return Slots::Subsurface::SSSTilesAppend::Slot::ID;

if(id == SlotID::SSSTilesRead) return Slots::Subsurface::SSSTilesRead::Slot::ID;

if(id == SlotID::SSSBlurParams) return Slots::Subsurface::SSSBlurParams::Slot::ID;

if(id == SlotID::DispatchParameters) return Slots::Shadows::Screen::DispatchParameters::Slot::ID;

if(id == SlotID::Countour) return Slots::Editor::Countour::Slot::ID;
Expand Down Expand Up @@ -605,6 +617,10 @@ std::string get_slot_name(SlotID id)
if(id == SlotID::SMAA_Global) return "SMAA_Global";
if(id == SlotID::SMAA_Weights) return "SMAA_Weights";
if(id == SlotID::SMAA_Blend) return "SMAA_Blend";
if(id == SlotID::SSSClassifyParams) return "SSSClassifyParams";
if(id == SlotID::SSSTilesAppend) return "SSSTilesAppend";
if(id == SlotID::SSSTilesRead) return "SSSTilesRead";
if(id == SlotID::SSSBlurParams) return "SSSBlurParams";
if(id == SlotID::DispatchParameters) return "DispatchParameters";
if(id == SlotID::Countour) return "Countour";
if(id == SlotID::DrawStencil) return "DrawStencil";
Expand Down
11 changes: 11 additions & 0 deletions sources/HAL/autogen/autogen.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,14 @@ export import :Autogen.Slots.Post.AA.SMAA_Weights;
export import :Autogen.Tables.Post.AA.SMAA_Weights;
export import :Autogen.Slots.Post.AA.SMAA_Blend;
export import :Autogen.Tables.Post.AA.SMAA_Blend;
export import :Autogen.Slots.Subsurface.SSSClassifyParams;
export import :Autogen.Tables.Subsurface.SSSClassifyParams;
export import :Autogen.Slots.Subsurface.SSSTilesAppend;
export import :Autogen.Tables.Subsurface.SSSTilesAppend;
export import :Autogen.Slots.Subsurface.SSSTilesRead;
export import :Autogen.Tables.Subsurface.SSSTilesRead;
export import :Autogen.Slots.Subsurface.SSSBlurParams;
export import :Autogen.Tables.Subsurface.SSSBlurParams;
export import :Autogen.Slots.Shadows.Screen.DispatchParameters;
export import :Autogen.Tables.Shadows.Screen.DispatchParameters;
export import :Autogen.Slots.Editor.Countour;
Expand Down Expand Up @@ -484,6 +492,9 @@ export import :Autogen.PSO.Environment.CubemapENVDiffuse;
export import :Autogen.PSO.Post.AA.EdgeDetectCompute;
export import :Autogen.PSO.Post.AA.BlendWeightCompute;
export import :Autogen.PSO.Post.AA.BlendingCompute;
export import :Autogen.PSO.Subsurface.SSSClassify;
export import :Autogen.PSO.Subsurface.SSSBlurH;
export import :Autogen.PSO.Subsurface.SSSBlurV;
export import :Autogen.PSO.Shadows.Screen.SS_Shadow;
export import :Autogen.PSO.Post.TonemapHistogramClear;
export import :Autogen.PSO.Post.TonemapHistogramBuild;
Expand Down
7 changes: 7 additions & 0 deletions sources/HAL/autogen/enums.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ export
EdgeDetectCompute,
BlendWeightCompute,
BlendingCompute,
SSSClassify,
SSSBlurH,
SSSBlurV,
SS_Shadow,
TonemapHistogramClear,
TonemapHistogramBuild,
Expand Down Expand Up @@ -322,6 +325,10 @@ export
SMAA_Global = "SMAA_Global"_crc32,
SMAA_Weights = "SMAA_Weights"_crc32,
SMAA_Blend = "SMAA_Blend"_crc32,
SSSClassifyParams = "SSSClassifyParams"_crc32,
SSSTilesAppend = "SSSTilesAppend"_crc32,
SSSTilesRead = "SSSTilesRead"_crc32,
SSSBlurParams = "SSSBlurParams"_crc32,
DispatchParameters = "DispatchParameters"_crc32,
Countour = "Countour"_crc32,
DrawStencil = "DrawStencil"_crc32,
Expand Down
6 changes: 3 additions & 3 deletions sources/HAL/autogen/layout/Frame/DefaultLayout.layout.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace Frame
static const uint ID = 4;
static const uint CB = 37;
static const uint CB_ID = 11;
static const uint SRV = 9;
static const uint SRV = 11;
static const uint SRV_ID = 13;
static const uint UAV = 9;
static const uint UAV_ID = 14;
Expand All @@ -31,7 +31,7 @@ namespace Frame
static const uint ID = 5;
static const uint CB = 32;
static const uint CB_ID = 15;
static const uint SRV = 11;
static const uint SRV = 12;
static const uint SRV_ID = 17;
static const uint UAV = 8;
static const uint UAV_ID = 18;
Expand All @@ -45,7 +45,7 @@ namespace Frame
static const uint CB_ID = 19;
static const uint SRV = 14;
static const uint SRV_ID = 21;
static const uint UAV = 5;
static const uint UAV = 6;
static const uint UAV_ID = 22;
static inline const std::vector<uint> tables = { 19, 21, 22 };
};
Expand Down
3 changes: 3 additions & 0 deletions sources/HAL/autogen/pso.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ void init_pso(HAL::Device& device, enum_array<PSO, PSOBase::ptr>& pso)
tasks.emplace_back(PSOBase::create<PSOS::Post::AA::EdgeDetectCompute>(device, pso[PSO::EdgeDetectCompute]));
tasks.emplace_back(PSOBase::create<PSOS::Post::AA::BlendWeightCompute>(device, pso[PSO::BlendWeightCompute]));
tasks.emplace_back(PSOBase::create<PSOS::Post::AA::BlendingCompute>(device, pso[PSO::BlendingCompute]));
tasks.emplace_back(PSOBase::create<PSOS::Subsurface::SSSClassify>(device, pso[PSO::SSSClassify]));
tasks.emplace_back(PSOBase::create<PSOS::Subsurface::SSSBlurH>(device, pso[PSO::SSSBlurH]));
tasks.emplace_back(PSOBase::create<PSOS::Subsurface::SSSBlurV>(device, pso[PSO::SSSBlurV]));
tasks.emplace_back(PSOBase::create<PSOS::Shadows::Screen::SS_Shadow>(device, pso[PSO::SS_Shadow]));
tasks.emplace_back(PSOBase::create<PSOS::Post::TonemapHistogramClear>(device, pso[PSO::TonemapHistogramClear]));
tasks.emplace_back(PSOBase::create<PSOS::Post::TonemapHistogramBuild>(device, pso[PSO::TonemapHistogramBuild]));
Expand Down
2 changes: 1 addition & 1 deletion sources/HAL/autogen/pso/Meshes/GBufferDraw.pso.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export namespace PSOS
CaptureMeshlets.Apply(mpso, key);
ClusterLod.Apply(mpso, key);

mpso.rtv_formats = { HAL::Format::R8G8B8A8_UNORM, HAL::Format::R8G8B8A8_UNORM, HAL::Format::R8G8B8A8_UNORM, HAL::Format::R16G16_FLOAT, HAL::Format::R32_UINT };
mpso.rtv_formats = { HAL::Format::R8G8B8A8_UNORM, HAL::Format::R8G8B8A8_UNORM, HAL::Format::R8G8B8A8_UNORM, HAL::Format::R16G16_FLOAT, HAL::Format::R32_UINT, HAL::Format::R8G8B8A8_UNORM };
mpso.blend = { };

mpso.ds =HAL::Format::D32_FLOAT;
Expand Down
55 changes: 55 additions & 0 deletions sources/HAL/autogen/pso/Subsurface/SSSBlurH.pso.ixx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// ============================================================================
// THIS FILE IS AUTOMATICALLY GENERATED - DO NOT MANUALLY EDIT
// ============================================================================
// Generated by Prism from .prism files in sources/Prism/defs/
// Changes will be lost on next generation. Edit the .prism source files instead.
// ============================================================================
export module HAL:Autogen.PSO.Subsurface.SSSBlurH;

import Core;
import :PSO;
import :Enums;
import :Types;


export namespace PSOS
{
namespace Subsurface
{
struct SSSBlurH: public PSOBase
{
struct Keys {
GEN_DEF_COMP(Keys);
private:
SERIALIZE()
{
}
};

GEN_COMPUTE_PSO(SSSBlurH)


SimplePSO init_pso(Keys & key, std::function<void(SimplePSO&, Keys&)> f)
{


SimplePSO mpso("SSSBlurH");
if(f) f(mpso,key);

mpso.root_signature = Layouts::DefaultLayout;

mpso.compute.file_name = "shaders/postprocess/sss_blur.hlsl";
mpso.compute.entry_point = "CS_H";
mpso.compute.flags = HAL::ShaderOptions::None;

return mpso;
}

private:
SERIALIZE()
{
ar&NVP(wrap(psos));
}
};
}
}
55 changes: 55 additions & 0 deletions sources/HAL/autogen/pso/Subsurface/SSSBlurV.pso.ixx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// ============================================================================
// THIS FILE IS AUTOMATICALLY GENERATED - DO NOT MANUALLY EDIT
// ============================================================================
// Generated by Prism from .prism files in sources/Prism/defs/
// Changes will be lost on next generation. Edit the .prism source files instead.
// ============================================================================
export module HAL:Autogen.PSO.Subsurface.SSSBlurV;

import Core;
import :PSO;
import :Enums;
import :Types;


export namespace PSOS
{
namespace Subsurface
{
struct SSSBlurV: public PSOBase
{
struct Keys {
GEN_DEF_COMP(Keys);
private:
SERIALIZE()
{
}
};

GEN_COMPUTE_PSO(SSSBlurV)


SimplePSO init_pso(Keys & key, std::function<void(SimplePSO&, Keys&)> f)
{


SimplePSO mpso("SSSBlurV");
if(f) f(mpso,key);

mpso.root_signature = Layouts::DefaultLayout;

mpso.compute.file_name = "shaders/postprocess/sss_blur.hlsl";
mpso.compute.entry_point = "CS_V";
mpso.compute.flags = HAL::ShaderOptions::None;

return mpso;
}

private:
SERIALIZE()
{
ar&NVP(wrap(psos));
}
};
}
}
55 changes: 55 additions & 0 deletions sources/HAL/autogen/pso/Subsurface/SSSClassify.pso.ixx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// ============================================================================
// THIS FILE IS AUTOMATICALLY GENERATED - DO NOT MANUALLY EDIT
// ============================================================================
// Generated by Prism from .prism files in sources/Prism/defs/
// Changes will be lost on next generation. Edit the .prism source files instead.
// ============================================================================
export module HAL:Autogen.PSO.Subsurface.SSSClassify;

import Core;
import :PSO;
import :Enums;
import :Types;


export namespace PSOS
{
namespace Subsurface
{
struct SSSClassify: public PSOBase
{
struct Keys {
GEN_DEF_COMP(Keys);
private:
SERIALIZE()
{
}
};

GEN_COMPUTE_PSO(SSSClassify)


SimplePSO init_pso(Keys & key, std::function<void(SimplePSO&, Keys&)> f)
{


SimplePSO mpso("SSSClassify");
if(f) f(mpso,key);

mpso.root_signature = Layouts::DefaultLayout;

mpso.compute.file_name = "shaders/postprocess/sss_classify.hlsl";
mpso.compute.entry_point = "CS_CLASSIFY";
mpso.compute.flags = HAL::ShaderOptions::None;

return mpso;
}

private:
SERIALIZE()
{
ar&NVP(wrap(psos));
}
};
}
}
3 changes: 3 additions & 0 deletions sources/HAL/autogen/rt/Meshes/GBuffer.rt.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ export namespace RT
HLSL::RenderTarget<float4> specular;
HLSL::RenderTarget<float2> motion;
HLSL::RenderTarget<uint> object_id;
HLSL::RenderTarget<float4> material;
HLSL::DepthStencil<float> depth;
HLSL::RenderTarget<float4>& GetAlbedo() { return albedo; }
HLSL::RenderTarget<float4>& GetNormals() { return normals; }
HLSL::RenderTarget<float4>& GetSpecular() { return specular; }
HLSL::RenderTarget<float2>& GetMotion() { return motion; }
HLSL::RenderTarget<uint>& GetObject_Id() { return object_id; }
HLSL::RenderTarget<float4>& GetMaterial() { return material; }
HLSL::DepthStencil<float>& GetDepth() { return depth; }
template<class Compiler>
void compile(Compiler& compiler) const
Expand All @@ -39,6 +41,7 @@ export namespace RT
compiler.compile(specular);
compiler.compile(motion);
compiler.compile(object_id);
compiler.compile(material);
compiler.compile(depth);
}
};
Expand Down
26 changes: 26 additions & 0 deletions sources/HAL/autogen/slots/Subsurface/SSSBlurParams.ixx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// ============================================================================
// THIS FILE IS AUTOMATICALLY GENERATED - DO NOT MANUALLY EDIT
// ============================================================================
// Generated by Prism from .prism files in sources/Prism/defs/
// Changes will be lost on next generation. Edit the .prism source files instead.
// ============================================================================
export module HAL:Autogen.Slots.Subsurface.SSSBlurParams;
import Core;
import :Autogen.Tables.Subsurface.SSSBlurParams;
import :Autogen.Layouts.Frame.DefaultLayout;
import :SIG;
import :Types;
import :Enums;
import :Slots;

export namespace Slots
{
namespace Subsurface
{
struct SSSBlurParams :public DataHolder<SSSBlurParams, SlotID::SSSBlurParams, Table::Subsurface::SSSBlurParams, ::Frame::DefaultLayout::Instance0>
{
static constexpr SIG_TYPE TYPE = SIG_TYPE::Slot;
SSSBlurParams() = default;
};
}
}
Loading
Loading