dynpip rearrangment
This commit is contained in:
@@ -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 <tamtypes.h>
|
||||||
#include "../renderer_3d_pipeline.hpp"
|
#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/core/renderer_core.hpp"
|
||||||
#include "renderer/3d/mesh/dynamic/dynamic_mesh.hpp"
|
#include "renderer/3d/mesh/dynamic/dynamic_mesh.hpp"
|
||||||
|
|
||||||
@@ -23,10 +24,16 @@ class DynamicPipeline : public Renderer3DPipeline {
|
|||||||
DynamicPipeline();
|
DynamicPipeline();
|
||||||
~DynamicPipeline();
|
~DynamicPipeline();
|
||||||
|
|
||||||
|
DynPipCore core;
|
||||||
|
|
||||||
void init(RendererCore* core);
|
void init(RendererCore* core);
|
||||||
|
|
||||||
void onUse();
|
void onUse();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render 3D via "meshes".
|
||||||
|
* This render() method is a bridge to core.render() method.
|
||||||
|
*/
|
||||||
void render(DynamicMesh* mesh, const DynPipOptions* options = nullptr);
|
void render(DynamicMesh* mesh, const DynPipOptions* options = nullptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -19,14 +19,14 @@
|
|||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
|
|
||||||
class StaPipelineCore {
|
class StaPipCore {
|
||||||
public:
|
public:
|
||||||
StaPipelineCore();
|
StaPipCore();
|
||||||
~StaPipelineCore();
|
~StaPipCore();
|
||||||
|
|
||||||
void init(RendererCore* t_core);
|
void init(RendererCore* t_core);
|
||||||
|
|
||||||
/** Render 3D data via "bags" */
|
/** Render 3D via "bags" */
|
||||||
void render(StaPipBag* data, StaPipBagPackagesBBox* bbox = nullptr);
|
void render(StaPipBag* data, StaPipBagPackagesBBox* bbox = nullptr);
|
||||||
|
|
||||||
/** Get max vert count of VU1 qbuffer (for optimizations) */
|
/** Get max vert count of VU1 qbuffer (for optimizations) */
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
#include "./stapip_options.hpp"
|
#include "./stapip_options.hpp"
|
||||||
#include "renderer/core/renderer_core.hpp"
|
#include "renderer/core/renderer_core.hpp"
|
||||||
#include "renderer/3d/mesh/dynamic/dynamic_mesh.hpp"
|
#include "renderer/3d/mesh/dynamic/dynamic_mesh.hpp"
|
||||||
#include "./core/static_pipeline_core.hpp"
|
#include "./core/stapip_core.hpp"
|
||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
|
|
||||||
@@ -24,6 +24,8 @@ class StaticPipeline : public Renderer3DPipeline {
|
|||||||
StaticPipeline();
|
StaticPipeline();
|
||||||
~StaticPipeline();
|
~StaticPipeline();
|
||||||
|
|
||||||
|
StaPipCore core;
|
||||||
|
|
||||||
void init(RendererCore* core);
|
void init(RendererCore* core);
|
||||||
|
|
||||||
void onUse();
|
void onUse();
|
||||||
@@ -35,7 +37,6 @@ class StaticPipeline : public Renderer3DPipeline {
|
|||||||
void render(DynamicMesh* mesh, const StaPipOptions* options = nullptr);
|
void render(DynamicMesh* mesh, const StaPipOptions* options = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
StaPipelineCore core;
|
|
||||||
RendererCore* rendererCore;
|
RendererCore* rendererCore;
|
||||||
Vec4* colorsCache;
|
Vec4* colorsCache;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
# 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 <sstream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
# 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 {
|
namespace Tyra {
|
||||||
|
|
||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
# 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 {
|
namespace Tyra {
|
||||||
|
|
||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
# 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 {
|
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
|
||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
# 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 {
|
namespace Tyra {
|
||||||
|
|
||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
# 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 <sstream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
# 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 {
|
namespace Tyra {
|
||||||
|
|
||||||
+1
-1
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "src/renderer/3d/pipeline/shared/vcl_sml.i"
|
#include "src/renderer/3d/pipeline/shared/vcl_sml.i"
|
||||||
#include "src/renderer/3d/pipeline/shared/tyra_macros.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 RGBA_STORE_OFFSET 0
|
||||||
#define XYZ2_STORE_OFFSET 1
|
#define XYZ2_STORE_OFFSET 1
|
||||||
+1
-1
@@ -9,7 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "debug/debug.hpp"
|
#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_CodeStart __attribute__((section(".vudata")));
|
||||||
extern u32 DynPipVU1_C_CodeEnd __attribute__((section(".vudata")));
|
extern u32 DynPipVU1_C_CodeEnd __attribute__((section(".vudata")));
|
||||||
+1
-1
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "src/renderer/3d/pipeline/shared/vcl_sml.i"
|
#include "src/renderer/3d/pipeline/shared/vcl_sml.i"
|
||||||
#include "src/renderer/3d/pipeline/shared/tyra_macros.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 RGBA_STORE_OFFSET 0
|
||||||
#define XYZ2_STORE_OFFSET 1
|
#define XYZ2_STORE_OFFSET 1
|
||||||
+1
-1
@@ -9,7 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "debug/debug.hpp"
|
#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_CodeStart __attribute__((section(".vudata")));
|
||||||
extern u32 DynPipVU1_D_CodeEnd __attribute__((section(".vudata")));
|
extern u32 DynPipVU1_D_CodeEnd __attribute__((section(".vudata")));
|
||||||
+1
-1
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "src/renderer/3d/pipeline/shared/vcl_sml.i"
|
#include "src/renderer/3d/pipeline/shared/vcl_sml.i"
|
||||||
#include "src/renderer/3d/pipeline/shared/tyra_macros.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 STQ_STORE_OFFSET 0
|
||||||
#define RGBA_STORE_OFFSET 1
|
#define RGBA_STORE_OFFSET 1
|
||||||
+1
-1
@@ -9,7 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "debug/debug.hpp"
|
#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_CodeStart __attribute__((section(".vudata")));
|
||||||
extern u32 DynPipVU1_TC_CodeEnd __attribute__((section(".vudata")));
|
extern u32 DynPipVU1_TC_CodeEnd __attribute__((section(".vudata")));
|
||||||
+1
-1
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "src/renderer/3d/pipeline/shared/vcl_sml.i"
|
#include "src/renderer/3d/pipeline/shared/vcl_sml.i"
|
||||||
#include "src/renderer/3d/pipeline/shared/tyra_macros.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 STQ_STORE_OFFSET 0
|
||||||
#define RGBA_STORE_OFFSET 1
|
#define RGBA_STORE_OFFSET 1
|
||||||
+1
-1
@@ -9,7 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "debug/debug.hpp"
|
#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_CodeStart __attribute__((section(".vudata")));
|
||||||
extern u32 DynPipVU1_TD_CodeEnd __attribute__((section(".vudata")));
|
extern u32 DynPipVU1_TD_CodeEnd __attribute__((section(".vudata")));
|
||||||
+13
-15
@@ -8,7 +8,7 @@
|
|||||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
# 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 "renderer/core/renderer_core.hpp"
|
||||||
#include "thread/threading.hpp"
|
#include "thread/threading.hpp"
|
||||||
|
|
||||||
@@ -22,34 +22,32 @@
|
|||||||
|
|
||||||
namespace Tyra {
|
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;
|
rendererCore = t_core;
|
||||||
qbufferRenderer.init(t_core);
|
qbufferRenderer.init(t_core);
|
||||||
packager.init(&rendererCore->renderer3D.frustumPlanes);
|
packager.init(&rendererCore->renderer3D.frustumPlanes);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StaPipelineCore::reinitStandardVU1Programs() {
|
void StaPipCore::reinitStandardVU1Programs() { qbufferRenderer.reinitVU1(); }
|
||||||
qbufferRenderer.reinitVU1();
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 StaPipelineCore::getMaxVertCountByBag(const StaPipBag* bag) {
|
u32 StaPipCore::getMaxVertCountByBag(const StaPipBag* bag) {
|
||||||
return qbufferRenderer.getCullProgramByBag(bag)->getMaxVertCount(
|
return qbufferRenderer.getCullProgramByBag(bag)->getMaxVertCount(
|
||||||
bag->color->many == nullptr, qbufferRenderer.getBufferSize());
|
bag->color->many == nullptr, qbufferRenderer.getBufferSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 StaPipelineCore::getMaxVertCountByParams(const bool& isSingleColor,
|
u32 StaPipCore::getMaxVertCountByParams(const bool& isSingleColor,
|
||||||
const bool& isLightingEnabled,
|
const bool& isLightingEnabled,
|
||||||
const bool& isTextureEnabled) {
|
const bool& isTextureEnabled) {
|
||||||
return qbufferRenderer
|
return qbufferRenderer
|
||||||
.getCullProgramByParams(isLightingEnabled, isTextureEnabled)
|
.getCullProgramByParams(isLightingEnabled, isTextureEnabled)
|
||||||
->getMaxVertCount(isSingleColor, qbufferRenderer.getBufferSize());
|
->getMaxVertCount(isSingleColor, qbufferRenderer.getBufferSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
void StaPipelineCore::render(StaPipBag* bag, StaPipBagPackagesBBox* bbox) {
|
void StaPipCore::render(StaPipBag* bag, StaPipBagPackagesBBox* bbox) {
|
||||||
if (bag->count <= 0) return;
|
if (bag->count <= 0) return;
|
||||||
|
|
||||||
TYRA_ASSERT(bag->vertices != nullptr,
|
TYRA_ASSERT(bag->vertices != nullptr,
|
||||||
@@ -143,7 +141,7 @@ void StaPipelineCore::render(StaPipBag* bag, StaPipBagPackagesBBox* bbox) {
|
|||||||
Verbose("Render finished");
|
Verbose("Render finished");
|
||||||
}
|
}
|
||||||
|
|
||||||
void StaPipelineCore::renderPkgs(StaPipBagPackage* packages, u16 count) {
|
void StaPipCore::renderPkgs(StaPipBagPackage* packages, u16 count) {
|
||||||
for (u16 i = 0; i < count; i++) {
|
for (u16 i = 0; i < count; i++) {
|
||||||
if (packages[i].isInFrustum == IN_FRUSTUM) {
|
if (packages[i].isInFrustum == IN_FRUSTUM) {
|
||||||
Verbose(i, " - package in frustum -> cull");
|
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> doneIndexes;
|
||||||
std::vector<u16> loadedIndexes;
|
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;
|
maxVertCount = count;
|
||||||
packager.setMaxVertCount(count);
|
packager.setMaxVertCount(count);
|
||||||
qbufferRenderer.setMaxVertCount(count);
|
qbufferRenderer.setMaxVertCount(count);
|
||||||
Reference in New Issue
Block a user