stapip patch
This commit is contained in:
@@ -42,6 +42,8 @@ class StaPipBagPackagesBBox {
|
|||||||
/** @brief Get amount of vertices */
|
/** @brief Get amount of vertices */
|
||||||
const u32& getVertexCount() const;
|
const u32& getVertexCount() const;
|
||||||
|
|
||||||
|
const std::vector<CoreBBox>& getParts() const { return *bboxParts; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief For example if we want to build a bbox from 96-112 vertices, we
|
* @brief For example if we want to build a bbox from 96-112 vertices, we
|
||||||
* should input index = 3, partsSize = 1
|
* should input index = 3, partsSize = 1
|
||||||
|
|||||||
@@ -97,7 +97,6 @@ class StaPipQBufferRenderer {
|
|||||||
packet2_t** packets;
|
packet2_t** packets;
|
||||||
StaPipVU1Program** dBufferPrograms;
|
StaPipVU1Program** dBufferPrograms;
|
||||||
StaPipQBuffer** buffers;
|
StaPipQBuffer** buffers;
|
||||||
packet2_t* currentPacket;
|
|
||||||
packet2_t* staticDataPacket;
|
packet2_t* staticDataPacket;
|
||||||
packet2_t* objectDataPacket;
|
packet2_t* objectDataPacket;
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ class CoreBBox {
|
|||||||
const u32& startIndex, const u32& stopIndex);
|
const u32& startIndex, const u32& stopIndex);
|
||||||
|
|
||||||
const Vec4& operator[](const u8& i) { return _vertices[i]; }
|
const Vec4& operator[](const u8& i) { return _vertices[i]; }
|
||||||
|
const u8 getVertexCount() { return 8; }
|
||||||
const Vec4& getVertex(const u8& i) { return _vertices[i]; }
|
const Vec4& getVertex(const u8& i) { return _vertices[i]; }
|
||||||
Vec4* getVertices() { return _vertices; }
|
Vec4* getVertices() { return _vertices; }
|
||||||
|
|
||||||
|
|||||||
@@ -1381,8 +1381,6 @@ QSL3@:
|
|||||||
;//---------------------------------------------------------
|
;//---------------------------------------------------------
|
||||||
;// PerformClipCheck - checks if the vertex is outside the viewing frustum.
|
;// PerformClipCheck - checks if the vertex is outside the viewing frustum.
|
||||||
;// If it is, then the appropriate clipping flags are set.
|
;// If it is, then the appropriate clipping flags are set.
|
||||||
;// Not using sqi instruction, because VCL cannot optimize it.
|
|
||||||
;// Primtag contains information about how many polys we will send
|
|
||||||
;// 2 - Bitwise AND the clipping flags with 0x3FFFF, this makes sure that
|
;// 2 - Bitwise AND the clipping flags with 0x3FFFF, this makes sure that
|
||||||
;// we get the clipping judgement for the last three verts
|
;// we get the clipping judgement for the last three verts
|
||||||
;// (i.e. that make up the triangle we are about to draw)
|
;// (i.e. that make up the triangle we are about to draw)
|
||||||
|
|||||||
@@ -106,10 +106,9 @@ CoreBBoxFrustum StaPipBagPackager::checkFrustum(const StaPipBagPackage& pkg) {
|
|||||||
auto& bbox = renderBBox->getChildBBox1By3(pkg.indexOf1By3BBox);
|
auto& bbox = renderBBox->getChildBBox1By3(pkg.indexOf1By3BBox);
|
||||||
return bbox.clipIsInFrustum(frustumPlanes->getAll(), *pkg.bag->info->model);
|
return bbox.clipIsInFrustum(frustumPlanes->getAll(), *pkg.bag->info->model);
|
||||||
} else { // Is package
|
} else { // Is package
|
||||||
auto bbox = renderBBox->createChildBBox(
|
const auto& indexOfPart = pkg.indexOf1By3BBox;
|
||||||
pkg.indexOf1By3BBox,
|
auto partSize = ceil(pkg.size / static_cast<float>(maxVertCount / 3));
|
||||||
ceil(pkg.size / static_cast<float>(maxVertCount / 3)));
|
auto bbox = renderBBox->createChildBBox(indexOfPart, partSize);
|
||||||
|
|
||||||
return bbox.clipIsInFrustum(frustumPlanes->getAll(), *pkg.bag->info->model);
|
return bbox.clipIsInFrustum(frustumPlanes->getAll(), *pkg.bag->info->model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -72,7 +72,7 @@ const u32& StaPipBagPackagesBBox::getVertexCount() const { return vertexCount; }
|
|||||||
|
|
||||||
RenderBBox StaPipBagPackagesBBox::createChildBBox(const u32& index,
|
RenderBBox StaPipBagPackagesBBox::createChildBBox(const u32& index,
|
||||||
const u16& partsSize) const {
|
const u16& partsSize) const {
|
||||||
return RenderBBox(*bboxParts, index, partsSize);
|
return RenderBBox(*bboxParts, index, index + partsSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StaPipBagPackagesBBox::print() const {
|
void StaPipBagPackagesBBox::print() const {
|
||||||
|
|||||||
@@ -90,6 +90,11 @@ processing:
|
|||||||
ScaleVertexToGSFormat{ scale, vertex3 }
|
ScaleVertexToGSFormat{ scale, vertex3 }
|
||||||
FixColor{ color3 }
|
FixColor{ color3 }
|
||||||
|
|
||||||
|
iaddiu adcBit, VI00, 0x0
|
||||||
|
isw.w adcBit, XYZ2_STORE_OFFSET(destAddress)
|
||||||
|
isw.w adcBit, XYZ2_STORE_OFFSET+2(destAddress)
|
||||||
|
isw.w adcBit, XYZ2_STORE_OFFSET+4(destAddress)
|
||||||
|
|
||||||
;--- Store vertex1
|
;--- Store vertex1
|
||||||
sq color1, RGBA_STORE_OFFSET(destAddress)
|
sq color1, RGBA_STORE_OFFSET(destAddress)
|
||||||
sq.xyz vertex1, XYZ2_STORE_OFFSET(destAddress)
|
sq.xyz vertex1, XYZ2_STORE_OFFSET(destAddress)
|
||||||
|
|||||||
@@ -76,6 +76,11 @@ vertexLoop:
|
|||||||
CalculateTyraDirectionalLights{ outputColor3, normal3, lightDirections, lightColors, lightMatrix, ambientColor }
|
CalculateTyraDirectionalLights{ outputColor3, normal3, lightDirections, lightColors, lightMatrix, ambientColor }
|
||||||
FixColor{ outputColor3 }
|
FixColor{ outputColor3 }
|
||||||
|
|
||||||
|
iaddiu adcBit, VI00, 0x0
|
||||||
|
isw.w adcBit, XYZ2_STORE_OFFSET(destAddress)
|
||||||
|
isw.w adcBit, XYZ2_STORE_OFFSET+2(destAddress)
|
||||||
|
isw.w adcBit, XYZ2_STORE_OFFSET+4(destAddress)
|
||||||
|
|
||||||
;--- Store vertex1
|
;--- Store vertex1
|
||||||
sq outputColor1, RGBA_STORE_OFFSET(destAddress)
|
sq outputColor1, RGBA_STORE_OFFSET(destAddress)
|
||||||
sq.xyz vertex1, XYZ2_STORE_OFFSET(destAddress)
|
sq.xyz vertex1, XYZ2_STORE_OFFSET(destAddress)
|
||||||
|
|||||||
@@ -101,6 +101,11 @@ processing:
|
|||||||
PerformTexturePerspectiveCorrection{ outputStq3, stq3 }
|
PerformTexturePerspectiveCorrection{ outputStq3, stq3 }
|
||||||
FixColor{ color3 }
|
FixColor{ color3 }
|
||||||
|
|
||||||
|
iaddiu adcBit, VI00, 0x0
|
||||||
|
isw.w adcBit, XYZ2_STORE_OFFSET(destAddress)
|
||||||
|
isw.w adcBit, XYZ2_STORE_OFFSET+3(destAddress)
|
||||||
|
isw.w adcBit, XYZ2_STORE_OFFSET+6(destAddress)
|
||||||
|
|
||||||
;--- Store vertex1
|
;--- Store vertex1
|
||||||
sq outputStq1, STQ_STORE_OFFSET(destAddress)
|
sq outputStq1, STQ_STORE_OFFSET(destAddress)
|
||||||
sq color1, RGBA_STORE_OFFSET(destAddress)
|
sq color1, RGBA_STORE_OFFSET(destAddress)
|
||||||
|
|||||||
@@ -87,6 +87,11 @@ vertexLoop:
|
|||||||
CalculateTyraDirectionalLights{ outputColor3, normal3, lightDirections, lightColors, lightMatrix, ambientColor }
|
CalculateTyraDirectionalLights{ outputColor3, normal3, lightDirections, lightColors, lightMatrix, ambientColor }
|
||||||
FixColor{ outputColor3 }
|
FixColor{ outputColor3 }
|
||||||
|
|
||||||
|
iaddiu adcBit, VI00, 0x0
|
||||||
|
isw.w adcBit, XYZ2_STORE_OFFSET(destAddress)
|
||||||
|
isw.w adcBit, XYZ2_STORE_OFFSET+3(destAddress)
|
||||||
|
isw.w adcBit, XYZ2_STORE_OFFSET+6(destAddress)
|
||||||
|
|
||||||
;--- Store vertex1
|
;--- Store vertex1
|
||||||
sq outputStq1, STQ_STORE_OFFSET(destAddress)
|
sq outputStq1, STQ_STORE_OFFSET(destAddress)
|
||||||
sq outputColor1, RGBA_STORE_OFFSET(destAddress)
|
sq outputColor1, RGBA_STORE_OFFSET(destAddress)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include "renderer/3d/pipeline/static/core/stapip_qbuffer_renderer.hpp"
|
#include "renderer/3d/pipeline/static/core/stapip_qbuffer_renderer.hpp"
|
||||||
#include "renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
|
#include "renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
|
||||||
|
|
||||||
#define TYRA_QBUFF_RENDERER_VERBOSE_LOG 1
|
// #define TYRA_QBUFF_RENDERER_VERBOSE_LOG 1
|
||||||
|
|
||||||
#ifdef TYRA_QBUFF_RENDERER_VERBOSE_LOG
|
#ifdef TYRA_QBUFF_RENDERER_VERBOSE_LOG
|
||||||
#define Verbose(...) Debug::writeLines("VRB: ", ##__VA_ARGS__, "\n")
|
#define Verbose(...) Debug::writeLines("VRB: ", ##__VA_ARGS__, "\n")
|
||||||
@@ -272,11 +272,11 @@ void StaPipQBufferRenderer::cull(StaPipQBuffer* buffer) {
|
|||||||
|
|
||||||
dBufferPrograms[getQBufferIndex(buffer)] = getCullProgramByBag(buffer->bag);
|
dBufferPrograms[getQBufferIndex(buffer)] = getCullProgramByBag(buffer->bag);
|
||||||
|
|
||||||
|
Verbose("Add cull[", getQBufferIndex(buffer), "]: ", buffer->size);
|
||||||
|
|
||||||
auto is1stDBuffer = is1stDBufferFlushTime();
|
auto is1stDBuffer = is1stDBufferFlushTime();
|
||||||
auto is2ndDBuffer = is2ndDBufferFlushTime();
|
auto is2ndDBuffer = is2ndDBufferFlushTime();
|
||||||
|
|
||||||
Verbose("Add cull[", getQBufferIndex(buffer), "]: ", buffer->size);
|
|
||||||
|
|
||||||
if (is1stDBuffer || is2ndDBuffer) {
|
if (is1stDBuffer || is2ndDBuffer) {
|
||||||
auto from = is1stDBuffer ? 0 : buffersCount / 2;
|
auto from = is1stDBuffer ? 0 : buffersCount / 2;
|
||||||
auto to = from + buffersCount / 2;
|
auto to = from + buffersCount / 2;
|
||||||
@@ -321,7 +321,7 @@ void StaPipQBufferRenderer::clearLastProgramName() {
|
|||||||
|
|
||||||
void StaPipQBufferRenderer::addBuffersDataToPacket(const u32& from,
|
void StaPipQBufferRenderer::addBuffersDataToPacket(const u32& from,
|
||||||
const u32& to) {
|
const u32& to) {
|
||||||
currentPacket = packets[context];
|
auto* currentPacket = packets[context];
|
||||||
packet2_reset(currentPacket, false);
|
packet2_reset(currentPacket, false);
|
||||||
|
|
||||||
for (u32 i = from; i < to; i++) {
|
for (u32 i = from; i < to; i++) {
|
||||||
@@ -346,6 +346,7 @@ void StaPipQBufferRenderer::addBuffersDataToPacket(const u32& from,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void StaPipQBufferRenderer::sendPacket() {
|
void StaPipQBufferRenderer::sendPacket() {
|
||||||
|
auto* currentPacket = packets[context];
|
||||||
dma_channel_wait(DMA_CHANNEL_VIF1, 0);
|
dma_channel_wait(DMA_CHANNEL_VIF1, 0);
|
||||||
dma_channel_send_packet2(currentPacket, DMA_CHANNEL_VIF1, true);
|
dma_channel_send_packet2(currentPacket, DMA_CHANNEL_VIF1, true);
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ CoreBBoxFrustum RenderBBox::clipIsInFrustum(const Plane* frustumPlanes,
|
|||||||
|
|
||||||
// Oh no, it probably needs clipping
|
// Oh no, it probably needs clipping
|
||||||
|
|
||||||
|
// This is crappy guard band, but it works xd
|
||||||
float guardBand[6]; // This probably needs more calibration
|
float guardBand[6]; // This probably needs more calibration
|
||||||
|
|
||||||
guardBand[0] = -15.0F; // Top
|
guardBand[0] = -15.0F; // Top
|
||||||
|
|||||||
Reference in New Issue
Block a user