therealmjp / deferredtexturing Goto Github PK
View Code? Open in Web Editor NEWA rendering sample that demonstrates bindless deferred texturing using D3D12
License: MIT License
A rendering sample that demonstrates bindless deferred texturing using D3D12
License: MIT License
The following entry in BindlessDeferred.vcxproj attempts to copy the nonexistent dxcompiler.dll from the ..\Externals\DXCompiler\Bin folder to the output folder which causes the build to fail. Removing the offending entry fixes the issue.
DeferredTexturing/BindlessDeferred/BindlessDeferred.vcxproj
Lines 231 to 235 in 7767a72
Would you please explain why we need to linearize depth when reconstructing the world position from depth value? Isn't the depth value after homogenous divide (and consequently the value stored in and read from depth buffer) nonlinear and therefore, shouldn't the reverse operation (i.e., going from NDC to world space) use that nonlinear depth value?
For the context, I'm asking about PositionFromDepth in Deferred.hlsl.
Hey Matt,
Using VS2017 and hitting an break in ResourceUploadEnd`` in
DX12_Upload.cpp```:
D3D12 ERROR: ID3D12CommandQueue::ExecuteCommandLists: Simultaneous-access or Buffer Resource (0x0000024F386C7940:'Decal Buffer') is still referenced by transition_barrier GPU operations in-flight on another Command Queue (0x0000024F24C657F0:'Unnamed ID3D12CommandQueue Object'). It is not safe to start write GPU operations now on this Command Queue (0x0000024F24CBB4C0:'Unnamed ID3D12CommandQueue Object'). This can result in race conditions and application instability. [ EXECUTION ERROR #1047: OBJECT_ACCESSED_WHILE_STILL_IN_USE]
D3D12: **BREAK** enabled for the previous message, which was: [ ERROR EXECUTION #1047: OBJECT_ACCESSED_WHILE_STILL_IN_USE ]
I poked around a bit but couldn't figure out what was going on. Was wondering if you had seen something like this on VS2017?
Hello, I tried compile demo with MSVC 2017. Need update libs.
Severity Code Description Project File Line Suppression State
Error C1047 The object or library file '..\Externals\HosekSky\Lib 2015\HosekSky.lib' was created with an older compiler than other objects; rebuild old objects and libraries BindlessDeferred C:\Users\capitalknew\Documents\DeferredTexturing\BindlessDeferred\LINK 1
I don't know if it's just me but I noticed that the roughness maps weren't being loaded. The model didn't seem to have any textures of type aiTextureType_SHININESS. This is on the latest version of the master branch with VS2017.
DeferredTexturing/SampleFramework12/v1.01/Graphics/Model.cpp
Lines 499 to 500 in fe52746
KernelBase.dll!00007ffc7b5a536c() Unknown
DXGIDebug.dll!00007ffc6bb63059() Unknown
d3d12SDKLayers.dll!00007ffb43f8fcd8() Unknown
d3d12SDKLayers.dll!00007ffb43eb4b2a() Unknown
d3d12SDKLayers.dll!00007ffb43eb49e3() Unknown
d3d12SDKLayers.dll!00007ffb43ee3976() Unknown
d3d12SDKLayers.dll!00007ffb43ed8cf7() Unknown
d3d12SDKLayers.dll!00007ffb43ec393d() Unknown
BindlessDeferred_2019.exe!SampleFramework12::Buffer::Initialize(unsigned __int64 size, unsigned int64 alignment, unsigned int dynamic, unsigned int cpuAccessible, unsigned int allowUAV, const void * initData, D3D12_RESOURCE_STATES initialState, ID3D12Heap * heap, unsigned int64 heapOffset, const wchar_t * name) Line 279 C++
BindlessDeferred_2019.exe!SampleFramework12::StructuredBuffer::Initialize(const SampleFramework12::StructuredBufferInit & init) Line 510 C++
BindlessDeferred_2019.exe!BindlessDeferred::Initialize() Line 374 C++
BindlessDeferred_2019.exe!SampleFramework12::App::Initialize_Internal() Line 201 C++
BindlessDeferred_2019.exe!SampleFramework12::App::Run() Line 62 C++
BindlessDeferred_2019.exe!wWinMain(HINSTANCE * hInstance, HINSTANCE * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) Line 2431 C++
[External Code]
D3D12 WARNING: ID3D12Device::CreateCommittedResource: Ignoring InitialState D3D12_RESOURCE_STATE_GENERIC_READ. Buffers are effectively created in state D3D12_RESOURCE_STATE_COMMON. [ STATE_CREATION WARNING #1328: CREATERESOURCE_STATE_IGNORED]
D3D12: BREAK enabled for the previous message, which was: [ WARNING STATE_CREATION #1328: CREATERESOURCE_STATE_IGNORED ]
Exception thrown at 0x00007FFC7B5A536C (KernelBase.dll) in BindlessDeferred_2019.exe: 0x0000087A (parameters: 0x0000000000000002, 0x000000A1B091D350, 0x000000A1B091F120).
Unhandled exception at 0x00007FFC7B5A536C (KernelBase.dll) in BindlessDeferred_2019.exe: 0x0000087A (parameters: 0x0000000000000002, 0x000000A1B091D350, 0x000000A1B091F120).
Hello! I was trying to run the sample on my computer, however when starting the pre-built executable I get the following error:
I'm running this on an RTX4080 with NVIDIA GR Driver Version 551.52 - I tried recompiling it in VS2022, but I was getting errors with it due to me using a newer version of VS since the project seems to have been compiled with VS2015.
Hi, I'm using VS2022 and I get the following error message when building the project:
Severity Code Description Project File Line Suppression State
Error MSB8066 Custom build for '..\Externals\Assimp-3.1.1\bin\assimp.dll;AppSettings.cs;..\Externals\WinPixEventRuntime\bin\WinPixEventRuntime.dll;..\Externals\DXCompiler\Bin\dxcompiler.dll;..\Externals\DXCompiler\Bin\dxil.dll' exited with code 1. BindlessDeferred_2019 C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets 245
I tried both solutions. And installing pix and assimp packages manually. Running on Win10 21H2 - GTX 1060
I noticed a rare issue with clustered spotlights which only appears at certain positions and orientations.
The issue can be reproduced using following camera position and orientation (replace the following code in BindlessDeferred::InitializeScene()
line 1063:
camera.SetPosition(Float3(3.49f, 1.76f, 0.49f));
camera.SetXRotation(-0.26f);
camera.SetYRotation(4.7f);
I also noticed, setting the scaleCorrection
to 1.0f in BindlessDeferred::UpdateLights()
before calculating light bounds, "fixes" the issue (though from your comment on it, this probably causes other issues due to inaccurate bounds ^^)
It actually works pretty well on AMD GCN Gen1 (tested on R9 280, which is actually a re-branded HD7950 at higher clock speed). Of course I modified the code to require FL 11_1. It does not run on Haswell (FL 11_1 too).
The first GPU is like all other FL 12_0 AMD GPUs (GCN Gen2 and beyond) except for tiled resources (tier 1 instead of tier 2), while hasswell does not support tiled resources at all (31-bit virtual address pain) and it is a tier 1 in resource binding (so no real bindless capabilities).
Maybe I just ignoring something, I did not deeply check the code now....
D3D12 ERROR: ID3D12Device::CreateComputeShader: Shader is corrupt or in an unrecognized format. [ STATE_CREATION ERROR #322: CREATECOMPUTESHADER_INVALIDSHADERBYTECODE]
D3D12: **BREAK** enabled for the previous message, which was: [ ERROR STATE_CREATION #322: CREATECOMPUTESHADER_INVALIDSHADERBYTECODE ]
In the sample framework code Skybox.cpp
you compute the spectrum for the ground albedo using
SampledSpectrum groundAlbedoSpectrum = SampledSpectrum::FromRGB(Albedo);
By default PBRT assumes FromRGB
is getting an illuminant, but isn't the ground albedo providing reflectance? I'd have expected
SampledSpectrum groundAlbedoSpectrum = SampledSpectrum::FromRGB(Albedo, SpectrumType::Reflectance);
The FP16Scale
in SF12_Math.h is described as
Scale factor used for storing physical light units in fp16 floats
I thought this might be a 32bit to 16bit conversion but that doesn't seem right, right? it is only applied when reading the model data (in Model.cpp) when storing spotlights intensity and then reapplied when doing exposure. I did a quick search on internet but haven't found anything about this specific value in literature. Is this a scene-specific constant based on max light value (e.g. sun brightness)? Or is it a rule-of-thumb value that works in most scenarios?
An exception is thrown at the following call in the RenderDeferred() method in the Debug build:
cmdList->SetComputeRootDescriptorTable(Deferred_Descriptors, tableStart.GPUHandle);
The error message output by the DX debug layer is as follows:
D3D12 ERROR: CCommandList::SetComputeRootDescriptorTable: Resource state (0xA0: D3D12_RESOURCE_STATE_DEPTH_READ|D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE) of resource (0x000001A4B11975D0:'Unnamed ID3D12Resource Object') (subresource: 0) is invalid for use as a NON_PIXEL_SHADER_RESOURCE. Expected State Bits (all): 0x40: D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE, Actual State: 0xA0: D3D12_RESOURCE_STATE_DEPTH_READ|D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, Missing State: 0x40: D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE. This validation is being enforced at bind during command list recording because the descriptor for this resource in the root signature is declared as DATA_STATIC_WHILE_SET_AT_EXECUTE. [ EXECUTION ERROR #538: INVALID_SUBRESOURCE_STATE]
What's odd is that the only resource that is ever in a state of 'D3D12_RESOURCE_STATE_DEPTH_READ|D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE' is the depth buffer and that is transitioned to 'D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE | D3D12_RESOURCE_STATE_DEPTH_READ' before the call to SetComputeRootDescriptorTable. Not sure why the runtime is throwing this error, maybe its some other resource?
I get the same error if I create a WARP device so I don't think it might be a driver issue.
My system config is as follows:
CPU: Intel i7-4770k
GPU: NVIDIA GeForce GTX 1060 6 GB
RAM: 8 GB
Driver version: 375.70 (Release date: 10/27/2016)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.