Skip to content

Commit

Permalink
v1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kurbeco committed Mar 11, 2024
1 parent cda50c7 commit 91a0df4
Show file tree
Hide file tree
Showing 14 changed files with 75 additions and 72 deletions.
8 changes: 8 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
libs/Cauldron/libs/DXC/bin/dxcompiler.dll filter=lfs diff=lfs merge=lfs -text
libs/Cauldron/libs/DXC/bin/dxc.exe filter=lfs diff=lfs merge=lfs -text
libs/Cauldron/libs/DXC/bin/dxil.dll filter=lfs diff=lfs merge=lfs -text
libs/Cauldron/libs/DXC/bin/x64/dxcompiler.dll filter=lfs diff=lfs merge=lfs -text
libs/Cauldron/libs/DXC/bin/x64/dxc.exe filter=lfs diff=lfs merge=lfs -text
libs/Cauldron/libs/DXC/bin/x64/dxil.dll filter=lfs diff=lfs merge=lfs -text
libs/Cauldron/libs/DXCwg/*.exe filter=lfs diff=lfs merge=lfs -text
libs/Cauldron/libs/DXCwg/*.dll filter=lfs diff=lfs merge=lfs -text
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -355,4 +355,8 @@ ASALocalRun/
healthchecksdb

# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
MigrationBackup/
/libs/Cauldron/libs/DXCwg/*.exe
/libs/Cauldron/libs/DXCwg/*.dll
/libs/Cauldron/libs/DXCwg/LICENSE*.txt
/libs/Cauldron/libs/DXCwg/LICENCE*.txt
8 changes: 4 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[submodule "media/Cauldron-Media"]
path = media/Cauldron-Media
url = ../Cauldron-Media.git
url = https://github.com/GPUOpen-LibrariesAndSDKs/Cauldron-Media.git
[submodule "libs/Cauldron"]
path = libs/Cauldron
url = ../Cauldron.git
branch = WorkGraphComputeRasterizer
path = libs/Cauldron
url = ../Cauldron.git
branch = WorkGraphComputeRasterizer
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES )
add_compile_options(/MP)

if(GFX_API_WG)
add_definitions(-DENABLE_EXPERIMENTAL_WORKGRAPHS)
add_definitions(-DENABLE_WORKGRAPHS)
endif()

# reference libs used by both backends
Expand Down
2 changes: 1 addition & 1 deletion libs/Cauldron
Submodule Cauldron updated 196 files
56 changes: 28 additions & 28 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ To build the Work Graphs Compute Rasterizer Sample, you must first install the f
- [Visual Studio 2022](https://visualstudio.microsoft.com/downloads/)
- [Windows 10 SDK 10.0.18362.0](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk)

Then follow the next steps:
### Getting up and running

Follow the next steps:

1) Clone the repo with its submodules:
```
Expand All @@ -29,16 +31,12 @@ Then follow the next steps:
3) Open the solution in the DX12 directory, compile and run. VK isn't supported.
4) The define `ENABLE_EXPERIMENTAL_WORKGRAPHS` enables Work graphs. It's enabled by
default. It can be disabled if [PIX](https://devblogs.microsoft.com/pix/introduction/),
[RenderDoc](https://renderdoc.org) or another tool without Work graphs
support is used to debug. Use CMake to disable the feature:
4) The define `ENABLE_WORKGRAPHS` enables Work graphs. It's enabled by default. It can be disabled if [PIX](https://devblogs.microsoft.com/pix/introduction/), [RenderDoc](https://renderdoc.org) or another tool without Work graphs support is used to debug. Use CMake to disable the feature:
```
> cmake -DGFX_API_WG=OFF
```
5) The media samples from Cauldron may change and not all scenes may load,
you can adjust scenes in [src\Common\GLTFSample.json](src\Common\GLTFSample.json)
5) The media samples from Cauldron may change and not all scenes may load, you can adjust scenes in [src\Common\GLTFSample.json](src\Common\GLTFSample.json)
6) You can request precise profiling data through commandline by passing json as arguments:
```
Expand All @@ -49,34 +47,36 @@ Then follow the next steps:
"warmUpFrames": 50, "durationFrames": 20 } }
```
algorithm:\
0 - monolithic compute rasterizer, called once per object\
1 - monolithic compute rasterizer, all objects are consumed by one ExecuteIndirect\
2 - multi-pass compute rasterizer, all objects are consumed by a pipeline of three ExecuteIndirect\
3 - workgraph rasterizer, called once per object\
4 - workgraph rasterizer, called once in total with all object batched\
5 - workgraph rasterizer, all objects are consumed by an initial Broadcaster node
These are the custom parameters for the rasterizer, the many other options can be looked up in the Cauldron docs:
`algorithm`:
> 0 - monolithic compute rasterizer, called once per object
> 1 - monolithic compute rasterizer, all objects are consumed by one ExecuteIndirect
> 2 - multi-pass compute rasterizer, all objects are consumed by a pipeline of three ExecuteIndirect
> 3 - workgraph rasterizer, called once per object
> 4 - workgraph rasterizer, called once in total with all object batched
> 5 - workgraph rasterizer, all objects are consumed by an initial Broadcaster node
bins:\
1 to 15: number of buckets/bins to group triangles by, 2^(bin-1) = area
`bins`:
> 1 to 15: number of buckets/bins to group triangles by, 2^(bin-1) = area
threadlaunch:\
false/true: use a thread-launch or coalesce node for triangle rasterization
`threadlaunch`:
> false/true: use a thread-launch or coalesce node for triangle rasterization
profile:\
false/true: enables automatic profiling and generation of a csv file
`profile`:
> false/true: enables automatic profiling and generation of a csv file
filter:\
label: the label of the pass to collect timestamps for, if empty all passes are included in the csv
`filter`:
> label: the label of the pass to collect timestamps for, if empty all passes are included in the csv
resultsFilename:\
filename: the name of the csv in the current directory
`resultsFilename`:
> filename: the name of the csv in the current directory
warmUpFrames:\
0 to inf: how many frames to wait for initialization to settle
`warmUpFrames`:
> 0 to inf: how many frames to wait for initialization to settle
durationFrames:\
0 to inf: how many frames to include in the csv
`durationFrames`:
> 0 to inf: how many frames to include in the csv
The values in the resulting csv are raw gpu ticks without any conversion.
Expand Down
Binary file modified screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 10 additions & 21 deletions src/DX12/GLTFSample.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// AMD SampleDX12 sample code
//
// Copyright(c) 2023 Advanced Micro Devices, Inc.All rights reserved.
// Copyright(c) 2024 Advanced Micro Devices, Inc.All rights reserved.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files(the "Software"), to deal
// in the Software without restriction, including without limitation the rights
Expand Down Expand Up @@ -48,8 +48,12 @@ void GLTFSample::OnParseCommandLine(LPSTR lpCmdLine, uint32_t* pWidth, uint32_t*

// ADJUSTMENT: support z-buffer rasterizer custom parameters
m_homogeneous = true;
#if ENABLE_WORKGRAPHS
m_algorithm = 5;
#else
m_algorithm = 2;
m_numberOfBins = 12;
#endif
m_numberOfBins = 15;
m_fixExpansion = true;
m_threadLaunch = true;
m_smoothing = true;
Expand Down Expand Up @@ -500,14 +504,14 @@ void GLTFSample::OnRender()
Sleep(0);
}

#ifdef ENABLE_EXPERIMENTAL_WORKGRAPHS
#ifdef ENABLE_WORKGRAPHS
// Configure Agility SDK version
extern "C" {
__declspec(dllexport) extern const UINT D3D12SDKVersion = 711;
__declspec(dllexport) extern const UINT D3D12SDKVersion = 613;
}
// Configure Agility SDK path
extern "C" {
__declspec(dllexport) extern const char* D3D12SDKPath = ".\\d3d12wg\\";
__declspec(dllexport) extern const char* D3D12SDKPath = ".\\d3d12\\";
}
#endif

Expand All @@ -521,22 +525,7 @@ int WINAPI WinMain(HINSTANCE hInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
LPCSTR Name = "DX12 Work Graphs Compute Rasterizer Sample v1.0";

// Enable experimental features
{
const IID ids[] = {
D3D12ExperimentalShaderModels,
#ifdef ENABLE_EXPERIMENTAL_WORKGRAPHS
D3D12StateObjectsExperiment
#endif
};

void* configStructs[] = { nullptr, nullptr };
UINT configStructSizes[] = { 0, 0 };
ThrowIfFailed(
D3D12EnableExperimentalFeatures(_countof(ids), ids, configStructs, configStructSizes));
}
LPCSTR Name = "DX12 Work Graphs Compute Rasterizer Sample v1.1";

// create new DX sample
return RunFramework(hInstance, lpCmdLine, nCmdShow, new GLTFSample(Name));
Expand Down
2 changes: 1 addition & 1 deletion src/DX12/GLTFSample.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// AMD SampleDX12 sample code
//
// Copyright(c) 2023 Advanced Micro Devices, Inc.All rights reserved.
// Copyright(c) 2024 Advanced Micro Devices, Inc.All rights reserved.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files(the "Software"), to deal
// in the Software without restriction, including without limitation the rights
Expand Down
14 changes: 7 additions & 7 deletions src/DX12/Renderer.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// AMD SampleDX12 sample code
//
// Copyright(c) 2023 Advanced Micro Devices, Inc.All rights reserved.
// Copyright(c) 2024 Advanced Micro Devices, Inc.All rights reserved.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files(the "Software"), to deal
// in the Software without restriction, including without limitation the rights
Expand Down Expand Up @@ -31,12 +31,12 @@ void Renderer::OnCreate(Device* pDevice, SwapChain *pSwapChain, float FontSize)
{
m_pDevice = pDevice;

#ifdef ENABLE_EXPERIMENTAL_WORKGRAPHS
#ifdef ENABLE_WORKGRAPHS
// Check work-graph support
//
D3D12_FEATURE_DATA_D3D12_OPTIONS_EXPERIMENTAL Options;
D3D12_FEATURE_DATA_D3D12_OPTIONS21 Options;
ThrowIfFailed(pDevice->GetDevice()->CheckFeatureSupport(
D3D12_FEATURE_D3D12_OPTIONS_EXPERIMENTAL, &Options, sizeof(Options)));
D3D12_FEATURE_D3D12_OPTIONS21, &Options, sizeof(Options)));
if (Options.WorkGraphsTier == D3D12_WORK_GRAPHS_TIER_NOT_SUPPORTED) {
throw std::runtime_error("Device does not report support for work graphs");
}
Expand Down Expand Up @@ -114,7 +114,7 @@ void Renderer::OnCreate(Device* pDevice, SwapChain *pSwapChain, float FontSize)
m_Bloom.OnCreate(pDevice, &m_ResourceViewHeaps, &m_ConstantBufferRing, &m_VidMemBufferPool, DXGI_FORMAT_R16G16B16A16_FLOAT);
m_TAA.OnCreate(pDevice, &m_ResourceViewHeaps, &m_VidMemBufferPool);
m_MagnifierPS.OnCreate(pDevice, &m_ResourceViewHeaps, &m_ConstantBufferRing, &m_VidMemBufferPool, DXGI_FORMAT_R16G16B16A16_FLOAT);
m_Debug.OnCreate(pDevice, &m_ResourceViewHeaps, &m_VidMemBufferPool, DXGI_FORMAT_R16G16B16A16_FLOAT);
m_Debug.OnCreate(pDevice, &m_ResourceViewHeaps, &m_ConstantBufferRing, &m_VidMemBufferPool, DXGI_FORMAT_R16G16B16A16_FLOAT);

// Create tonemapping pass
m_ToneMappingPS.OnCreate(pDevice, &m_ResourceViewHeaps, &m_ConstantBufferRing, &m_VidMemBufferPool, pSwapChain->GetFormat());
Expand Down Expand Up @@ -163,7 +163,7 @@ void Renderer::OnDestroy()
m_ResourceViewHeaps.OnDestroy();
m_CommandListRing.OnDestroy();

#ifdef ENABLE_EXPERIMENTAL_WORKGRAPHS
#ifdef ENABLE_WORKGRAPHS
m_pDevice8Native->Release();
#endif
}
Expand Down Expand Up @@ -713,7 +713,7 @@ void Renderer::OnRender(const UIState* pState, const Camera& Cam, SwapChain* pSw
};
pCmdLst1->ResourceBarrier(1, preResolve);

m_Debug.Draw(pCmdLst1, &m_VBufferSRV);
m_Debug.Draw(pCmdLst1, &m_VBufferSRV, pState->showBins);

D3D12_RESOURCE_BARRIER postResolve[1] = {
CD3DX12_RESOURCE_BARRIER::Transition(m_VBuffer.GetResource(), D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, D3D12_RESOURCE_STATE_UNORDERED_ACCESS),
Expand Down
2 changes: 1 addition & 1 deletion src/DX12/Renderer.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// AMD SampleDX12 sample code
//
// Copyright(c) 2023 Advanced Micro Devices, Inc.All rights reserved.
// Copyright(c) 2024 Advanced Micro Devices, Inc.All rights reserved.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files(the "Software"), to deal
// in the Software without restriction, including without limitation the rights
Expand Down
8 changes: 4 additions & 4 deletions src/DX12/UI.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// AMD SampleDX12 sample code
//
// Copyright(c) 2023 Advanced Micro Devices, Inc.All rights reserved.
// Copyright(c) 2024 Advanced Micro Devices, Inc.All rights reserved.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files(the "Software"), to deal
// in the Software without restriction, including without limitation the rights
Expand Down Expand Up @@ -212,7 +212,7 @@ void GLTFSample::BuildUI()

if (ImGui::CollapsingHeader("Presentation Mode", ImGuiTreeNodeFlags_DefaultOpen))
{
const char* fullscreenModes[] = { "Windowed", "BorderlessFullscreen", "ExclusiveFulscreen" };
const char* fullscreenModes[] = { "Windowed", "BorderlessFullscreen", "ExclusiveFullscreen" };
if (ImGui::Combo("Fullscreen Mode", (int*)&m_fullscreenMode, fullscreenModes, _countof(fullscreenModes)))
{
if (m_previousFullscreenMode != m_fullscreenMode)
Expand All @@ -232,7 +232,7 @@ void GLTFSample::BuildUI()
"N-Dispatch (single-pass)",
"1-ExecuteIndirect (single-pass)",
"3-ExecuteIndirect (multi-pass)",
#ifdef ENABLE_EXPERIMENTAL_WORKGRAPHS
#ifdef ENABLE_WORKGRAPHS
"N-DispatchGrid",
"N-DispatchGrid (batched)",
"1-DispatchGrid (indirect node)"
Expand All @@ -250,7 +250,7 @@ void GLTFSample::BuildUI()
ImGui::Text(" ");
ImGui::Text("Objects : %i", m_UIState.feedback[0]);
ImGui::Text("Triangles : %i", m_UIState.feedback[1]);
#ifdef ENABLE_EXPERIMENTAL_WORKGRAPHS
#ifdef ENABLE_WORKGRAPHS
ImGui::Text("Backing Store : %.3f / %.3f KiB", 1.0f / 1000 * m_UIState.feedback[2], 1.0f / 1000 * m_UIState.feedback[3]);
#endif
ImGui::Text("Multi-Pass Store : %.3f tris / %.3f KiB", 1.0f / 1000 * m_UIState.feedback[4], 1.0f / 1000 * m_UIState.feedback[5]);
Expand Down
2 changes: 1 addition & 1 deletion src/DX12/UI.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// AMD SampleDX12 sample code
//
// Copyright(c) 2023 Advanced Micro Devices, Inc.All rights reserved.
// Copyright(c) 2024 Advanced Micro Devices, Inc.All rights reserved.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files(the "Software"), to deal
// in the Software without restriction, including without limitation the rights
Expand Down
6 changes: 4 additions & 2 deletions src/DX12/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
#include <vector>
#include <fstream>

#ifdef ENABLE_EXPERIMENTAL_WORKGRAPHS
#include "../../libs/d3d12wg/d3dx12.h"
#ifdef ENABLE_WORKGRAPHS
#include "../../libs/d3d12/d3d12.h"
#include "../../libs/d3d12x/d3dx12.h"
#else
#include <d3d12.h>
#include <d3dx12.h>
#endif

Expand Down

0 comments on commit 91a0df4

Please sign in to comment.