-
Notifications
You must be signed in to change notification settings - Fork 12
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
Example 14 ComputeScan fix for new NBL API and use HLSL #113
base: master
Are you sure you want to change the base?
Example 14 ComputeScan fix for new NBL API and use HLSL #113
Conversation
auto minSSBOAlign = m_physicalDevice->getLimits().minSSBOAlignment; | ||
constexpr auto begin = in_count / 4 + 118; | ||
assert(((begin * sizeof(uint32_t)) & (minSSBOAlign - 1u)) == 0u); | ||
constexpr auto end = in_count * 3 / 4 - 78; | ||
assert(((end * sizeof(uint32_t)) & (minSSBOAlign - 1u)) == 0u); | ||
constexpr auto elementCount = end - begin; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the point of all this?
{ | ||
IGPUBuffer::SCreationParams inputDataBufferCreationParams = {}; | ||
inputDataBufferCreationParams.size = sizeof(uint32_t) * in_count; // TODO Declare the element data type in the shader? | ||
inputDataBufferCreationParams.usage = IGPUBuffer::EUF_STORAGE_BUFFER_BIT | IGPUBuffer::EUF_TRANSFER_SRC_BIT | IGPUBuffer::EUF_TRANSFER_DST_BIT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
address usage, if you want to use BDA
CArithmeticOps::DispatchInfo reduce_dispatch_info; | ||
reducer->buildParameters(elementCount, reduce_push_constants, reduce_dispatch_info); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I've left a comment in the "mother PR" that this should be a constructor of parameters or something
Kinda silly to have to use a factory to do some basic arithmetic
14_ComputeReduce/main.cpp
Outdated
// (REVIEW): Check if this new download_buffer is needed or if we can directly read from the gpu_input buffer | ||
auto downloaded_buffer = m_device->createBuffer(std::move(params)); | ||
auto memReqs = downloaded_buffer->getMemoryReqs(); | ||
memReqs.memoryTypeBits &= m_physicalDevice->getDownStreamingMemoryTypeBits(); | ||
auto queriesMem = m_device->allocate(memReqs, downloaded_buffer.get()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use the downstreaming buffer and make a consumption callback.
Otherwise you'll have a problem making a 128MB HOST_VISIBLE and DEVICE_LOCAL buffer, not everyone has ReBAR configured correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See example 05 (whichever does the streaming consumer callback), how to download a buffer and consume it "piecewise"
Still doesn't work. There are shader issues with shared memory reading. The basic outline is correct however.