mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-29 23:17:30 +01:00
Walk the shadow passes and the culled model groups on worker threads in the Vulkan renderer
This commit is contained in:
@@ -31,13 +31,13 @@ Copyright (C) 2001-2004 Marcin Wozniak, Maciej Czapkiewicz and others
|
||||
|
||||
using namespace Mtable;
|
||||
|
||||
float TSubModel::fSquareDist = 0.f;
|
||||
std::uintptr_t TSubModel::iInstance; // numer renderowanego egzemplarza obiektu
|
||||
std::uint32_t TSubModel::iVariantSeed = 0; // ziarno losowania wariantów tekstur renderowanego egzemplarza
|
||||
texture_handle const *TSubModel::ReplacableSkinId = nullptr;
|
||||
int TSubModel::iAlpha = 0x30300030; // maska do testowania flag tekstur wymiennych
|
||||
TModel3d *TSubModel::pRoot; // Ra: tymczasowo wskaźnik na model widoczny z submodelu
|
||||
std::string *TSubModel::pasText;
|
||||
thread_local float TSubModel::fSquareDist = 0.f;
|
||||
thread_local std::uintptr_t TSubModel::iInstance; // numer renderowanego egzemplarza obiektu
|
||||
thread_local std::uint32_t TSubModel::iVariantSeed = 0; // ziarno losowania wariantów tekstur renderowanego egzemplarza
|
||||
thread_local texture_handle const *TSubModel::ReplacableSkinId = nullptr;
|
||||
thread_local int TSubModel::iAlpha = 0x30300030; // maska do testowania flag tekstur wymiennych
|
||||
thread_local TModel3d *TSubModel::pRoot; // Ra: tymczasowo wskaźnik na model widoczny z submodelu
|
||||
thread_local std::string *TSubModel::pasText;
|
||||
// przykłady dla TSubModel::iAlpha:
|
||||
// 0x30300030 - wszystkie bez kanału alfa
|
||||
// 0x31310031 - tekstura -1 używana w danym cyklu, pozostałe nie
|
||||
|
||||
@@ -172,15 +172,17 @@ public:
|
||||
bool is_emitter() const;
|
||||
|
||||
public:
|
||||
static size_t iInstance; // identyfikator egzemplarza, który aktualnie renderuje model
|
||||
// the state of the walk drawing a model: per thread, as the vulkan renderer walks the passes of the scene on several of them at
|
||||
// once (gfx.vulkan.parallelpasses)
|
||||
static thread_local size_t iInstance; // identyfikator egzemplarza, który aktualnie renderuje model
|
||||
// seed of the currently rendered model instance, combined with m_variantgroup it picks
|
||||
// texture variants for materials which declare them. 0 for instances without own seed
|
||||
static std::uint32_t iVariantSeed;
|
||||
static material_handle const *ReplacableSkinId;
|
||||
static int iAlpha; // maska bitowa dla danego przebiegu
|
||||
static float fSquareDist;
|
||||
static TModel3d *pRoot;
|
||||
static std::string *pasText; // tekst dla wyświetlacza (!!!! do przemyślenia)
|
||||
static thread_local std::uint32_t iVariantSeed;
|
||||
static thread_local material_handle const *ReplacableSkinId;
|
||||
static thread_local int iAlpha; // maska bitowa dla danego przebiegu
|
||||
static thread_local float fSquareDist;
|
||||
static thread_local TModel3d *pRoot;
|
||||
static thread_local std::string *pasText; // tekst dla wyświetlacza (!!!! do przemyślenia)
|
||||
TSubModel() = default;
|
||||
~TSubModel();
|
||||
std::pair<int, int> Load(cParser &Parser, /*TModel3d *Model, int Pos,*/ bool dynamic);
|
||||
|
||||
@@ -1590,6 +1590,8 @@ texture_bank::memory() const {
|
||||
memory_data result;
|
||||
for( auto const &texture : m_textures ) {
|
||||
if( texture.first == nullptr ) { continue; }
|
||||
// made by another thread at the moment
|
||||
if( texture.first->busy() ) { continue; }
|
||||
if( false == texture.first->data.empty() ) {
|
||||
++result.cpu.count;
|
||||
result.cpu.bytes += memory_of( texture.first->data );
|
||||
@@ -1668,6 +1670,10 @@ texture_bank::info() const {
|
||||
|
||||
for( auto const& texture : m_textures ) {
|
||||
|
||||
if( texture.first->busy() ) {
|
||||
// made by another thread at the moment, counted once it's done
|
||||
continue;
|
||||
}
|
||||
totaltexturesize += texture.first->size;
|
||||
#ifdef EU07_DEFERRED_TEXTURE_UPLOAD
|
||||
|
||||
|
||||
@@ -82,6 +82,11 @@ struct texture_source : public ITexture {
|
||||
// the object of the renderer goes, with the bank of the textures
|
||||
virtual void
|
||||
destroy() = 0;
|
||||
// another thread of the renderer works on the texture (makes its object from the data, which it reads too): what it holds isn't for
|
||||
// the other threads to read until it's done
|
||||
virtual bool
|
||||
busy() const {
|
||||
return false; }
|
||||
|
||||
// members
|
||||
bool has_alpha{ false }; // indicates the texture has alpha channel
|
||||
|
||||
Reference in New Issue
Block a user