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.
Main menu casual/competitive badge is no longer "crash the game" button
- Loading branch information
Showing
25 changed files
with
364 additions
and
311 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
66 changes: 66 additions & 0 deletions
66
shaderapivulkan/src/TF2Vulkan/IShaderAPI/IShaderAPI_MeshManager.cpp
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,66 @@ | ||
#include "IShaderAPI_MeshManager.h" | ||
|
||
#include <materialsystem/imesh.h> | ||
|
||
using namespace TF2Vulkan; | ||
|
||
int IShaderAPI_MeshManager::GetMaxVerticesToRender(IMaterial* material) | ||
{ | ||
LOG_FUNC(); | ||
|
||
VertexFormat fmt(material->GetVertexFormat()); | ||
fmt.RemoveFlags(VertexFormatFlags::Meta_Compressed); | ||
|
||
const auto vtxSize = fmt.GetVertexSize(); | ||
const auto currentDynamicVBSize = GetCurrentDynamicVBSize(); | ||
|
||
if (vtxSize < 1) | ||
{ | ||
Warning(TF2VULKAN_PREFIX "Invalid vertex size %i for material %s (%s)\n", | ||
vtxSize, material->GetName(), material->GetShaderName()); | ||
return currentDynamicVBSize; | ||
} | ||
|
||
return currentDynamicVBSize / vtxSize; | ||
} | ||
|
||
int IShaderAPI_MeshManager::GetMaxIndicesToRender() | ||
{ | ||
LOG_FUNC(); | ||
|
||
// Technically we're "unlimited" (constrained by (v)ram only) | ||
return INDEX_BUFFER_SIZE; | ||
} | ||
|
||
int IShaderAPI_MeshManager::GetCurrentDynamicVBSize() | ||
{ | ||
LOG_FUNC(); | ||
// Technically we're "unlimited" (constrained by (v)ram only) | ||
return DYNAMIC_VERTEX_BUFFER_MEMORY; | ||
} | ||
|
||
IMesh* IShaderAPI_MeshManager::GetDynamicMesh(IMaterial* material, int hwSkinBoneCount, | ||
bool buffered, IMesh* vertexOverride, IMesh* indexOverride) | ||
{ | ||
LOG_FUNC(); | ||
return GetDynamicMeshEx(material, material->GetVertexFormat(), hwSkinBoneCount, buffered, vertexOverride, indexOverride); | ||
} | ||
|
||
IMesh* IShaderAPI_MeshManager::GetDynamicMeshEx(IMaterial* material, VertexFormat_t vertexFormat, | ||
int hwSkinBoneCount, bool buffered, IMesh* vertexOverride, IMesh* indexOverride) | ||
{ | ||
LOG_FUNC(); | ||
|
||
const VertexFormat fmt(vertexFormat); | ||
assert(hwSkinBoneCount == 0); | ||
assert(fmt.m_BoneWeightCount == 0); | ||
assert(!(fmt.m_Flags & VertexFormatFlags::BoneIndex)); | ||
|
||
return &m_DynamicMeshes.try_emplace(fmt, fmt, true).first->second; | ||
} | ||
|
||
CMeshBuilder* IShaderAPI_MeshManager::GetVertexModifyBuilder() | ||
{ | ||
LOG_FUNC(); | ||
return &m_MeshBuilder; | ||
} |
39 changes: 39 additions & 0 deletions
39
shaderapivulkan/src/TF2Vulkan/IShaderAPI/IShaderAPI_MeshManager.h
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,39 @@ | ||
#pragma once | ||
|
||
#include "IShaderAPI_TextureManager.h" | ||
#include "TF2Vulkan/VertexFormat.h" | ||
#include "TF2Vulkan/VulkanMesh.h" | ||
|
||
namespace TF2Vulkan | ||
{ | ||
class IShaderAPI_MeshManager : public IShaderAPI_TextureManager | ||
{ | ||
public: | ||
void GetMaxToRender(IMesh* mesh, bool maxUntilFlush, int* maxVerts, int* maxIndices) override final { NOT_IMPLEMENTED_FUNC(); } | ||
|
||
int GetMaxVerticesToRender(IMaterial* material) override final; | ||
int GetMaxIndicesToRender() override final; | ||
|
||
IMesh* GetFlexMesh() override final { NOT_IMPLEMENTED_FUNC(); } | ||
|
||
int GetCurrentDynamicVBSize() override final; | ||
void DestroyVertexBuffers(bool exitingLevel) override final { NOT_IMPLEMENTED_FUNC(); } | ||
|
||
CMeshBuilder* GetVertexModifyBuilder() override final; | ||
IMesh* GetDynamicMesh(IMaterial* material, int hwSkinBoneCount, bool buffered, | ||
IMesh* vertexOverride, IMesh* indexOverride) override final; | ||
IMesh* GetDynamicMeshEx(IMaterial* material, VertexFormat_t vertexFormat, int hwSkinBoneCount, | ||
bool buffered, IMesh* vertexOverride, IMesh* indexOverride) override final; | ||
|
||
const ActiveMeshData& GetActiveMesh() override final { return m_ActiveMesh.top(); } | ||
void PushActiveMesh(const ActiveMeshData& mesh) override final { m_ActiveMesh.push(mesh); } | ||
void PopActiveMesh() override final { m_ActiveMesh.pop(); } | ||
|
||
private: | ||
std::unordered_map<VertexFormat, VulkanMesh> m_DynamicMeshes; | ||
|
||
CMeshBuilder m_MeshBuilder; | ||
|
||
std::stack<ActiveMeshData, std::vector<ActiveMeshData>> m_ActiveMesh; | ||
}; | ||
} |
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.