-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(Vulkan) CmdSetVertexBuffers required even if pipeline is created without a vertex input (RENAMED) #126
Comments
I see ultimately I'm going to need to call
I guess this is what I should be doing instead? This is quite a big change from my bindless system, but I suppose if it's necessary... Update: |
I'm very busy today and about to leave (karting race). Quick and incomplete response:
(I will answer only tomorrow) |
I spotted another "problem" with Vulkan requiring
This is used to "copy" an intermediate texture to the swap chain back buffer:
Since
Creating and setting a dummy vertex buffer will probably work fine, but it feels like a little bit of a hack. |
After applying the tweaks I mentioned I am able to get everything working under Vulkan.
|
Thanks for all info. I see 2 problems:
Correct? [UPDATED] |
What I gonna try and check:
Please, try this:
dynamicStates[dynamicStateNum++] = VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE; to: if (vi)
dynamicStates[dynamicStateNum++] = VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE;
|
Yes. It's by VK spec. The corresponding buffer usage must be set at creation time.
Yes. It's by D3D12 spec. Also, it looks like in this code: NRI_INLINE void CommandBufferD3D12::ClearStorageBuffer(const ClearStorageBufferDesc& clearDesc) {
DescriptorSetD3D12* descriptorSet = m_DescriptorSets[clearDesc.setIndex];
DescriptorD3D12* resourceView = (DescriptorD3D12*)clearDesc.storageBuffer;
const UINT clearValues[4] = {clearDesc.value, clearDesc.value, clearDesc.value, clearDesc.value};
m_GraphicsCommandList->ClearUnorderedAccessViewUint({descriptorSet->GetPointerGPU(clearDesc.rangeIndex, clearDesc.descriptorIndex)}, {resourceView->GetPointerCPU()}, *resourceView, clearValues, 0, nullptr);
}
|
And no... D3D12 |
I'm thinking to merge
Future:
|
As it turned out, // Clear (potentially slow)
// For any "SHADER_RESOURCE_STORAGE" descriptors (D3D: structured buffers are unsupported)
void (NRI_CALL *CmdClearStorage)(NriRef(CommandBuffer) commandBuffer, const NriRef(ClearStorageDesc) clearDesc);
// Clear storage
NriStruct(ClearStorageDesc) {
// For any buffers and textures with integer formats:
// - Clears a storage view with bit-precise values, copying the lower "N" bits from "value.[f/ui/i].channel"
// to the corresponding channel, where "N" is the number of bits in the "channel" of the resource format
// For textures:
// - Clears a storage view with float values. It only works on float, UNORM, and SNORM formats
// For buffers:
// - To avoid discrepancies in behavior between GAPIs prefer using "R32f/ui/i" formats for views
const NriPtr(Descriptor) storage;
Nri(Color) value; // avoid overflow
uint32_t setIndex;
uint32_t rangeIndex;
uint32_t descriptorIndex;
}; |
TL/DR:
Hope to commit everything tomorrow. |
Thanks for taking the time to go through all this. I know it's a lot! Real quick I just want to say that overall I'm having a really good experience using NRI. |
This is working perfectly. 👍 I'd like to just ask one more clarification: I noticed adding From:
To:
This really does work and I don't notice any rendering issues. |
Thanks (づ。◕‿‿◕。)づ ! Kinds words are enlightening for further improvements :)
Unfortunately, it will be
I don't think so. Maybe adjustments are needed. Let's discuss this in order:
=> Please:
Feel free to adjust wording. |
Fix for |
All completely reasonable. No further issues. |
I apologize for the terrible title. I cannot think of a decent summary.
It's probably best if I just describe a simplified scenario.
For context, I'm porting a D3D12-based renderer, and this all works as I expect it to when using D3D12 for NRI's API.
I'm creating a
nri::Buffer
for a mesh that contains 2 blocks of data: (In reality I use a few more.)So the vertex shader looks something like this:
NRI_RESOURCE(StructuredBuffer<float3>, Positions[], t, 0, 0);
Since I need to a create a 'Positions' view, I don't give the
nri::BufferDesc
a structure stride.However, the subsequent call to
nri::CoreInterface::UpdateDescriptorRanges()
results in a VK error:It seems not providing a structure stride causes the
nri::BufferVK
to be created without theVK_BUFFER_USAGE_STORAGE_BUFFER_BIT
flag.I don't really know much about Vulkan. So I can't say whether or not NRI is doing anything wrong.
Is my strategy not viable under Vulkan? Is there another way I should handle this?
Full example code here.
(You can just paste it into
Sample::Initialize()
in any of the sample projects...)The text was updated successfully, but these errors were encountered: