D3D12 always requires an explicit buffer resource for the results of a query heap.
OpenGL added a buffer type GL_QUERY_BUFFER so the query results can be used in a shader.
This functionality should be added to LLGL.
Proposal:
enum class BufferType {
/* ... */
QueryResult,
};
struct BufferFlags {
enum {
/* ... */
// Force creation of query buffer also for GL backend.
// Otherwise, the buffer is only created for D3D12.
QueryShaderReadAccess = (1 << 3),
};
};
class CommandBuffer {
/* ... */
void ResolveQuery(
Buffer& dstBuffer,
std::uint64_t dstOffset,
QueryHeap& srcQueryHeap,
std::uint32_t firstQuery,
std::uint32_t numQueries
);
};
D3D12 always requires an explicit buffer resource for the results of a query heap. OpenGL added a buffer type
GL_QUERY_BUFFER
so the query results can be used in a shader. This functionality should be added to LLGL.Proposal:
Example: