dynpip rearrangment

This commit is contained in:
h4570
2022-07-18 23:50:25 +02:00
parent f08fc1c8d3
commit 2fe40c8d90
35 changed files with 111 additions and 37 deletions
@@ -0,0 +1,41 @@
/*
# ______ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2022, tyra - https://github.com/h4570/tyra
# Licenced under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#pragma once
#include <tamtypes.h>
#include "./bag/dynpip_bag.hpp"
#include "renderer/core/renderer_core.hpp"
namespace Tyra {
class DynPipCore {
public:
DynPipCore();
~DynPipCore();
void init(RendererCore* t_core);
/** Render 3D via "bags" */
void render(DynPipBag* data);
/**
* - Uploads standard VU1 programs.
* - Sends static "Tyra Renderer3D" VU1 data.
* - Sets double buffers exactly for "Tyra Renderer3D"
* Should be called if VU1 was used by your non standard programs.
*/
void reinitStandardVU1Programs();
private:
RendererCore* rendererCore;
};
} // namespace Tyra
@@ -12,7 +12,8 @@
#include <tamtypes.h>
#include "../renderer_3d_pipeline.hpp"
#include "./dynpip_options.hpp"
#include "./core/dynpip_options.hpp"
#include "./core/dynpip_core.hpp"
#include "renderer/core/renderer_core.hpp"
#include "renderer/3d/mesh/dynamic/dynamic_mesh.hpp"
@@ -23,10 +24,16 @@ class DynamicPipeline : public Renderer3DPipeline {
DynamicPipeline();
~DynamicPipeline();
DynPipCore core;
void init(RendererCore* core);
void onUse();
/**
* Render 3D via "meshes".
* This render() method is a bridge to core.render() method.
*/
void render(DynamicMesh* mesh, const DynPipOptions* options = nullptr);
};
@@ -19,14 +19,14 @@
namespace Tyra {
class StaPipelineCore {
class StaPipCore {
public:
StaPipelineCore();
~StaPipelineCore();
StaPipCore();
~StaPipCore();
void init(RendererCore* t_core);
/** Render 3D data via "bags" */
/** Render 3D via "bags" */
void render(StaPipBag* data, StaPipBagPackagesBBox* bbox = nullptr);
/** Get max vert count of VU1 qbuffer (for optimizations) */
@@ -15,7 +15,7 @@
#include "./stapip_options.hpp"
#include "renderer/core/renderer_core.hpp"
#include "renderer/3d/mesh/dynamic/dynamic_mesh.hpp"
#include "./core/static_pipeline_core.hpp"
#include "./core/stapip_core.hpp"
namespace Tyra {
@@ -24,6 +24,8 @@ class StaticPipeline : public Renderer3DPipeline {
StaticPipeline();
~StaticPipeline();
StaPipCore core;
void init(RendererCore* core);
void onUse();
@@ -35,7 +37,6 @@ class StaticPipeline : public Renderer3DPipeline {
void render(DynamicMesh* mesh, const StaPipOptions* options = nullptr);
private:
StaPipelineCore core;
RendererCore* rendererCore;
Vec4* colorsCache;
@@ -8,7 +8,7 @@
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#include "renderer/3d/pipeline/dynamic/bag/dynpip_bag.hpp"
#include "renderer/3d/pipeline/dynamic/core/bag/dynpip_bag.hpp"
#include <sstream>
#include <iomanip>
@@ -8,7 +8,7 @@
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#include "renderer/3d/pipeline/dynamic/bag/dynpip_color_bag.hpp"
#include "renderer/3d/pipeline/dynamic/core/bag/dynpip_color_bag.hpp"
namespace Tyra {
@@ -8,7 +8,7 @@
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#include "renderer/3d/pipeline/dynamic/bag/dynpip_lighting_bag.hpp"
#include "renderer/3d/pipeline/dynamic/core/bag/dynpip_lighting_bag.hpp"
namespace Tyra {
@@ -8,7 +8,7 @@
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#include "renderer/3d/pipeline/dynamic/bag/dynpip_texture_bag.hpp"
#include "renderer/3d/pipeline/dynamic/core/bag/dynpip_texture_bag.hpp"
namespace Tyra {
@@ -0,0 +1,27 @@
/*
# ______ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2022, tyra - https://github.com/h4570/tyra
# Licenced under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#include "renderer/3d/pipeline/dynamic/core/dynpip_core.hpp"
#include <sstream>
#include <iomanip>
namespace Tyra {
DynPipCore::DynPipCore() {}
DynPipCore::~DynPipCore() {}
void DynPipCore::init(RendererCore* t_core) { rendererCore = t_core; }
void DynPipCore::reinitStandardVU1Programs() {}
void DynPipCore::render(DynPipBag* bag) {}
} // namespace Tyra
@@ -8,7 +8,7 @@
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#include "renderer/3d/pipeline/dynamic/dynpip_programs_repository.hpp"
#include "renderer/3d/pipeline/dynamic/core/dynpip_programs_repository.hpp"
namespace Tyra {
@@ -8,7 +8,7 @@
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#include "renderer/3d/pipeline/dynamic/dynpip_qbuffer.hpp"
#include "renderer/3d/pipeline/dynamic/core/dynpip_qbuffer.hpp"
#include <sstream>
#include <iomanip>
@@ -8,7 +8,7 @@
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#include "renderer/3d/pipeline/dynamic/dynpip_vu1_program.hpp"
#include "renderer/3d/pipeline/dynamic/core/dynpip_vu1_program.hpp"
namespace Tyra {
@@ -21,7 +21,7 @@
#include "src/renderer/3d/pipeline/shared/vcl_sml.i"
#include "src/renderer/3d/pipeline/shared/tyra_macros.i"
#include "inc/renderer/3d/pipeline/dynamic/programs/dynpip_vu1_shared_defines.h"
#include "inc/renderer/3d/pipeline/dynamic/core/programs/dynpip_vu1_shared_defines.h"
#define RGBA_STORE_OFFSET 0
#define XYZ2_STORE_OFFSET 1
@@ -9,7 +9,7 @@
*/
#include "debug/debug.hpp"
#include "renderer/3d/pipeline/dynamic/programs/dynpip_c_vu1_program.hpp"
#include "renderer/3d/pipeline/dynamic/core/programs/dynpip_c_vu1_program.hpp"
extern u32 DynPipVU1_C_CodeStart __attribute__((section(".vudata")));
extern u32 DynPipVU1_C_CodeEnd __attribute__((section(".vudata")));
@@ -21,7 +21,7 @@
#include "src/renderer/3d/pipeline/shared/vcl_sml.i"
#include "src/renderer/3d/pipeline/shared/tyra_macros.i"
#include "inc/renderer/3d/pipeline/dynamic/programs/dynpip_vu1_shared_defines.h"
#include "inc/renderer/3d/pipeline/dynamic/core/programs/dynpip_vu1_shared_defines.h"
#define RGBA_STORE_OFFSET 0
#define XYZ2_STORE_OFFSET 1
@@ -9,7 +9,7 @@
*/
#include "debug/debug.hpp"
#include "renderer/3d/pipeline/dynamic/programs/dynpip_d_vu1_program.hpp"
#include "renderer/3d/pipeline/dynamic/core/programs/dynpip_d_vu1_program.hpp"
extern u32 DynPipVU1_D_CodeStart __attribute__((section(".vudata")));
extern u32 DynPipVU1_D_CodeEnd __attribute__((section(".vudata")));
@@ -21,7 +21,7 @@
#include "src/renderer/3d/pipeline/shared/vcl_sml.i"
#include "src/renderer/3d/pipeline/shared/tyra_macros.i"
#include "inc/renderer/3d/pipeline/dynamic/programs/dynpip_vu1_shared_defines.h"
#include "inc/renderer/3d/pipeline/dynamic/core/programs/dynpip_vu1_shared_defines.h"
#define STQ_STORE_OFFSET 0
#define RGBA_STORE_OFFSET 1
@@ -9,7 +9,7 @@
*/
#include "debug/debug.hpp"
#include "renderer/3d/pipeline/dynamic/programs/dynpip_tc_vu1_program.hpp"
#include "renderer/3d/pipeline/dynamic/core/programs/dynpip_tc_vu1_program.hpp"
extern u32 DynPipVU1_TC_CodeStart __attribute__((section(".vudata")));
extern u32 DynPipVU1_TC_CodeEnd __attribute__((section(".vudata")));
@@ -21,7 +21,7 @@
#include "src/renderer/3d/pipeline/shared/vcl_sml.i"
#include "src/renderer/3d/pipeline/shared/tyra_macros.i"
#include "inc/renderer/3d/pipeline/dynamic/programs/dynpip_vu1_shared_defines.h"
#include "inc/renderer/3d/pipeline/dynamic/core/programs/dynpip_vu1_shared_defines.h"
#define STQ_STORE_OFFSET 0
#define RGBA_STORE_OFFSET 1
@@ -9,7 +9,7 @@
*/
#include "debug/debug.hpp"
#include "renderer/3d/pipeline/dynamic/programs/dynpip_td_vu1_program.hpp"
#include "renderer/3d/pipeline/dynamic/core/programs/dynpip_td_vu1_program.hpp"
extern u32 DynPipVU1_TD_CodeStart __attribute__((section(".vudata")));
extern u32 DynPipVU1_TD_CodeEnd __attribute__((section(".vudata")));
@@ -8,7 +8,7 @@
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#include "renderer/3d/pipeline/static/core/static_pipeline_core.hpp"
#include "renderer/3d/pipeline/static/core/stapip_core.hpp"
#include "renderer/core/renderer_core.hpp"
#include "thread/threading.hpp"
@@ -22,26 +22,24 @@
namespace Tyra {
StaPipelineCore::StaPipelineCore() { maxVertCount = 0; }
StaPipCore::StaPipCore() { maxVertCount = 0; }
StaPipelineCore::~StaPipelineCore() {}
StaPipCore::~StaPipCore() {}
void StaPipelineCore::init(RendererCore* t_core) {
void StaPipCore::init(RendererCore* t_core) {
rendererCore = t_core;
qbufferRenderer.init(t_core);
packager.init(&rendererCore->renderer3D.frustumPlanes);
}
void StaPipelineCore::reinitStandardVU1Programs() {
qbufferRenderer.reinitVU1();
}
void StaPipCore::reinitStandardVU1Programs() { qbufferRenderer.reinitVU1(); }
u32 StaPipelineCore::getMaxVertCountByBag(const StaPipBag* bag) {
u32 StaPipCore::getMaxVertCountByBag(const StaPipBag* bag) {
return qbufferRenderer.getCullProgramByBag(bag)->getMaxVertCount(
bag->color->many == nullptr, qbufferRenderer.getBufferSize());
}
u32 StaPipelineCore::getMaxVertCountByParams(const bool& isSingleColor,
u32 StaPipCore::getMaxVertCountByParams(const bool& isSingleColor,
const bool& isLightingEnabled,
const bool& isTextureEnabled) {
return qbufferRenderer
@@ -49,7 +47,7 @@ u32 StaPipelineCore::getMaxVertCountByParams(const bool& isSingleColor,
->getMaxVertCount(isSingleColor, qbufferRenderer.getBufferSize());
}
void StaPipelineCore::render(StaPipBag* bag, StaPipBagPackagesBBox* bbox) {
void StaPipCore::render(StaPipBag* bag, StaPipBagPackagesBBox* bbox) {
if (bag->count <= 0) return;
TYRA_ASSERT(bag->vertices != nullptr,
@@ -143,7 +141,7 @@ void StaPipelineCore::render(StaPipBag* bag, StaPipBagPackagesBBox* bbox) {
Verbose("Render finished");
}
void StaPipelineCore::renderPkgs(StaPipBagPackage* packages, u16 count) {
void StaPipCore::renderPkgs(StaPipBagPackage* packages, u16 count) {
for (u16 i = 0; i < count; i++) {
if (packages[i].isInFrustum == IN_FRUSTUM) {
Verbose(i, " - package in frustum -> cull");
@@ -163,7 +161,7 @@ void StaPipelineCore::renderPkgs(StaPipBagPackage* packages, u16 count) {
}
}
void StaPipelineCore::renderSubpkgs(StaPipBagPackage* subpkgs, u16 count) {
void StaPipCore::renderSubpkgs(StaPipBagPackage* subpkgs, u16 count) {
std::vector<u16> doneIndexes;
std::vector<u16> loadedIndexes;
@@ -220,7 +218,7 @@ void StaPipelineCore::renderSubpkgs(StaPipBagPackage* subpkgs, u16 count) {
}
}
void StaPipelineCore::setMaxVertCount(const u32& count) {
void StaPipCore::setMaxVertCount(const u32& count) {
maxVertCount = count;
packager.setMaxVertCount(count);
qbufferRenderer.setMaxVertCount(count);