vu1 packet spamming in static pipeline

This commit is contained in:
h4570
2022-07-24 12:21:21 +02:00
parent cf8ca23ba9
commit 9d18a81c2a
12 changed files with 173 additions and 52 deletions
@@ -27,7 +27,7 @@ class StaPipCore {
void init(RendererCore* t_core);
/** Render 3D via "bags" */
void render(StaPipBag* data, StaPipBagPackagesBBox* bbox = nullptr);
void render(StaPipBag* bag, StaPipBagPackagesBBox* bbox = nullptr);
/** Get max vert count of VU1 qbuffer (for optimizations) */
u32 getMaxVertCountByParams(const bool& isSingleColor,
@@ -54,6 +54,8 @@ class StaPipQBufferRenderer {
/** Slower render with clipping */
void clip(StaPipQBuffer* buffer);
void flushBuffers();
void clearLastProgramName();
StaPipVU1Program* getCullProgramByBag(const StaPipBag* bag);
@@ -64,22 +66,30 @@ class StaPipQBufferRenderer {
const u16& getBufferSize() { return bufferSize; }
private:
bool is1stDBufferFlushTime();
bool is2ndDBufferFlushTime();
void sendStaticData() const;
void setProgramsCache();
void uploadPrograms();
void setDoubleBuffer();
u16 getQBufferIndex(StaPipQBuffer* buffer);
static const u16 buffersCount;
StaPipVU1Program* getProgramByName(const StaPipProgramName& name);
void addBufferDataToPacket(StaPipVU1Program* program, StaPipQBuffer* buffer);
void addBufferDataToPacket(StaPipQBuffer** buffers, const u32& count);
void sendPacket();
StaPipVU1Program* getAsIsProgramByBag(const StaPipBag* bag);
StaPipVU1Program* getCullProgramByType(const StaPipProgramType& programType);
StaPipProgramType getDrawProgramTypeByBag(const StaPipBag* bag) const;
StaPipProgramType getDrawProgramTypeByParams(
const bool& isLightingEnabled, const bool& isTextureEnabled) const;
packet2_t* packets[2];
packet2_t* programsPacket;
StaPipQBuffer buffers[2];
packet2_t** packets;
StaPipVU1Program** programs; // dbuffer
StaPipQBuffer** buffers;
packet2_t* currentPacket;
packet2_t* staticDataPacket;
packet2_t* objectDataPacket;
@@ -91,7 +101,7 @@ class StaPipQBufferRenderer {
StaPipClipper clipper;
StaPipProgramsRepository repository;
u16 bufferSize;
u16 bufferSize, nextBufferIndex, currentBufferIndex;
u8 context;
};
@@ -14,7 +14,7 @@
#include "../renderer_3d_pipeline.hpp"
#include "../shared/pipeline_lighting_options.hpp"
#include "renderer/core/renderer_core.hpp"
#include "renderer/3d/mesh/dynamic/dynamic_mesh.hpp"
#include "renderer/3d/mesh/static/static_mesh.hpp"
#include "./core/stapip_core.hpp"
#include "./stapip_options.hpp"
@@ -43,7 +43,7 @@ class StaticPipeline : public Renderer3DPipeline {
* Render static model
* This render() method is a bridge to core.render() method.
*/
void render(DynamicMesh* mesh, const StaPipOptions* options = nullptr);
void render(StaticMesh* mesh, const StaPipOptions* options = nullptr);
private:
RendererCore* rendererCore;
@@ -51,7 +51,7 @@ class StaticPipeline : public Renderer3DPipeline {
void addVertices(MeshMaterialFrame* materialFrame, StaPipBag* bag) const;
PipelineInfoBag* getInfoBag(DynamicMesh* mesh, const StaPipOptions* options,
PipelineInfoBag* getInfoBag(StaticMesh* mesh, const StaPipOptions* options,
M4x4* model) const;
StaPipColorBag* getColorBag(MeshMaterial* material,
@@ -14,7 +14,7 @@
#include <draw_buffers.h>
#include <vector>
#include "./models/texture.hpp"
#include "renderer/3d/mesh/dynamic/dynamic_mesh.hpp"
#include "renderer/3d/mesh/mesh.hpp"
#include "loaders/texture/base/texture_loader_selector.hpp"
#include <string>
@@ -81,13 +81,12 @@ class TextureRepository {
/**
* Add linked textures in given path for mesh material names.
*/
void addByMesh(DynamicMesh* mesh, const char* directory,
const char* extension);
void addByMesh(Mesh* mesh, const char* directory, const char* extension);
/**
* Add linked textures in given path for mesh material names.
*/
inline void addByMesh(DynamicMesh* mesh, const std::string& directory,
inline void addByMesh(Mesh* mesh, const std::string& directory,
const char* extension) {
addByMesh(mesh, directory.c_str(), extension);
}