Skip to content

Commit

Permalink
directx12 bindless in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
Try committed Mar 27, 2023
1 parent c54b723 commit d8ee2a3
Show file tree
Hide file tree
Showing 19 changed files with 513 additions and 423 deletions.
18 changes: 12 additions & 6 deletions Engine/gapi/directx12/dxcommandbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ void DxCommandBuffer::end() {
dxAssert(impl->Close());
state = NoRecording;
resetDone = false;
for(size_t i=0;i<DxPipelineLay::MAX_BINDS;++i)
for(size_t i=0; i<DxPipelineLay::HEAP_MAX; ++i)
currentHeaps[i] = nullptr;
}

Expand Down Expand Up @@ -468,25 +468,31 @@ void DxCommandBuffer::implSetUniforms(AbstractGraphicsApi::Desc& u, bool isCompu
DxDescriptorArray& ux = reinterpret_cast<DxDescriptorArray&>(u);
curUniforms = &ux;

auto& lx = *ux.lay.handler;
if(lx.isRuntimeSized()) {
ux.bindRuntimeSized(*impl, currentHeaps, isCompute);
return;
}

bool setH = false;
for(size_t i=0;i<DxPipelineLay::MAX_BINDS;++i) {
for(size_t i=0; i<DxPipelineLay::HEAP_MAX; ++i) {
if(ux.val.heap[i]!=currentHeaps[i]) {
setH = true;
break;
}
}

if(setH) {
for(size_t i=0;i<DxPipelineLay::MAX_BINDS;++i)
for(size_t i=0; i<DxPipelineLay::HEAP_MAX; ++i)
currentHeaps[i] = ux.val.heap[i];
// NOTE: pDescriptorHeaps[i] must not be NULL
impl->SetDescriptorHeaps(ux.heapCnt, currentHeaps);
}

auto& lx = *ux.lay.handler;
for(size_t i=0;i<lx.roots.size();++i) {
auto& r = lx.roots[i];
auto desc = ux.val.gpu[r.heap];
desc.ptr+=r.heapOffset;
desc.ptr += r.heapOffset;
if(isCompute)
impl->SetComputeRootDescriptorTable (UINT(i), desc); else
impl->SetGraphicsRootDescriptorTable(UINT(i), desc);
Expand Down Expand Up @@ -549,7 +555,7 @@ void DxCommandBuffer::copy(AbstractGraphicsApi::Buffer& dstBuf, size_t offset,
pushStage(dx.release());
}

void Tempest::Detail::DxCommandBuffer::prepareDraw(size_t voffset, size_t firstInstance) {
void DxCommandBuffer::prepareDraw(size_t voffset, size_t firstInstance) {
if(pushBaseInstanceId!=uint32_t(-1)) {
struct SPIRV_Cross_VertexInfo {
int32_t SPIRV_Cross_BaseVertex;
Expand Down
2 changes: 1 addition & 1 deletion Engine/gapi/directx12/dxcommandbuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class DxCommandBuffer:public AbstractGraphicsApi::CommandBuffer {

DxFboLayout fboLayout;

ID3D12DescriptorHeap* currentHeaps[DxPipelineLay::MAX_BINDS]={};
ID3D12DescriptorHeap* currentHeaps[DxPipelineLay::HEAP_MAX] = {};
AbstractGraphicsApi::Desc* curUniforms = nullptr;

uint32_t pushBaseInstanceId = -1;
Expand Down
Loading

0 comments on commit d8ee2a3

Please sign in to comment.