Comments (2)
Assuming that I understand your question correctly: Shader resource binding is already implemented. Here's how it works:
Step 1 - Descriptor set layout
For each shader, a list of resource slots that are used by the shader is stored. So if a vertex shader uses constant buffer c0
, that information will be remembered. When a given set of shaders is used for rendering for the first time, this information will be used to create a descriptor set layout.
Let's assume you render your scene with a vertex shader which uses constant buffer c0
, and a pixel shader which uses sampler s0
, texture t0
and its own constant buffer c0
. Bindings in the descriptor set layout are tightly packed, and each resource has its own binding, so you'll end up with:
- Binding 0 ->
c0
(Vertex shader) with typeVK_DESCRIPTOR_TYPE_UNIFORM_BUFFER
- Binding 1 ->
c0
(Pixel shader) with typeVK_DESCRIPTOR_TYPE_UNIFORM_BUFFER
- Binding 2 ->
s0
(Pixel shader) with typeVK_DESCRIPTOR_TYPE_SAMPLER
- Binding 3 ->
t0
(Pixel shader) with typeVK_DESCRIPTOR_TYPE_SAMPLED_IMAGE
Again, this binding mapping is stored. The descriptor set layout will be used to create a pipeline layout, there are no additional descriptor set layouts.
Step 2 - Descriptor set allocation
There is a descriptor set allocator tied to the command buffer, which automatically creates descriptor pools when needed. The descriptor pools don't really care about the pipeline layout, they just have a fixed number of descriptors of each type, and are created in a way that descriptor sets cannot be freed individually.
Each time a draw call is executed, if a new resource has been bound or if the shader pipeline itself has changed, a new descriptor set is created and immediately updated with vkUpdateDescriptorSets
, using the resources that are currently bound to the D3D context.
Now in reality, there's another level of indirection because all D3D stuff goes through an intermediate layer first (which does all the heavy lifting), but the explanation is still valid since a pixel shader's c0
is statically assigned to resource slot 12
in the backend and so on. Here's the relevant pieces of code:
src/dxvk/dxvk_descriptor.cpp
src/dxvk/dxvk_pipelayout.cpp
src/dxvk/dxvk-context.cpp
src/dxvk/dxvk-cmdlist.cpp
from dxvk.
Thanks for the answer, thus means you have only one unique descriptor set, my question was about multiple descriptor set introduced in vulkan but one set works as well.
Thanks
from dxvk.
Related Issues (20)
- Not working with nouveau driver (Vulkan 1.3.279) HOT 21
- Sequence Editor from Legendary Explorer of ME3Tweaks Mod Manager triggers GDI assert HOT 2
- [D3D9 x32] Resident Evil: Operation Raccoon City crashes before getting to the title screen HOT 7
- assassin creed origin game frezen when play around 30 min version 2.4 and assassin creed odyssey fps drop Bad performeance when install dxvk all version HOT 4
- Assassin's Creed Odyssey game frezen and fps not a stable HOT 2
- [Black Mesa] Transparency effects have very different rendering compared to native D3D9 HOT 7
- Graphical and color distortions in The Witcher HOT 3
- [d3d8] Ballance black screen HOT 5
- How do I use dxvk-native on Linux? HOT 4
- ninja: build stopped: subcommand failed - 'remove_if' is not a member of 'std' HOT 4
- Spider-Man Shattered Dimensions: light cutoff and flickering HOT 7
- Moonshot Feature Request: Generic AFMF HOT 4
- Mafia: The City of Lost Heaven on DXVK 2.4 = Crash HOT 5
- [d3d9] GTA: Vice City 1.0 crashes after intro video HOT 15
- Documentation: 32 bit and 64 bit mixed? HOT 1
- [d3d9] Might and Magic Heroes VI: vsync switch not working HOT 7
- Do all depth-stencil images need `VK_IMAGE_USAGE_SAMPLED_BIT` set by default? HOT 3
- About the implementation of D3D10.dll HOT 7
- [d3d9] I.G.I 2: Covert Strike doesn't boot HOT 14
- Rainbow Six 3 - broken Planing Phase. HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dxvk.