forked from PazerOP/TF2Vulkan
-
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.
WIP switching to texture/sampler arrays
- Loading branch information
Showing
21 changed files
with
759 additions
and
740 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#pragma once | ||
|
||
#include "AlignedTypes.h" | ||
#include "TF2Vulkan/Util/InPlaceVector.h" | ||
|
||
namespace TF2Vulkan | ||
{ | ||
static constexpr size_t MAX_SHADER_TEXTURE_BINDINGS = 32; | ||
class ShaderTextureBinder final | ||
{ | ||
public: | ||
void AddBinding(ITexture* tex, uint32_t& locationSpecConst) | ||
{ | ||
assert(tex); | ||
|
||
for (uint32_t i = 0; i < m_Bindings.size(); i++) | ||
{ | ||
auto& existing = m_Bindings[i]; | ||
if (existing.m_Texture == tex) | ||
{ | ||
locationSpecConst = i; | ||
return; | ||
} | ||
} | ||
|
||
auto& newBinding = m_Bindings.emplace_back(); | ||
newBinding.m_Texture = tex; | ||
locationSpecConst = m_Bindings.size() - 1; | ||
} | ||
|
||
auto begin() const { return m_Bindings.begin(); } | ||
auto end() const { return m_Bindings.end(); } | ||
|
||
private: | ||
struct Binding | ||
{ | ||
ITexture* m_Texture = nullptr; | ||
}; | ||
Util::InPlaceVector<Binding, MAX_SHADER_TEXTURE_BINDINGS> m_Bindings; | ||
}; | ||
} |
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,11 @@ | ||
#pragma once | ||
|
||
#include <materialsystem/itexture.h> | ||
|
||
class ITextureInternal : public ITexture | ||
{ | ||
private: | ||
virtual void EXPAND_CONCAT(DummyFunc, __COUNTER__)() const final { NOT_IMPLEMENTED_FUNC(); } | ||
public: | ||
virtual ShaderAPITextureHandle_t GetTextureHandle(int frame, int something = 0) = 0; | ||
}; |
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
Oops, something went wrong.