forked from LukasBanana/LLGL
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored binding model by deprecating "ResetResourceSlots()".
This is a larger refactoring first and foremost in the D3D11 backend since all other backends don't need to unbind resources when used simultaneously as read-only and read-write resources. With this change, LLGL automatically unbinds resources in the D3D11 backend so client code doesn't have to track SRV and UAV resources anymore. Only constant buffers and samplers are bound just as before, since those resources cannot be bound as read-write resources. - Deprecated "ResetResourceSlots()" as primary goal of this change. - Added default dummy implementation of ResetResourceSlots() and removed implementations from all backends. - Added thin (8 bytes) class "D3D11BindingLocator" to D3D11Buffer, D3D11BufferArray, and D3D11Texture: Stores information and range about the global binding tables. - Added D3D11BindingTable class: This is the main class for this new mechanism and automatically evicts resources from output slots when used as input (and vice-versa). - Added "D3D11RenderTargetHandles" class to better handle array of RTV, DSV, binding locators, and subresource ranges. - Added SparseForwardIterator<T> template to simplify iterating over binding tables with lots of null entries. - Integrated D3D11BindingLocator and D3D11SubresourceRange entries into D3D11ResourceHeap: Included in every heap section (TODO: don't include in heap section if none of the resources could ever have a binding locatorl, such as samplers and cbuffers). - Moved "SetShaderResources()" and "SetUnorderedAccessViews()" from D3D11StateManager to D3D11BindingTable. - Removed GLCmdUnbindResources and GLOpcodeUnbindResources from GL backend. - Removed Unbind* functions from GLStateManager.
- Loading branch information
1 parent
591fb23
commit f492217
Showing
51 changed files
with
2,688 additions
and
898 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/* | ||
* SparseForwardIterator.h | ||
* | ||
* Copyright (c) 2015 Lukas Hermanns. All rights reserved. | ||
* Licensed under the terms of the BSD 3-Clause license (see LICENSE.txt). | ||
*/ | ||
|
||
#ifndef LLGL_SPARSE_FORWARD_ITERATOR_H | ||
#define LLGL_SPARSE_FORWARD_ITERATOR_H | ||
|
||
|
||
namespace LLGL | ||
{ | ||
|
||
|
||
// Forward iterator over a range of objects that skips over null pointers. See D3D11BindingTable. | ||
template <typename T> | ||
class SparseForwardIterator | ||
{ | ||
|
||
public: | ||
|
||
using value_type = T; | ||
using pointer = T*; | ||
using reference = T&; | ||
|
||
public: | ||
|
||
SparseForwardIterator() noexcept = default; | ||
SparseForwardIterator(const SparseForwardIterator&) noexcept = default; | ||
SparseForwardIterator& operator = (const SparseForwardIterator&) noexcept = default; | ||
|
||
SparseForwardIterator(pointer end) noexcept : | ||
cur_ { end }, | ||
end_ { end } | ||
{ | ||
} | ||
|
||
SparseForwardIterator(pointer cur, pointer end) noexcept : | ||
cur_ { cur }, | ||
end_ { end } | ||
{ | ||
SkipNullEntries(); | ||
} | ||
|
||
SparseForwardIterator& operator ++ () | ||
{ | ||
++cur_; | ||
SkipNullEntries(); | ||
return *this; | ||
} | ||
|
||
SparseForwardIterator operator ++ (int) | ||
{ | ||
SparseForwardIterator result = *this; | ||
this->operator++(); | ||
return result; | ||
} | ||
|
||
bool operator == (const SparseForwardIterator& rhs) const noexcept | ||
{ | ||
return (cur_ == rhs.cur_); | ||
} | ||
|
||
bool operator != (const SparseForwardIterator& rhs) const noexcept | ||
{ | ||
return (cur_ != rhs.cur_); | ||
} | ||
|
||
reference operator * () const noexcept | ||
{ | ||
return *cur_; | ||
} | ||
|
||
pointer operator -> () const noexcept | ||
{ | ||
return cur_; | ||
} | ||
|
||
private: | ||
|
||
void SkipNullEntries() noexcept | ||
{ | ||
while (*cur_ == nullptr && cur_ != end_) | ||
++cur_; | ||
} | ||
|
||
private: | ||
|
||
pointer cur_ = nullptr; | ||
pointer end_ = nullptr; | ||
|
||
}; | ||
|
||
|
||
} // /namespace LLGL | ||
|
||
|
||
#endif | ||
|
||
|
||
|
||
// ================================================================================ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.