z test patch
This commit is contained in:
@@ -28,6 +28,7 @@
|
|||||||
"defines": [
|
"defines": [
|
||||||
"_EE",
|
"_EE",
|
||||||
"_IOP",
|
"_IOP",
|
||||||
|
"__SPU__",
|
||||||
"INTELLISENSE"
|
"INTELLISENSE"
|
||||||
],
|
],
|
||||||
"cppStandard": "c++20",
|
"cppStandard": "c++20",
|
||||||
|
|||||||
@@ -83,6 +83,11 @@
|
|||||||
"type": "shell",
|
"type": "shell",
|
||||||
"label": "Stop docker container",
|
"label": "Stop docker container",
|
||||||
"command": "docker compose down"
|
"command": "docker compose down"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"label": "[Debug] Copy obj directory to host",
|
||||||
|
"command": "docker exec -t tyra-compiler sh -c 'rsync -zac --include=\"*/\" --include=\"obj/**\" --exclude=\"*\" /src/ /host/'"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"inputs": [
|
"inputs": [
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ void Skybox::allocateOptions() {
|
|||||||
options = new StaPipOptions();
|
options = new StaPipOptions();
|
||||||
options->frustumCulling = Tyra::PipelineFrustumCulling_None;
|
options->frustumCulling = Tyra::PipelineFrustumCulling_None;
|
||||||
options->shadingType = Tyra::TyraShadingGouraud;
|
options->shadingType = Tyra::TyraShadingGouraud;
|
||||||
options->zTestType = Tyra::StaPipZTest_AllPass;
|
options->zTestType = Tyra::PipelineZTest_AllPass;
|
||||||
options->textureMappingType = Tyra::TyraNearest;
|
options->textureMappingType = Tyra::TyraNearest;
|
||||||
options->blendingEnabled = true;
|
options->blendingEnabled = true;
|
||||||
options->antiAliasingEnabled = false;
|
options->antiAliasingEnabled = false;
|
||||||
|
|||||||
@@ -23,24 +23,22 @@ Terrain::Terrain(TextureRepository* repo)
|
|||||||
Vec4(-750.0F, 0.0F, -1400.0F, 1.0F), // Left up
|
Vec4(-750.0F, 0.0F, -1400.0F, 1.0F), // Left up
|
||||||
Vec4(920.0F, 0.0F, 1520.0F, 1.0F) // Right down
|
Vec4(920.0F, 0.0F, 1520.0F, 1.0F) // Right down
|
||||||
) {
|
) {
|
||||||
ObjLoader loader;
|
// ObjLoader loader;
|
||||||
|
|
||||||
ObjLoaderOptions objOptions;
|
// ObjLoaderOptions objOptions;
|
||||||
objOptions.flipUVs = true;
|
// objOptions.flipUVs = true;
|
||||||
objOptions.scale = 100.0F;
|
// objOptions.scale = 100.0F;
|
||||||
|
|
||||||
auto* data = loader.load(
|
// auto* data = loader.load(
|
||||||
FileUtils::fromCwd("game/models/terrain/terrain.obj"), objOptions);
|
// FileUtils::fromCwd("game/models/terrain/terrain.obj"), objOptions);
|
||||||
data->normalsEnabled = false;
|
// data->normalsEnabled = false;
|
||||||
mesh = new StaticMesh(*data);
|
// mesh = new StaticMesh(*data);
|
||||||
|
// delete data;
|
||||||
|
// repo->addByMesh(mesh, FileUtils::fromCwd("game/models/terrain/"), "png");
|
||||||
|
|
||||||
delete data;
|
// allocateOptions();
|
||||||
|
|
||||||
repo->addByMesh(mesh, FileUtils::fromCwd("game/models/terrain/"), "png");
|
// pair = new RendererStaticPair{mesh, options};
|
||||||
|
|
||||||
allocateOptions();
|
|
||||||
|
|
||||||
pair = new RendererStaticPair{mesh, options};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float Terrain::getHeightOffset(const Vec4& playerPosition) {
|
float Terrain::getHeightOffset(const Vec4& playerPosition) {
|
||||||
|
|||||||
@@ -14,11 +14,12 @@
|
|||||||
#define VU1_SINGLE_COLOR_ADDR 7
|
#define VU1_SINGLE_COLOR_ADDR 7
|
||||||
#define VU1_OPTIONS_ADDR 8
|
#define VU1_OPTIONS_ADDR 8
|
||||||
#define VU1_LOD_ADDR 9
|
#define VU1_LOD_ADDR 9
|
||||||
#define VU1_CLUT_ADDR 10
|
#define VU1_Z_TESTS_ADDR 10
|
||||||
#define VU1_LIGHTS_DIRS_ADDR 11
|
#define VU1_CLUT_ADDR 11
|
||||||
#define VU1_LIGHTS_COLORS_ADDR 14
|
#define VU1_LIGHTS_DIRS_ADDR 12
|
||||||
#define VU1_SET_GIFTAG_ADDR 18
|
#define VU1_LIGHTS_COLORS_ADDR 15
|
||||||
#define VU1_LAST_ITEM_ADDR 18
|
#define VU1_SET_GIFTAG_ADDR 19
|
||||||
|
#define VU1_DYNPIP_LAST_ITEM_ADDR 19
|
||||||
|
|
||||||
// Buffer data (xtop)
|
// Buffer data (xtop)
|
||||||
#define VU1_VERT_DATA_ADDR 2
|
#define VU1_DYNPIP_VERT_DATA_ADDR 2
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "../pipeline_shading_type.hpp"
|
#include "../pipeline_shading_type.hpp"
|
||||||
#include "../pipeline_texture_mapping_type.hpp"
|
#include "../pipeline_texture_mapping_type.hpp"
|
||||||
#include "../pipeline_transformation_type.hpp"
|
#include "../pipeline_transformation_type.hpp"
|
||||||
|
#include "../pipeline_z_test.hpp"
|
||||||
#include "./pipeline_info_bag_frustum_culling.hpp"
|
#include "./pipeline_info_bag_frustum_culling.hpp"
|
||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
@@ -30,6 +31,7 @@ class PipelineInfoBag {
|
|||||||
antiAliasingEnabled = false;
|
antiAliasingEnabled = false;
|
||||||
model = nullptr;
|
model = nullptr;
|
||||||
frustumCulling = PipelineInfoBagFrustumCulling_None;
|
frustumCulling = PipelineInfoBagFrustumCulling_None;
|
||||||
|
zTestType = PipelineZTest_Standard;
|
||||||
}
|
}
|
||||||
~PipelineInfoBag() {}
|
~PipelineInfoBag() {}
|
||||||
|
|
||||||
@@ -51,6 +53,9 @@ class PipelineInfoBag {
|
|||||||
/** Anti-aliasing */
|
/** Anti-aliasing */
|
||||||
bool antiAliasingEnabled;
|
bool antiAliasingEnabled;
|
||||||
|
|
||||||
|
/** Type of z buffer testing. */
|
||||||
|
PipelineZTest zTestType;
|
||||||
|
|
||||||
/** Type of frustum culling */
|
/** Type of frustum culling */
|
||||||
PipelineInfoBagFrustumCulling frustumCulling;
|
PipelineInfoBagFrustumCulling frustumCulling;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include "../shared/pipeline_lighting_options.hpp"
|
#include "../shared/pipeline_lighting_options.hpp"
|
||||||
#include "../shared/pipeline_texture_mapping_type.hpp"
|
#include "../shared/pipeline_texture_mapping_type.hpp"
|
||||||
#include "../shared/pipeline_transformation_type.hpp"
|
#include "../shared/pipeline_transformation_type.hpp"
|
||||||
|
#include "../shared/pipeline_z_test.hpp"
|
||||||
#include "./pipeline_frustum_culling.hpp"
|
#include "./pipeline_frustum_culling.hpp"
|
||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
@@ -27,6 +28,7 @@ class PipelineOptions {
|
|||||||
shadingType = TyraShadingFlat;
|
shadingType = TyraShadingFlat;
|
||||||
textureMappingType = TyraLinear;
|
textureMappingType = TyraLinear;
|
||||||
transformationType = TyraMVP;
|
transformationType = TyraMVP;
|
||||||
|
zTestType = PipelineZTest_Standard;
|
||||||
}
|
}
|
||||||
~PipelineOptions() {}
|
~PipelineOptions() {}
|
||||||
|
|
||||||
@@ -45,6 +47,9 @@ class PipelineOptions {
|
|||||||
/** Anti-aliasing */
|
/** Anti-aliasing */
|
||||||
bool antiAliasingEnabled;
|
bool antiAliasingEnabled;
|
||||||
|
|
||||||
|
/** Type of z-buffer testing. */
|
||||||
|
PipelineZTest zTestType;
|
||||||
|
|
||||||
/** Multiply by model matrix by view-projection or projection matrix */
|
/** Multiply by model matrix by view-projection or projection matrix */
|
||||||
PipelineTransformationType transformationType;
|
PipelineTransformationType transformationType;
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -12,9 +12,9 @@
|
|||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
|
|
||||||
enum StaPipZTest {
|
enum PipelineZTest {
|
||||||
StaPipZTest_Standard = 0,
|
PipelineZTest_Standard = 0,
|
||||||
StaPipZTest_AllPass = 1,
|
PipelineZTest_AllPass = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Tyra
|
} // namespace Tyra
|
||||||
@@ -11,16 +11,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "renderer/3d/pipeline/shared/bag/pipeline_info_bag.hpp"
|
#include "renderer/3d/pipeline/shared/bag/pipeline_info_bag.hpp"
|
||||||
#include "renderer/3d/pipeline/static/stapip_ztest.hpp"
|
|
||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
|
|
||||||
class StaPipInfoBag : public PipelineInfoBag {
|
class StaPipInfoBag : public PipelineInfoBag {
|
||||||
public:
|
public:
|
||||||
StaPipInfoBag() {
|
StaPipInfoBag() { fullClipChecks = false; }
|
||||||
fullClipChecks = false;
|
|
||||||
zTestType = StaPipZTest_Standard;
|
|
||||||
}
|
|
||||||
~StaPipInfoBag() {}
|
~StaPipInfoBag() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,9 +29,6 @@ class StaPipInfoBag : public PipelineInfoBag {
|
|||||||
* Force enabled in dynamic pipe, because of efficiency.
|
* Force enabled in dynamic pipe, because of efficiency.
|
||||||
*/
|
*/
|
||||||
bool fullClipChecks;
|
bool fullClipChecks;
|
||||||
|
|
||||||
/** @brief Type of z buffer testing. */
|
|
||||||
StaPipZTest zTestType;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Tyra
|
} // namespace Tyra
|
||||||
|
|||||||
@@ -14,11 +14,12 @@
|
|||||||
#define VU1_SINGLE_COLOR_ADDR 7
|
#define VU1_SINGLE_COLOR_ADDR 7
|
||||||
#define VU1_OPTIONS_ADDR 8
|
#define VU1_OPTIONS_ADDR 8
|
||||||
#define VU1_LOD_ADDR 9
|
#define VU1_LOD_ADDR 9
|
||||||
#define VU1_CLUT_ADDR 10
|
#define VU1_Z_TESTS_ADDR 10
|
||||||
#define VU1_LIGHTS_DIRS_ADDR 11
|
#define VU1_CLUT_ADDR 11
|
||||||
#define VU1_LIGHTS_COLORS_ADDR 14
|
#define VU1_LIGHTS_DIRS_ADDR 12
|
||||||
#define VU1_SET_GIFTAG_ADDR 18
|
#define VU1_LIGHTS_COLORS_ADDR 15
|
||||||
#define VU1_LAST_ITEM_ADDR 18
|
#define VU1_SET_GIFTAG_ADDR 19
|
||||||
|
#define VU1_STAPIP_LAST_ITEM_ADDR 19
|
||||||
|
|
||||||
// Buffer data (xtop)
|
// Buffer data (xtop)
|
||||||
#define VU1_VERT_DATA_ADDR 2
|
#define VU1_STAPIP_VERT_DATA_ADDR 2
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
#include "./bag/packaging/stapip_bag_package.hpp"
|
#include "./bag/packaging/stapip_bag_package.hpp"
|
||||||
#include "./bag/packaging/stapip_bag_packager.hpp"
|
#include "./bag/packaging/stapip_bag_packager.hpp"
|
||||||
#include "./stapip_qbuffer_renderer.hpp"
|
#include "./stapip_qbuffer_renderer.hpp"
|
||||||
#include "../stapip_ztest.hpp"
|
|
||||||
#include "renderer/3d/pipeline/shared/pipeline_frustum_culling.hpp"
|
#include "renderer/3d/pipeline/shared/pipeline_frustum_culling.hpp"
|
||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
|
|||||||
@@ -11,21 +11,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "renderer/3d/pipeline/shared/pipeline_options.hpp"
|
#include "renderer/3d/pipeline/shared/pipeline_options.hpp"
|
||||||
#include "./stapip_ztest.hpp"
|
|
||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
|
|
||||||
class StaPipOptions : public PipelineOptions {
|
class StaPipOptions : public PipelineOptions {
|
||||||
public:
|
public:
|
||||||
StaPipOptions() {
|
StaPipOptions() { fullClipChecks = false; }
|
||||||
fullClipChecks = false;
|
|
||||||
zTestType = StaPipZTest_Standard;
|
|
||||||
}
|
|
||||||
~StaPipOptions() {}
|
~StaPipOptions() {}
|
||||||
|
|
||||||
/** @brief Type of z buffer testing. */
|
|
||||||
StaPipZTest zTestType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Experimental! True -> enables "clip against each plane" algorithm.
|
* @brief Experimental! True -> enables "clip against each plane" algorithm.
|
||||||
* Mandatory, default: False.
|
* Mandatory, default: False.
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include "renderer/renderer_settings.hpp"
|
#include "renderer/renderer_settings.hpp"
|
||||||
#include "./renderer_core_gs_vram.hpp"
|
#include "./renderer_core_gs_vram.hpp"
|
||||||
|
#include "../renderer_core_sync.hpp"
|
||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
|
|
||||||
@@ -27,10 +28,6 @@ class RendererCoreGS {
|
|||||||
|
|
||||||
void flipBuffers();
|
void flipBuffers();
|
||||||
|
|
||||||
void setStandardZTest();
|
|
||||||
|
|
||||||
void setAllPassZTest();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
constexpr static float gsCenter = 4096.0F;
|
constexpr static float gsCenter = 4096.0F;
|
||||||
constexpr static float screenCenter = gsCenter / 2.0F;
|
constexpr static float screenCenter = gsCenter / 2.0F;
|
||||||
@@ -48,7 +45,6 @@ class RendererCoreGS {
|
|||||||
void updateCurrentField();
|
void updateCurrentField();
|
||||||
qword_t* setXYOffset(qword_t* q, const int& drawContext, const float& x,
|
qword_t* setXYOffset(qword_t* q, const int& drawContext, const float& x,
|
||||||
const float& y);
|
const float& y);
|
||||||
qword_t* addAllPassZTest(qword_t* q, int context, zbuffer_t* z);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Tyra
|
} // namespace Tyra
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <tamtypes.h>
|
#include <tamtypes.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
|
|
||||||
@@ -20,8 +21,12 @@ class Threading {
|
|||||||
~Threading();
|
~Threading();
|
||||||
|
|
||||||
static void sleep(const u32& ms);
|
static void sleep(const u32& ms);
|
||||||
|
static void sleep(const timespec& tv);
|
||||||
|
|
||||||
static void switchThread();
|
static void switchThread();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static timespec tv;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Tyra
|
} // namespace Tyra
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ DynPipRenderer::~DynPipRenderer() {
|
|||||||
|
|
||||||
void DynPipRenderer::allocateOnUse(const u32& t_packetSize) {
|
void DynPipRenderer::allocateOnUse(const u32& t_packetSize) {
|
||||||
staticDataPacket = packet2_create(3, P2_TYPE_NORMAL, P2_MODE_CHAIN, true);
|
staticDataPacket = packet2_create(3, P2_TYPE_NORMAL, P2_MODE_CHAIN, true);
|
||||||
objectDataPacket = packet2_create(16, P2_TYPE_NORMAL, P2_MODE_CHAIN, true);
|
objectDataPacket = packet2_create(20, P2_TYPE_NORMAL, P2_MODE_CHAIN, true);
|
||||||
|
|
||||||
packetSize = t_packetSize;
|
packetSize = t_packetSize;
|
||||||
|
|
||||||
@@ -129,6 +129,19 @@ void DynPipRenderer::sendObjectData(
|
|||||||
|
|
||||||
packet2_utils_gs_add_lod(objectDataPacket, lod);
|
packet2_utils_gs_add_lod(objectDataPacket, lod);
|
||||||
|
|
||||||
|
if (bag->info->zTestType == PipelineZTest_AllPass) {
|
||||||
|
packet2_add_2x_s64(objectDataPacket,
|
||||||
|
GS_SET_TEST(0, 0, 0, 0, 0, 0, 0, ZTEST_METHOD_ALLPASS),
|
||||||
|
GS_REG_TEST);
|
||||||
|
} else {
|
||||||
|
packet2_add_2x_s64(
|
||||||
|
objectDataPacket,
|
||||||
|
GS_SET_TEST(DRAW_ENABLE, ATEST_METHOD_NOTEQUAL, 0x00,
|
||||||
|
ATEST_KEEP_FRAMEBUFFER, DRAW_DISABLE, DRAW_DISABLE,
|
||||||
|
DRAW_ENABLE, rendererCore->gs.zBuffer.method),
|
||||||
|
GS_REG_TEST);
|
||||||
|
}
|
||||||
|
|
||||||
if (texBuffers != nullptr) {
|
if (texBuffers != nullptr) {
|
||||||
rendererCore->texture.updateClutBuffer(texBuffers->clut);
|
rendererCore->texture.updateClutBuffer(texBuffers->clut);
|
||||||
|
|
||||||
@@ -195,7 +208,7 @@ void DynPipRenderer::uploadPrograms() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DynPipRenderer::setDoubleBuffer() {
|
void DynPipRenderer::setDoubleBuffer() {
|
||||||
u16 startingAddr = VU1_LAST_ITEM_ADDR + 1;
|
u16 startingAddr = VU1_DYNPIP_LAST_ITEM_ADDR + 1;
|
||||||
const u16 bufferMaxSize = 1000;
|
const u16 bufferMaxSize = 1000;
|
||||||
bufferSize = (bufferMaxSize - startingAddr) / 2;
|
bufferSize = (bufferMaxSize - startingAddr) / 2;
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ void DynPipVU1Program::addStandardBufferDataToPacket(packet2_t* packet,
|
|||||||
}
|
}
|
||||||
|
|
||||||
u16 DynPipVU1Program::getMaxVertCount(const u16& bufferSize) const {
|
u16 DynPipVU1Program::getMaxVertCount(const u16& bufferSize) const {
|
||||||
u16 res = bufferSize - 4;
|
u16 res = bufferSize - 7; // 7 because of -> StoreTyraGifTags{}
|
||||||
res /= (elementsPerVertex + reglistCount);
|
res /= (elementsPerVertex + reglistCount);
|
||||||
|
|
||||||
// Buffer size = VU1 double buffer size (xtop)
|
// Buffer size = VU1 double buffer size (xtop)
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
LoadTyraStaticData{ gifSetTag }
|
LoadTyraStaticData{ gifSetTag }
|
||||||
MatrixLoad{ mvp, VU1_MVP_MATRIX_ADDR, vi00 }
|
MatrixLoad{ mvp, VU1_MVP_MATRIX_ADDR, vi00 }
|
||||||
LoadTyraSingleColor{ singleColor, singleColorEnabled, VU1_SINGLE_COLOR_ADDR, VU1_OPTIONS_ADDR }
|
LoadTyraSingleColor{ singleColor, singleColorEnabled, VU1_SINGLE_COLOR_ADDR, VU1_OPTIONS_ADDR }
|
||||||
LoadTyraTags{ lodGifTag, texBufferClutGifTag, VU1_LOD_ADDR, VU1_CLUT_ADDR }
|
LoadTyraTags{ lodGifTag, testsTag, VU1_LOD_ADDR, VU1_Z_TESTS_ADDR }
|
||||||
FixColor{ singleColor }
|
FixColor{ singleColor }
|
||||||
|
|
||||||
begin:
|
begin:
|
||||||
@@ -43,13 +43,13 @@ begin:
|
|||||||
LoadTyraPrimTag{ primTag, buffer }
|
LoadTyraPrimTag{ primTag, buffer }
|
||||||
|
|
||||||
ilw.w vertexCount, 0(buffer)
|
ilw.w vertexCount, 0(buffer)
|
||||||
iaddiu vertexDataFrom, buffer, VU1_VERT_DATA_ADDR
|
iaddiu vertexDataFrom, buffer, VU1_DYNPIP_VERT_DATA_ADDR
|
||||||
|
|
||||||
iadd kickAddress, vertexDataFrom, vertexCount
|
iadd kickAddress, vertexDataFrom, vertexCount
|
||||||
iadd destAddress, kickAddress, vertexCount
|
iadd destAddress, kickAddress, vertexCount
|
||||||
iadd kickAddress, kickAddress, vertexCount
|
iadd kickAddress, kickAddress, vertexCount
|
||||||
|
|
||||||
StoreTyraGifTags{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, destAddress }
|
StoreTyraGifTags{ gifSetTag, lodGifTag, primTag, testsTag, destAddress }
|
||||||
LoadTyraLerpValue{ interp, VU1_OPTIONS_ADDR }
|
LoadTyraLerpValue{ interp, VU1_OPTIONS_ADDR }
|
||||||
LoadTyraScaleValue{ scale, buffer }
|
LoadTyraScaleValue{ scale, buffer }
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ std::string DynPipCVU1Program::getStringName() const {
|
|||||||
|
|
||||||
void DynPipCVU1Program::addProgramQBufferDataToPacket(packet2_t* packet,
|
void DynPipCVU1Program::addProgramQBufferDataToPacket(packet2_t* packet,
|
||||||
DynPipBag* bag) const {
|
DynPipBag* bag) const {
|
||||||
u32 addr = VU1_VERT_DATA_ADDR;
|
u32 addr = VU1_DYNPIP_VERT_DATA_ADDR;
|
||||||
|
|
||||||
// Add vertices
|
// Add vertices
|
||||||
packet2_utils_vu_add_unpack_data(packet, addr, bag->verticesFrom, bag->count,
|
packet2_utils_vu_add_unpack_data(packet, addr, bag->verticesFrom, bag->count,
|
||||||
|
|||||||
@@ -34,14 +34,14 @@
|
|||||||
ResetClipFlags{ }
|
ResetClipFlags{ }
|
||||||
LoadTyraStaticData{ gifSetTag }
|
LoadTyraStaticData{ gifSetTag }
|
||||||
MatrixLoad{ mvp, VU1_MVP_MATRIX_ADDR, vi00 }
|
MatrixLoad{ mvp, VU1_MVP_MATRIX_ADDR, vi00 }
|
||||||
LoadTyraTags{ lodGifTag, texBufferClutGifTag, VU1_LOD_ADDR, VU1_CLUT_ADDR }
|
LoadTyraTags{ lodGifTag, testsTag, VU1_LOD_ADDR, VU1_Z_TESTS_ADDR }
|
||||||
|
|
||||||
begin:
|
begin:
|
||||||
xtop buffer
|
xtop buffer
|
||||||
LoadTyraPrimTag{ primTag, buffer }
|
LoadTyraPrimTag{ primTag, buffer }
|
||||||
|
|
||||||
ilw.w vertexCount, 0(buffer)
|
ilw.w vertexCount, 0(buffer)
|
||||||
iaddiu vertexDataFrom, buffer, VU1_VERT_DATA_ADDR
|
iaddiu vertexDataFrom, buffer, VU1_DYNPIP_VERT_DATA_ADDR
|
||||||
|
|
||||||
iadd normalDataFrom, vertexDataFrom, vertexCount
|
iadd normalDataFrom, vertexDataFrom, vertexCount
|
||||||
iadd normalDataFrom, normalDataFrom, vertexCount
|
iadd normalDataFrom, normalDataFrom, vertexCount
|
||||||
@@ -50,7 +50,7 @@ begin:
|
|||||||
iadd destAddress, kickAddress, vertexCount
|
iadd destAddress, kickAddress, vertexCount
|
||||||
iadd kickAddress, kickAddress, vertexCount
|
iadd kickAddress, kickAddress, vertexCount
|
||||||
|
|
||||||
StoreTyraGifTags{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, destAddress }
|
StoreTyraGifTags{ gifSetTag, lodGifTag, primTag, testsTag, destAddress }
|
||||||
LoadTyraLerpValue{ interp, VU1_OPTIONS_ADDR }
|
LoadTyraLerpValue{ interp, VU1_OPTIONS_ADDR }
|
||||||
LoadTyraScaleValue{ scale, buffer }
|
LoadTyraScaleValue{ scale, buffer }
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ std::string DynPipDVU1Program::getStringName() const {
|
|||||||
|
|
||||||
void DynPipDVU1Program::addProgramQBufferDataToPacket(packet2_t* packet,
|
void DynPipDVU1Program::addProgramQBufferDataToPacket(packet2_t* packet,
|
||||||
DynPipBag* bag) const {
|
DynPipBag* bag) const {
|
||||||
u32 addr = VU1_VERT_DATA_ADDR;
|
u32 addr = VU1_DYNPIP_VERT_DATA_ADDR;
|
||||||
|
|
||||||
// Add vertices
|
// Add vertices
|
||||||
packet2_utils_vu_add_unpack_data(packet, addr, bag->verticesFrom, bag->count,
|
packet2_utils_vu_add_unpack_data(packet, addr, bag->verticesFrom, bag->count,
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
LoadTyraStaticData{ gifSetTag }
|
LoadTyraStaticData{ gifSetTag }
|
||||||
MatrixLoad{ mvp, VU1_MVP_MATRIX_ADDR, vi00 }
|
MatrixLoad{ mvp, VU1_MVP_MATRIX_ADDR, vi00 }
|
||||||
LoadTyraSingleColor{ singleColor, singleColorEnabled, VU1_SINGLE_COLOR_ADDR, VU1_OPTIONS_ADDR }
|
LoadTyraSingleColor{ singleColor, singleColorEnabled, VU1_SINGLE_COLOR_ADDR, VU1_OPTIONS_ADDR }
|
||||||
LoadTyraTags{ lodGifTag, texBufferClutGifTag, VU1_LOD_ADDR, VU1_CLUT_ADDR }
|
LoadTyraTagsTexture{ lodGifTag, testsTag, texBufferClutGifTag, VU1_LOD_ADDR, VU1_Z_TESTS_ADDR, VU1_CLUT_ADDR }
|
||||||
FixColor{ singleColor }
|
FixColor{ singleColor }
|
||||||
|
|
||||||
begin:
|
begin:
|
||||||
@@ -44,7 +44,7 @@ begin:
|
|||||||
LoadTyraPrimTag{ primTag, buffer }
|
LoadTyraPrimTag{ primTag, buffer }
|
||||||
|
|
||||||
ilw.w vertexCount, 0(buffer)
|
ilw.w vertexCount, 0(buffer)
|
||||||
iaddiu vertexDataFrom, buffer, VU1_VERT_DATA_ADDR
|
iaddiu vertexDataFrom, buffer, VU1_DYNPIP_VERT_DATA_ADDR
|
||||||
|
|
||||||
iadd stqDataFrom, vertexDataFrom, vertexCount
|
iadd stqDataFrom, vertexDataFrom, vertexCount
|
||||||
iadd stqDataFrom, stqDataFrom, vertexCount
|
iadd stqDataFrom, stqDataFrom, vertexCount
|
||||||
@@ -53,7 +53,7 @@ begin:
|
|||||||
iadd destAddress, kickAddress, vertexCount
|
iadd destAddress, kickAddress, vertexCount
|
||||||
iadd kickAddress, kickAddress, vertexCount
|
iadd kickAddress, kickAddress, vertexCount
|
||||||
|
|
||||||
StoreTyraGifTags{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, destAddress }
|
StoreTyraGifTagsTexture{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, testsTag, destAddress }
|
||||||
LoadTyraLerpValue{ interp, VU1_OPTIONS_ADDR }
|
LoadTyraLerpValue{ interp, VU1_OPTIONS_ADDR }
|
||||||
LoadTyraScaleValue{ scale, buffer }
|
LoadTyraScaleValue{ scale, buffer }
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ std::string DynPipTCVU1Program::getStringName() const {
|
|||||||
|
|
||||||
void DynPipTCVU1Program::addProgramQBufferDataToPacket(packet2_t* packet,
|
void DynPipTCVU1Program::addProgramQBufferDataToPacket(packet2_t* packet,
|
||||||
DynPipBag* bag) const {
|
DynPipBag* bag) const {
|
||||||
u32 addr = VU1_VERT_DATA_ADDR;
|
u32 addr = VU1_DYNPIP_VERT_DATA_ADDR;
|
||||||
|
|
||||||
// Add vertices
|
// Add vertices
|
||||||
packet2_utils_vu_add_unpack_data(packet, addr, bag->verticesFrom, bag->count,
|
packet2_utils_vu_add_unpack_data(packet, addr, bag->verticesFrom, bag->count,
|
||||||
|
|||||||
@@ -35,14 +35,14 @@
|
|||||||
ResetClipFlags{ }
|
ResetClipFlags{ }
|
||||||
LoadTyraStaticData{ gifSetTag }
|
LoadTyraStaticData{ gifSetTag }
|
||||||
MatrixLoad{ mvp, VU1_MVP_MATRIX_ADDR, vi00 }
|
MatrixLoad{ mvp, VU1_MVP_MATRIX_ADDR, vi00 }
|
||||||
LoadTyraTags{ lodGifTag, texBufferClutGifTag, VU1_LOD_ADDR, VU1_CLUT_ADDR }
|
LoadTyraTagsTexture{ lodGifTag, testsTag, texBufferClutGifTag, VU1_LOD_ADDR, VU1_Z_TESTS_ADDR, VU1_CLUT_ADDR }
|
||||||
|
|
||||||
begin:
|
begin:
|
||||||
xtop buffer
|
xtop buffer
|
||||||
LoadTyraPrimTag{ primTag, buffer }
|
LoadTyraPrimTag{ primTag, buffer }
|
||||||
|
|
||||||
ilw.w vertexCount, 0(buffer)
|
ilw.w vertexCount, 0(buffer)
|
||||||
iaddiu vertexDataFrom, buffer, VU1_VERT_DATA_ADDR
|
iaddiu vertexDataFrom, buffer, VU1_DYNPIP_VERT_DATA_ADDR
|
||||||
|
|
||||||
iadd stqDataFrom, vertexDataFrom, vertexCount
|
iadd stqDataFrom, vertexDataFrom, vertexCount
|
||||||
iadd stqDataFrom, stqDataFrom, vertexCount
|
iadd stqDataFrom, stqDataFrom, vertexCount
|
||||||
@@ -54,7 +54,7 @@ begin:
|
|||||||
iadd destAddress, kickAddress, vertexCount
|
iadd destAddress, kickAddress, vertexCount
|
||||||
iadd kickAddress, kickAddress, vertexCount
|
iadd kickAddress, kickAddress, vertexCount
|
||||||
|
|
||||||
StoreTyraGifTags{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, destAddress }
|
StoreTyraGifTagsTexture{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, testsTag, destAddress }
|
||||||
LoadTyraLerpValue{ interp, VU1_OPTIONS_ADDR }
|
LoadTyraLerpValue{ interp, VU1_OPTIONS_ADDR }
|
||||||
LoadTyraScaleValue{ scale, buffer }
|
LoadTyraScaleValue{ scale, buffer }
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ std::string DynPipTDVU1Program::getStringName() const {
|
|||||||
|
|
||||||
void DynPipTDVU1Program::addProgramQBufferDataToPacket(packet2_t* packet,
|
void DynPipTDVU1Program::addProgramQBufferDataToPacket(packet2_t* packet,
|
||||||
DynPipBag* bag) const {
|
DynPipBag* bag) const {
|
||||||
u32 addr = VU1_VERT_DATA_ADDR;
|
u32 addr = VU1_DYNPIP_VERT_DATA_ADDR;
|
||||||
|
|
||||||
// Add vertices
|
// Add vertices
|
||||||
packet2_utils_vu_add_unpack_data(packet, addr, bag->verticesFrom, bag->count,
|
packet2_utils_vu_add_unpack_data(packet, addr, bag->verticesFrom, bag->count,
|
||||||
|
|||||||
@@ -218,6 +218,7 @@ DynPipInfoBag* DynamicPipeline::getInfoBag(DynamicMesh* mesh,
|
|||||||
result->shadingType = options->shadingType;
|
result->shadingType = options->shadingType;
|
||||||
result->textureMappingType = options->textureMappingType;
|
result->textureMappingType = options->textureMappingType;
|
||||||
result->transformationType = options->transformationType;
|
result->transformationType = options->transformationType;
|
||||||
|
result->zTestType = options->zTestType;
|
||||||
result->frustumCulling =
|
result->frustumCulling =
|
||||||
options->frustumCulling == PipelineFrustumCulling_Precise
|
options->frustumCulling == PipelineFrustumCulling_Precise
|
||||||
? PipelineInfoBagFrustumCulling_Precise
|
? PipelineInfoBagFrustumCulling_Precise
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ BlockizerProgramsManager::BlockizerProgramsManager() {
|
|||||||
context = 0;
|
context = 0;
|
||||||
vu1BlockData = BlockNotUploaded;
|
vu1BlockData = BlockNotUploaded;
|
||||||
|
|
||||||
|
dma_channel_initialize(DMA_CHANNEL_VIF1, NULL, 0);
|
||||||
|
dma_channel_fast_waits(DMA_CHANNEL_VIF1);
|
||||||
|
|
||||||
setProgramsCache();
|
setProgramsCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,13 +34,25 @@
|
|||||||
;//---------------------------------------------------------
|
;//---------------------------------------------------------
|
||||||
;// LoadTyraTags - Load lod, texture buffer and clut
|
;// LoadTyraTags - Load lod, texture buffer and clut
|
||||||
;// 1 - GIF tag - texture LOD
|
;// 1 - GIF tag - texture LOD
|
||||||
;// 2 - GIF tag - texture buffer & CLUT
|
;// 2 - GIF tag - Z buffer tests method
|
||||||
|
;// 3 - GIF tag - texture buffer & CLUT
|
||||||
;//---------------------------------------------------------
|
;//---------------------------------------------------------
|
||||||
#macro LoadTyraTags: t_lodGifTag, t_texBufferClutGifTag, t_lodAddr, t_ClutAddr
|
#macro LoadTyraTagsTexture: t_lodGifTag, t_testsGifTag, t_texBufferClutGifTag, t_lodAddr, t_testsAddr, t_ClutAddr
|
||||||
lq t_lodGifTag, t_lodAddr(vi00)
|
lq t_lodGifTag, t_lodAddr(vi00)
|
||||||
|
lq t_testsGifTag, t_testsAddr(vi00)
|
||||||
lq t_texBufferClutGifTag, t_ClutAddr(vi00)
|
lq t_texBufferClutGifTag, t_ClutAddr(vi00)
|
||||||
#endmacro
|
#endmacro
|
||||||
|
|
||||||
|
;//---------------------------------------------------------
|
||||||
|
;// LoadTyraTags - Load lod, texture buffer and clut
|
||||||
|
;// 1 - GIF tag - texture LOD
|
||||||
|
;// 2 - GIF tag - Z buffer tests method
|
||||||
|
;//---------------------------------------------------------
|
||||||
|
#macro LoadTyraTags: t_lodGifTag, t_testsGifTag, t_lodAddr, t_testsAddr
|
||||||
|
lq t_lodGifTag, t_lodAddr(vi00)
|
||||||
|
lq t_testsGifTag, t_testsAddr(vi00)
|
||||||
|
#endmacro
|
||||||
|
|
||||||
;//---------------------------------------------------------
|
;//---------------------------------------------------------
|
||||||
;// LoadTyraPrimTag - Load prim tag
|
;// LoadTyraPrimTag - Load prim tag
|
||||||
;// 2 - GIF tag - tell GS how many data we will send
|
;// 2 - GIF tag - tell GS how many data we will send
|
||||||
@@ -77,17 +89,33 @@
|
|||||||
lq.xyz t_ambientColor, t_colorOffset+3(vi00)
|
lq.xyz t_ambientColor, t_colorOffset+3(vi00)
|
||||||
#endmacro
|
#endmacro
|
||||||
|
|
||||||
|
;//---------------------------------------------------------
|
||||||
|
;// StoreTyraGifTagsTexture - Store gif tags.
|
||||||
|
;// Not using sqi instruction, because VCL cannot optimize it.
|
||||||
|
;// Primtag contains information about how many polys we will send
|
||||||
|
;//---------------------------------------------------------
|
||||||
|
#macro StoreTyraGifTagsTexture: t_gifSetTag, t_lodGifTag, t_texBufferClutGifTag, t_primTag, t_testsTag, t_destAddress
|
||||||
|
sq t_gifSetTag, 0(t_destAddress)
|
||||||
|
sq t_testsTag, 1(t_destAddress)
|
||||||
|
sq t_gifSetTag, 2(t_destAddress)
|
||||||
|
sq t_lodGifTag, 3(t_destAddress)
|
||||||
|
sq t_gifSetTag, 4(t_destAddress)
|
||||||
|
sq t_texBufferClutGifTag, 5(t_destAddress)
|
||||||
|
sq t_primTag, 6(t_destAddress)
|
||||||
|
iaddiu t_destAddress, t_destAddress, 7
|
||||||
|
#endmacro
|
||||||
|
|
||||||
;//---------------------------------------------------------
|
;//---------------------------------------------------------
|
||||||
;// StoreTyraGifTags - Store gif tags.
|
;// StoreTyraGifTags - Store gif tags.
|
||||||
;// Not using sqi instruction, because VCL cannot optimize it.
|
;// Not using sqi instruction, because VCL cannot optimize it.
|
||||||
;// Primtag contains information about how many polys we will send
|
;// Primtag contains information about how many polys we will send
|
||||||
;//---------------------------------------------------------
|
;//---------------------------------------------------------
|
||||||
#macro StoreTyraGifTags: t_gifSetTag, t_lodGifTag, t_texBufferClutGifTag, t_primTag, t_destAddress
|
#macro StoreTyraGifTags: t_gifSetTag, t_lodGifTag, t_primTag, t_testsTag, t_destAddress
|
||||||
sq t_gifSetTag, 0(t_destAddress)
|
sq t_gifSetTag, 0(t_destAddress)
|
||||||
sq t_lodGifTag, 1(t_destAddress)
|
sq t_testsTag, 1(t_destAddress)
|
||||||
sq t_gifSetTag, 2(t_destAddress)
|
sq t_gifSetTag, 2(t_destAddress)
|
||||||
sq t_texBufferClutGifTag, 3(t_destAddress)
|
sq t_lodGifTag, 3(t_destAddress)
|
||||||
sq t_primTag, 4(t_destAddress)
|
sq t_primTag, 6(t_destAddress)
|
||||||
iaddiu t_destAddress, t_destAddress, 5
|
iaddiu t_destAddress, t_destAddress, 5
|
||||||
#endmacro
|
#endmacro
|
||||||
|
|
||||||
|
|||||||
@@ -32,13 +32,13 @@
|
|||||||
|
|
||||||
LoadTyraStaticData{ gifSetTag }
|
LoadTyraStaticData{ gifSetTag }
|
||||||
LoadTyraSingleColor{ singleColor, singleColorEnabled, VU1_SINGLE_COLOR_ADDR, VU1_OPTIONS_ADDR }
|
LoadTyraSingleColor{ singleColor, singleColorEnabled, VU1_SINGLE_COLOR_ADDR, VU1_OPTIONS_ADDR }
|
||||||
LoadTyraTags{ lodGifTag, texBufferClutGifTag, VU1_LOD_ADDR, VU1_CLUT_ADDR }
|
LoadTyraTags{ lodGifTag, testsTag, VU1_LOD_ADDR, VU1_Z_TESTS_ADDR }
|
||||||
|
|
||||||
begin:
|
begin:
|
||||||
xtop buffer
|
xtop buffer
|
||||||
LoadTyraBufferTags{ scale, primTag, buffer }
|
LoadTyraBufferTags{ scale, primTag, buffer }
|
||||||
|
|
||||||
iaddiu vertexData, buffer, VU1_VERT_DATA_ADDR
|
iaddiu vertexData, buffer, VU1_STAPIP_VERT_DATA_ADDR
|
||||||
ilw.w vertexCount, 0(buffer)
|
ilw.w vertexCount, 0(buffer)
|
||||||
iadd colorData, vertexData, vertexCount
|
iadd colorData, vertexData, vertexCount
|
||||||
iblez singleColorEnabled, setDestAddrMultiColor
|
iblez singleColorEnabled, setDestAddrMultiColor
|
||||||
@@ -49,7 +49,7 @@ setDestAddrMultiColor:
|
|||||||
setDestAddr:
|
setDestAddr:
|
||||||
iaddiu destAddress, kickAddress, 0
|
iaddiu destAddress, kickAddress, 0
|
||||||
|
|
||||||
StoreTyraGifTags{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, destAddress }
|
StoreTyraGifTags{ gifSetTag, lodGifTag, primTag, testsTag, destAddress }
|
||||||
|
|
||||||
;--- Loop
|
;--- Loop
|
||||||
iadd vertexCounter, buffer, vertexCount
|
iadd vertexCounter, buffer, vertexCount
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ std::string StaPipAsIsCVU1Program::getStringName() const {
|
|||||||
|
|
||||||
void StaPipAsIsCVU1Program::addProgramQBufferDataToPacket(
|
void StaPipAsIsCVU1Program::addProgramQBufferDataToPacket(
|
||||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||||
u32 addr = VU1_VERT_DATA_ADDR;
|
u32 addr = VU1_STAPIP_VERT_DATA_ADDR;
|
||||||
|
|
||||||
// Add vertices
|
// Add vertices
|
||||||
packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->vertices,
|
packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->vertices,
|
||||||
|
|||||||
@@ -32,19 +32,19 @@
|
|||||||
|
|
||||||
LoadTyraStaticData{ gifSetTag }
|
LoadTyraStaticData{ gifSetTag }
|
||||||
LoadTyraDirectionalLights{ lightMatrix, lightDirections, lightColors, ambientColor, VU1_LIGHTS_DIRS_ADDR, VU1_LIGHTS_COLORS_ADDR, VU1_LIGHTS_MATRIX_ADDR }
|
LoadTyraDirectionalLights{ lightMatrix, lightDirections, lightColors, ambientColor, VU1_LIGHTS_DIRS_ADDR, VU1_LIGHTS_COLORS_ADDR, VU1_LIGHTS_MATRIX_ADDR }
|
||||||
LoadTyraTags{ lodGifTag, texBufferClutGifTag, VU1_LOD_ADDR, VU1_CLUT_ADDR }
|
LoadTyraTags{ lodGifTag, testsTag, VU1_LOD_ADDR, VU1_Z_TESTS_ADDR }
|
||||||
|
|
||||||
begin:
|
begin:
|
||||||
xtop buffer
|
xtop buffer
|
||||||
LoadTyraBufferTags{ scale, primTag, buffer }
|
LoadTyraBufferTags{ scale, primTag, buffer }
|
||||||
|
|
||||||
iaddiu vertexData, buffer, VU1_VERT_DATA_ADDR
|
iaddiu vertexData, buffer, VU1_STAPIP_VERT_DATA_ADDR
|
||||||
ilw.w vertexCount, 0(buffer)
|
ilw.w vertexCount, 0(buffer)
|
||||||
iadd normalData, vertexData, vertexCount
|
iadd normalData, vertexData, vertexCount
|
||||||
iadd kickAddress, normalData, vertexCount
|
iadd kickAddress, normalData, vertexCount
|
||||||
iadd destAddress, normalData, vertexCount
|
iadd destAddress, normalData, vertexCount
|
||||||
|
|
||||||
StoreTyraGifTags{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, destAddress }
|
StoreTyraGifTags{ gifSetTag, lodGifTag, primTag, testsTag, destAddress }
|
||||||
|
|
||||||
;--- Loop
|
;--- Loop
|
||||||
iadd vertexCounter, buffer, vertexCount
|
iadd vertexCounter, buffer, vertexCount
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ std::string StaPipAsIsDVU1Program::getStringName() const {
|
|||||||
|
|
||||||
void StaPipAsIsDVU1Program::addProgramQBufferDataToPacket(
|
void StaPipAsIsDVU1Program::addProgramQBufferDataToPacket(
|
||||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||||
u32 addr = VU1_VERT_DATA_ADDR;
|
u32 addr = VU1_STAPIP_VERT_DATA_ADDR;
|
||||||
|
|
||||||
// Add vertices
|
// Add vertices
|
||||||
packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->vertices,
|
packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->vertices,
|
||||||
|
|||||||
+3
-3
@@ -33,13 +33,13 @@
|
|||||||
|
|
||||||
LoadTyraStaticData{ gifSetTag }
|
LoadTyraStaticData{ gifSetTag }
|
||||||
LoadTyraSingleColor{ singleColor, singleColorEnabled, VU1_SINGLE_COLOR_ADDR, VU1_OPTIONS_ADDR }
|
LoadTyraSingleColor{ singleColor, singleColorEnabled, VU1_SINGLE_COLOR_ADDR, VU1_OPTIONS_ADDR }
|
||||||
LoadTyraTags{ lodGifTag, texBufferClutGifTag, VU1_LOD_ADDR, VU1_CLUT_ADDR }
|
LoadTyraTagsTexture{ lodGifTag, testsTag, texBufferClutGifTag, VU1_LOD_ADDR, VU1_Z_TESTS_ADDR, VU1_CLUT_ADDR }
|
||||||
|
|
||||||
begin:
|
begin:
|
||||||
xtop buffer
|
xtop buffer
|
||||||
LoadTyraBufferTags{ scale, primTag, buffer }
|
LoadTyraBufferTags{ scale, primTag, buffer }
|
||||||
|
|
||||||
iaddiu vertexData, buffer, VU1_VERT_DATA_ADDR
|
iaddiu vertexData, buffer, VU1_STAPIP_VERT_DATA_ADDR
|
||||||
ilw.w vertexCount, 0(buffer)
|
ilw.w vertexCount, 0(buffer)
|
||||||
iadd stqData, vertexData, vertexCount
|
iadd stqData, vertexData, vertexCount
|
||||||
iadd colorData, stqData, vertexCount
|
iadd colorData, stqData, vertexCount
|
||||||
@@ -51,7 +51,7 @@ setDestAddrMultiColor:
|
|||||||
setDestAddr:
|
setDestAddr:
|
||||||
iaddiu destAddress, kickAddress, 0
|
iaddiu destAddress, kickAddress, 0
|
||||||
|
|
||||||
StoreTyraGifTags{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, destAddress }
|
StoreTyraGifTagsTexture{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, testsTag, destAddress }
|
||||||
|
|
||||||
;--- Loop
|
;--- Loop
|
||||||
iadd vertexCounter, buffer, vertexCount
|
iadd vertexCounter, buffer, vertexCount
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ std::string StaPipAsIsTCVU1Program::getStringName() const {
|
|||||||
|
|
||||||
void StaPipAsIsTCVU1Program::addProgramQBufferDataToPacket(
|
void StaPipAsIsTCVU1Program::addProgramQBufferDataToPacket(
|
||||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||||
u32 addr = VU1_VERT_DATA_ADDR;
|
u32 addr = VU1_STAPIP_VERT_DATA_ADDR;
|
||||||
|
|
||||||
// Add vertices
|
// Add vertices
|
||||||
packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->vertices,
|
packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->vertices,
|
||||||
|
|||||||
+3
-3
@@ -33,20 +33,20 @@
|
|||||||
|
|
||||||
LoadTyraStaticData{ gifSetTag }
|
LoadTyraStaticData{ gifSetTag }
|
||||||
LoadTyraDirectionalLights{ lightMatrix, lightDirections, lightColors, ambientColor, VU1_LIGHTS_DIRS_ADDR, VU1_LIGHTS_COLORS_ADDR, VU1_LIGHTS_MATRIX_ADDR }
|
LoadTyraDirectionalLights{ lightMatrix, lightDirections, lightColors, ambientColor, VU1_LIGHTS_DIRS_ADDR, VU1_LIGHTS_COLORS_ADDR, VU1_LIGHTS_MATRIX_ADDR }
|
||||||
LoadTyraTags{ lodGifTag, texBufferClutGifTag, VU1_LOD_ADDR, VU1_CLUT_ADDR }
|
LoadTyraTagsTexture{ lodGifTag, testsTag, texBufferClutGifTag, VU1_LOD_ADDR, VU1_Z_TESTS_ADDR, VU1_CLUT_ADDR }
|
||||||
|
|
||||||
begin:
|
begin:
|
||||||
xtop buffer
|
xtop buffer
|
||||||
LoadTyraBufferTags{ scale, primTag, buffer }
|
LoadTyraBufferTags{ scale, primTag, buffer }
|
||||||
|
|
||||||
iaddiu vertexData, buffer, VU1_VERT_DATA_ADDR
|
iaddiu vertexData, buffer, VU1_STAPIP_VERT_DATA_ADDR
|
||||||
ilw.w vertexCount, 0(buffer)
|
ilw.w vertexCount, 0(buffer)
|
||||||
iadd stqData, vertexData, vertexCount
|
iadd stqData, vertexData, vertexCount
|
||||||
iadd normalData, stqData, vertexCount
|
iadd normalData, stqData, vertexCount
|
||||||
iadd kickAddress, normalData, vertexCount
|
iadd kickAddress, normalData, vertexCount
|
||||||
iadd destAddress, normalData, vertexCount
|
iadd destAddress, normalData, vertexCount
|
||||||
|
|
||||||
StoreTyraGifTags{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, destAddress }
|
StoreTyraGifTagsTexture{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, testsTag, destAddress }
|
||||||
|
|
||||||
;--- Loop
|
;--- Loop
|
||||||
iadd vertexCounter, buffer, vertexCount
|
iadd vertexCounter, buffer, vertexCount
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ std::string StaPipAsIsTDVU1Program::getStringName() const {
|
|||||||
|
|
||||||
void StaPipAsIsTDVU1Program::addProgramQBufferDataToPacket(
|
void StaPipAsIsTDVU1Program::addProgramQBufferDataToPacket(
|
||||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||||
u32 addr = VU1_VERT_DATA_ADDR;
|
u32 addr = VU1_STAPIP_VERT_DATA_ADDR;
|
||||||
|
|
||||||
// Add vertices
|
// Add vertices
|
||||||
packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->vertices,
|
packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->vertices,
|
||||||
|
|||||||
@@ -34,13 +34,13 @@
|
|||||||
LoadTyraStaticData{ gifSetTag }
|
LoadTyraStaticData{ gifSetTag }
|
||||||
MatrixLoad{ mvp, VU1_MVP_MATRIX_ADDR, vi00 }
|
MatrixLoad{ mvp, VU1_MVP_MATRIX_ADDR, vi00 }
|
||||||
LoadTyraSingleColor{ singleColor, singleColorEnabled, VU1_SINGLE_COLOR_ADDR, VU1_OPTIONS_ADDR }
|
LoadTyraSingleColor{ singleColor, singleColorEnabled, VU1_SINGLE_COLOR_ADDR, VU1_OPTIONS_ADDR }
|
||||||
LoadTyraTags{ lodGifTag, texBufferClutGifTag, VU1_LOD_ADDR, VU1_CLUT_ADDR }
|
LoadTyraTags{ lodGifTag, testsTag, VU1_LOD_ADDR, VU1_Z_TESTS_ADDR }
|
||||||
|
|
||||||
begin:
|
begin:
|
||||||
xtop buffer
|
xtop buffer
|
||||||
LoadTyraBufferTags{ scale, primTag, buffer }
|
LoadTyraBufferTags{ scale, primTag, buffer }
|
||||||
|
|
||||||
iaddiu vertexData, buffer, VU1_VERT_DATA_ADDR
|
iaddiu vertexData, buffer, VU1_STAPIP_VERT_DATA_ADDR
|
||||||
ilw.w vertexCount, 0(buffer)
|
ilw.w vertexCount, 0(buffer)
|
||||||
iadd colorData, vertexData, vertexCount
|
iadd colorData, vertexData, vertexCount
|
||||||
iblez singleColorEnabled, setDestAddrMultiColor
|
iblez singleColorEnabled, setDestAddrMultiColor
|
||||||
@@ -51,7 +51,7 @@ setDestAddrMultiColor:
|
|||||||
setDestAddr:
|
setDestAddr:
|
||||||
iaddiu destAddress, kickAddress, 0
|
iaddiu destAddress, kickAddress, 0
|
||||||
|
|
||||||
StoreTyraGifTags{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, destAddress }
|
StoreTyraGifTags{ gifSetTag, lodGifTag, primTag, testsTag, destAddress }
|
||||||
|
|
||||||
;--- Loop
|
;--- Loop
|
||||||
iadd vertexCounter, buffer, vertexCount
|
iadd vertexCounter, buffer, vertexCount
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@ std::string StaPipCullCVU1Program::getStringName() const {
|
|||||||
|
|
||||||
void StaPipCullCVU1Program::addProgramQBufferDataToPacket(
|
void StaPipCullCVU1Program::addProgramQBufferDataToPacket(
|
||||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||||
u32 addr = VU1_VERT_DATA_ADDR;
|
u32 addr = VU1_STAPIP_VERT_DATA_ADDR;
|
||||||
|
|
||||||
// Add vertices
|
// Add vertices
|
||||||
packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->vertices,
|
packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->vertices,
|
||||||
|
|||||||
@@ -34,19 +34,19 @@
|
|||||||
LoadTyraStaticData{ gifSetTag }
|
LoadTyraStaticData{ gifSetTag }
|
||||||
MatrixLoad{ mvp, VU1_MVP_MATRIX_ADDR, vi00 }
|
MatrixLoad{ mvp, VU1_MVP_MATRIX_ADDR, vi00 }
|
||||||
LoadTyraDirectionalLights{ lightMatrix, lightDirections, lightColors, ambientColor, VU1_LIGHTS_DIRS_ADDR, VU1_LIGHTS_COLORS_ADDR, VU1_LIGHTS_MATRIX_ADDR }
|
LoadTyraDirectionalLights{ lightMatrix, lightDirections, lightColors, ambientColor, VU1_LIGHTS_DIRS_ADDR, VU1_LIGHTS_COLORS_ADDR, VU1_LIGHTS_MATRIX_ADDR }
|
||||||
LoadTyraTags{ lodGifTag, texBufferClutGifTag, VU1_LOD_ADDR, VU1_CLUT_ADDR }
|
LoadTyraTags{ lodGifTag, testsTag, VU1_LOD_ADDR, VU1_Z_TESTS_ADDR }
|
||||||
|
|
||||||
begin:
|
begin:
|
||||||
xtop buffer
|
xtop buffer
|
||||||
LoadTyraBufferTags{ scale, primTag, buffer }
|
LoadTyraBufferTags{ scale, primTag, buffer }
|
||||||
|
|
||||||
iaddiu vertexData, buffer, VU1_VERT_DATA_ADDR
|
iaddiu vertexData, buffer, VU1_STAPIP_VERT_DATA_ADDR
|
||||||
ilw.w vertexCount, 0(buffer)
|
ilw.w vertexCount, 0(buffer)
|
||||||
iadd normalData, vertexData, vertexCount
|
iadd normalData, vertexData, vertexCount
|
||||||
iadd kickAddress, normalData, vertexCount
|
iadd kickAddress, normalData, vertexCount
|
||||||
iadd destAddress, normalData, vertexCount
|
iadd destAddress, normalData, vertexCount
|
||||||
|
|
||||||
StoreTyraGifTags{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, destAddress }
|
StoreTyraGifTags{ gifSetTag, lodGifTag, primTag, testsTag, destAddress }
|
||||||
|
|
||||||
;--- Loop
|
;--- Loop
|
||||||
iadd vertexCounter, buffer, vertexCount
|
iadd vertexCounter, buffer, vertexCount
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ std::string StaPipCullDVU1Program::getStringName() const {
|
|||||||
|
|
||||||
void StaPipCullDVU1Program::addProgramQBufferDataToPacket(
|
void StaPipCullDVU1Program::addProgramQBufferDataToPacket(
|
||||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||||
u32 addr = VU1_VERT_DATA_ADDR;
|
u32 addr = VU1_STAPIP_VERT_DATA_ADDR;
|
||||||
|
|
||||||
// Add vertices
|
// Add vertices
|
||||||
packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->vertices,
|
packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->vertices,
|
||||||
|
|||||||
@@ -35,13 +35,13 @@
|
|||||||
LoadTyraStaticData{ gifSetTag }
|
LoadTyraStaticData{ gifSetTag }
|
||||||
MatrixLoad{ mvp, VU1_MVP_MATRIX_ADDR, vi00 }
|
MatrixLoad{ mvp, VU1_MVP_MATRIX_ADDR, vi00 }
|
||||||
LoadTyraSingleColor{ singleColor, singleColorEnabled, VU1_SINGLE_COLOR_ADDR, VU1_OPTIONS_ADDR }
|
LoadTyraSingleColor{ singleColor, singleColorEnabled, VU1_SINGLE_COLOR_ADDR, VU1_OPTIONS_ADDR }
|
||||||
LoadTyraTags{ lodGifTag, texBufferClutGifTag, VU1_LOD_ADDR, VU1_CLUT_ADDR }
|
LoadTyraTagsTexture{ lodGifTag, testsTag, texBufferClutGifTag, VU1_LOD_ADDR, VU1_Z_TESTS_ADDR, VU1_CLUT_ADDR }
|
||||||
|
|
||||||
begin:
|
begin:
|
||||||
xtop buffer
|
xtop buffer
|
||||||
LoadTyraBufferTags{ scale, primTag, buffer }
|
LoadTyraBufferTags{ scale, primTag, buffer }
|
||||||
|
|
||||||
iaddiu vertexData, buffer, VU1_VERT_DATA_ADDR
|
iaddiu vertexData, buffer, VU1_STAPIP_VERT_DATA_ADDR
|
||||||
ilw.w vertexCount, 0(buffer)
|
ilw.w vertexCount, 0(buffer)
|
||||||
iadd stqData, vertexData, vertexCount
|
iadd stqData, vertexData, vertexCount
|
||||||
iadd colorData, stqData, vertexCount
|
iadd colorData, stqData, vertexCount
|
||||||
@@ -53,7 +53,7 @@ setDestAddrMultiColor:
|
|||||||
setDestAddr:
|
setDestAddr:
|
||||||
iaddiu destAddress, kickAddress, 0
|
iaddiu destAddress, kickAddress, 0
|
||||||
|
|
||||||
StoreTyraGifTags{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, destAddress }
|
StoreTyraGifTagsTexture{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, testsTag, destAddress }
|
||||||
|
|
||||||
;--- Loop
|
;--- Loop
|
||||||
iadd vertexCounter, buffer, vertexCount
|
iadd vertexCounter, buffer, vertexCount
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ std::string StaPipCullTCVU1Program::getStringName() const {
|
|||||||
|
|
||||||
void StaPipCullTCVU1Program::addProgramQBufferDataToPacket(
|
void StaPipCullTCVU1Program::addProgramQBufferDataToPacket(
|
||||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||||
u32 addr = VU1_VERT_DATA_ADDR;
|
u32 addr = VU1_STAPIP_VERT_DATA_ADDR;
|
||||||
|
|
||||||
// Add vertices
|
// Add vertices
|
||||||
packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->vertices,
|
packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->vertices,
|
||||||
|
|||||||
@@ -35,20 +35,20 @@
|
|||||||
LoadTyraStaticData{ gifSetTag }
|
LoadTyraStaticData{ gifSetTag }
|
||||||
MatrixLoad{ mvp, VU1_MVP_MATRIX_ADDR, vi00 }
|
MatrixLoad{ mvp, VU1_MVP_MATRIX_ADDR, vi00 }
|
||||||
LoadTyraDirectionalLights{ lightMatrix, lightDirections, lightColors, ambientColor, VU1_LIGHTS_DIRS_ADDR, VU1_LIGHTS_COLORS_ADDR, VU1_LIGHTS_MATRIX_ADDR }
|
LoadTyraDirectionalLights{ lightMatrix, lightDirections, lightColors, ambientColor, VU1_LIGHTS_DIRS_ADDR, VU1_LIGHTS_COLORS_ADDR, VU1_LIGHTS_MATRIX_ADDR }
|
||||||
LoadTyraTags{ lodGifTag, texBufferClutGifTag, VU1_LOD_ADDR, VU1_CLUT_ADDR }
|
LoadTyraTagsTexture{ lodGifTag, testsTag, texBufferClutGifTag, VU1_LOD_ADDR, VU1_Z_TESTS_ADDR, VU1_CLUT_ADDR }
|
||||||
|
|
||||||
begin:
|
begin:
|
||||||
xtop buffer
|
xtop buffer
|
||||||
LoadTyraBufferTags{ scale, primTag, buffer }
|
LoadTyraBufferTags{ scale, primTag, buffer }
|
||||||
|
|
||||||
iaddiu vertexData, buffer, VU1_VERT_DATA_ADDR
|
iaddiu vertexData, buffer, VU1_STAPIP_VERT_DATA_ADDR
|
||||||
ilw.w vertexCount, 0(buffer)
|
ilw.w vertexCount, 0(buffer)
|
||||||
iadd stqData, vertexData, vertexCount
|
iadd stqData, vertexData, vertexCount
|
||||||
iadd normalData, stqData, vertexCount
|
iadd normalData, stqData, vertexCount
|
||||||
iadd kickAddress, normalData, vertexCount
|
iadd kickAddress, normalData, vertexCount
|
||||||
iadd destAddress, normalData, vertexCount
|
iadd destAddress, normalData, vertexCount
|
||||||
|
|
||||||
StoreTyraGifTags{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, destAddress }
|
StoreTyraGifTagsTexture{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, testsTag, destAddress }
|
||||||
|
|
||||||
;--- Loop
|
;--- Loop
|
||||||
iadd vertexCounter, buffer, vertexCount
|
iadd vertexCounter, buffer, vertexCount
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ std::string StaPipCullTDVU1Program::getStringName() const {
|
|||||||
|
|
||||||
void StaPipCullTDVU1Program::addProgramQBufferDataToPacket(
|
void StaPipCullTDVU1Program::addProgramQBufferDataToPacket(
|
||||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||||
u32 addr = VU1_VERT_DATA_ADDR;
|
u32 addr = VU1_STAPIP_VERT_DATA_ADDR;
|
||||||
|
|
||||||
// Add vertices
|
// Add vertices
|
||||||
packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->vertices,
|
packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->vertices,
|
||||||
|
|||||||
@@ -130,10 +130,6 @@ void StaPipCore::render(StaPipBag* bag, StaPipBagPackagesBBox* bbox) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bag->info->zTestType == StaPipZTest_AllPass) {
|
|
||||||
rendererCore->gs.setAllPassZTest();
|
|
||||||
}
|
|
||||||
|
|
||||||
packager.setRenderBBox(renderBbox);
|
packager.setRenderBBox(renderBbox);
|
||||||
|
|
||||||
M4x4 mvp;
|
M4x4 mvp;
|
||||||
@@ -211,10 +207,6 @@ void StaPipCore::render(StaPipBag* bag, StaPipBagPackagesBBox* bbox) {
|
|||||||
|
|
||||||
qbufferRenderer.flushBuffers();
|
qbufferRenderer.flushBuffers();
|
||||||
|
|
||||||
if (bag->info->zTestType == StaPipZTest_AllPass) {
|
|
||||||
rendererCore->gs.setStandardZTest();
|
|
||||||
}
|
|
||||||
|
|
||||||
Verbose("Render finished");
|
Verbose("Render finished");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ StaPipQBufferRenderer::StaPipQBufferRenderer() {
|
|||||||
|
|
||||||
void StaPipQBufferRenderer::allocateOnUse() {
|
void StaPipQBufferRenderer::allocateOnUse() {
|
||||||
staticDataPacket = packet2_create(3, P2_TYPE_NORMAL, P2_MODE_CHAIN, true);
|
staticDataPacket = packet2_create(3, P2_TYPE_NORMAL, P2_MODE_CHAIN, true);
|
||||||
objectDataPacket = packet2_create(16, P2_TYPE_NORMAL, P2_MODE_CHAIN, true);
|
objectDataPacket = packet2_create(20, P2_TYPE_NORMAL, P2_MODE_CHAIN, true);
|
||||||
|
|
||||||
packets = new packet2_t*[2];
|
packets = new packet2_t*[2];
|
||||||
for (u16 i = 0; i < 2; i++)
|
for (u16 i = 0; i < 2; i++)
|
||||||
@@ -149,6 +149,19 @@ void StaPipQBufferRenderer::sendObjectData(
|
|||||||
|
|
||||||
packet2_utils_gs_add_lod(objectDataPacket, lod);
|
packet2_utils_gs_add_lod(objectDataPacket, lod);
|
||||||
|
|
||||||
|
if (bag->info->zTestType == PipelineZTest_AllPass) {
|
||||||
|
packet2_add_2x_s64(objectDataPacket,
|
||||||
|
GS_SET_TEST(0, 0, 0, 0, 0, 0, 0, ZTEST_METHOD_ALLPASS),
|
||||||
|
GS_REG_TEST);
|
||||||
|
} else {
|
||||||
|
packet2_add_2x_s64(
|
||||||
|
objectDataPacket,
|
||||||
|
GS_SET_TEST(DRAW_ENABLE, ATEST_METHOD_NOTEQUAL, 0x00,
|
||||||
|
ATEST_KEEP_FRAMEBUFFER, DRAW_DISABLE, DRAW_DISABLE,
|
||||||
|
DRAW_ENABLE, rendererCore->gs.zBuffer.method),
|
||||||
|
GS_REG_TEST);
|
||||||
|
}
|
||||||
|
|
||||||
if (texBuffers != nullptr) {
|
if (texBuffers != nullptr) {
|
||||||
rendererCore->texture.updateClutBuffer(texBuffers->clut);
|
rendererCore->texture.updateClutBuffer(texBuffers->clut);
|
||||||
|
|
||||||
@@ -209,7 +222,7 @@ void StaPipQBufferRenderer::uploadPrograms() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void StaPipQBufferRenderer::setDoubleBuffer() {
|
void StaPipQBufferRenderer::setDoubleBuffer() {
|
||||||
u16 startingAddr = VU1_LAST_ITEM_ADDR + 1;
|
u16 startingAddr = VU1_STAPIP_LAST_ITEM_ADDR + 1;
|
||||||
const u16 bufferMaxSize = 1000;
|
const u16 bufferMaxSize = 1000;
|
||||||
bufferSize = (bufferMaxSize - startingAddr) / 2;
|
bufferSize = (bufferMaxSize - startingAddr) / 2;
|
||||||
|
|
||||||
@@ -347,12 +360,13 @@ void StaPipQBufferRenderer::addBuffersDataToPacket(const u32& from,
|
|||||||
|
|
||||||
void StaPipQBufferRenderer::sendPacket() {
|
void StaPipQBufferRenderer::sendPacket() {
|
||||||
auto* currentPacket = packets[context];
|
auto* currentPacket = packets[context];
|
||||||
dma_channel_wait(DMA_CHANNEL_VIF1, 0);
|
|
||||||
dma_channel_send_packet2(currentPacket, DMA_CHANNEL_VIF1, true);
|
|
||||||
|
|
||||||
TYRA_ASSERT(packet2_get_qw_count(currentPacket) <= qbuffersPacketSize,
|
TYRA_ASSERT(packet2_get_qw_count(currentPacket) <= qbuffersPacketSize,
|
||||||
"Packet is too big. Internal error");
|
"Packet is too big. Internal error");
|
||||||
|
|
||||||
|
dma_channel_wait(DMA_CHANNEL_VIF1, 0);
|
||||||
|
dma_channel_send_packet2(currentPacket, DMA_CHANNEL_VIF1, true);
|
||||||
|
|
||||||
// Switch packet, so we can proceed during DMA transfer
|
// Switch packet, so we can proceed during DMA transfer
|
||||||
context = !context;
|
context = !context;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,9 +63,9 @@ void StaPipVU1Program::addStandardBufferDataToPacket(packet2_t* packet,
|
|||||||
|
|
||||||
u16 StaPipVU1Program::getMaxVertCount(const bool& singleColorEnabled,
|
u16 StaPipVU1Program::getMaxVertCount(const bool& singleColorEnabled,
|
||||||
const u16& bufferSize) const {
|
const u16& bufferSize) const {
|
||||||
u16 res = bufferSize - 4;
|
u16 res = bufferSize - 7; // 7 because of -> StoreTyraGifTags{}
|
||||||
u8 colorElementsPerVertex =
|
u8 colorElementsPerVertex =
|
||||||
singleColorEnabled ? (elementsPerVertex - 1) : elementsPerVertex;
|
singleColorEnabled ? elementsPerVertex - 1 : elementsPerVertex;
|
||||||
res /= (colorElementsPerVertex + reglistCount);
|
res /= (colorElementsPerVertex + reglistCount);
|
||||||
|
|
||||||
// Buffer size = VU1 double buffer size (xtop)
|
// Buffer size = VU1 double buffer size (xtop)
|
||||||
|
|||||||
@@ -14,10 +14,7 @@
|
|||||||
#include <graph.h>
|
#include <graph.h>
|
||||||
#include <gs_privileged.h>
|
#include <gs_privileged.h>
|
||||||
#include <gs_psm.h>
|
#include <gs_psm.h>
|
||||||
#include <packet2.h>
|
|
||||||
#include <packet2_utils.h>
|
#include <packet2_utils.h>
|
||||||
#include <packet2_chain.h>
|
|
||||||
#include <packet2_types.h>
|
|
||||||
#include "debug/debug.hpp"
|
#include "debug/debug.hpp"
|
||||||
#include "renderer/core/gs/renderer_core_gs.hpp"
|
#include "renderer/core/gs/renderer_core_gs.hpp"
|
||||||
|
|
||||||
@@ -42,7 +39,7 @@ void RendererCoreGS::init(RendererSettings* t_settings) {
|
|||||||
|
|
||||||
initChannels();
|
initChannels();
|
||||||
flipPacket = packet2_create(4, P2_TYPE_UNCACHED_ACCL, P2_MODE_NORMAL, 0);
|
flipPacket = packet2_create(4, P2_TYPE_UNCACHED_ACCL, P2_MODE_NORMAL, 0);
|
||||||
zTestPacket = packet2_create(3, P2_TYPE_NORMAL, P2_MODE_NORMAL, 0);
|
zTestPacket = packet2_create(8, P2_TYPE_NORMAL, P2_MODE_NORMAL, 0);
|
||||||
allocateBuffers();
|
allocateBuffers();
|
||||||
initDrawingEnvironment();
|
initDrawingEnvironment();
|
||||||
|
|
||||||
@@ -53,21 +50,6 @@ void RendererCoreGS::initChannels() {
|
|||||||
dma_channel_initialize(DMA_CHANNEL_GIF, NULL, 0);
|
dma_channel_initialize(DMA_CHANNEL_GIF, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RendererCoreGS::setStandardZTest() {
|
|
||||||
packet2_reset(zTestPacket, false);
|
|
||||||
packet2_update(zTestPacket,
|
|
||||||
draw_enable_tests(zTestPacket->base, 0, &zBuffer));
|
|
||||||
dma_channel_wait(DMA_CHANNEL_GIF, 0);
|
|
||||||
dma_channel_send_packet2(zTestPacket, DMA_CHANNEL_GIF, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RendererCoreGS::setAllPassZTest() {
|
|
||||||
packet2_reset(zTestPacket, false);
|
|
||||||
packet2_update(zTestPacket, addAllPassZTest(zTestPacket->base, 0, &zBuffer));
|
|
||||||
dma_channel_wait(DMA_CHANNEL_GIF, 0);
|
|
||||||
dma_channel_send_packet2(zTestPacket, DMA_CHANNEL_GIF, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RendererCoreGS::allocateBuffers() {
|
void RendererCoreGS::allocateBuffers() {
|
||||||
frameBuffers[0].width = static_cast<unsigned int>(settings->getWidth());
|
frameBuffers[0].width = static_cast<unsigned int>(settings->getWidth());
|
||||||
frameBuffers[0].height = static_cast<unsigned int>(settings->getHeight());
|
frameBuffers[0].height = static_cast<unsigned int>(settings->getHeight());
|
||||||
@@ -138,20 +120,6 @@ qword_t* RendererCoreGS::setXYOffset(qword_t* q, const int& drawContext,
|
|||||||
return q;
|
return q;
|
||||||
}
|
}
|
||||||
|
|
||||||
qword_t* RendererCoreGS::addAllPassZTest(qword_t* q, int context,
|
|
||||||
zbuffer_t* z) {
|
|
||||||
(void)z;
|
|
||||||
|
|
||||||
PACK_GIFTAG(q, GIF_SET_TAG(1, 0, 0, 0, GIF_FLG_PACKED, 1), GIF_REG_AD);
|
|
||||||
q++;
|
|
||||||
|
|
||||||
PACK_GIFTAG(q, GS_SET_TEST(0, 0, 0, 0, 0, 0, 0, ZTEST_METHOD_ALLPASS),
|
|
||||||
GS_REG_TEST + context);
|
|
||||||
q++;
|
|
||||||
|
|
||||||
return q;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RendererCoreGS::flipBuffers() {
|
void RendererCoreGS::flipBuffers() {
|
||||||
graph_set_framebuffer_filtered(frameBuffers[context].address,
|
graph_set_framebuffer_filtered(frameBuffers[context].address,
|
||||||
frameBuffers[context].width,
|
frameBuffers[context].width,
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ RendererCore::RendererCore() { isFrameLimitOn = true; }
|
|||||||
RendererCore::~RendererCore() {}
|
RendererCore::~RendererCore() {}
|
||||||
|
|
||||||
void RendererCore::init() {
|
void RendererCore::init() {
|
||||||
|
path3.init(&settings);
|
||||||
|
sync.init(&path3, &path1);
|
||||||
gs.init(&settings);
|
gs.init(&settings);
|
||||||
texture.init(&gs, &path3);
|
texture.init(&gs, &path3);
|
||||||
path3.init(&settings);
|
|
||||||
renderer3D.init(&settings, &path1);
|
renderer3D.init(&settings, &path1);
|
||||||
renderer2D.init(&settings, &texture.clut);
|
renderer2D.init(&settings, &texture.clut);
|
||||||
sync.init(&path3, &path1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RendererCore::setClearScreenColor(const Color& color) { bgColor = color; }
|
void RendererCore::setClearScreenColor(const Color& color) { bgColor = color; }
|
||||||
|
|||||||
@@ -13,13 +13,20 @@
|
|||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
|
|
||||||
|
timespec Threading::tv = {0, 0};
|
||||||
|
|
||||||
void Threading::sleep(const u32& ms) {
|
void Threading::sleep(const u32& ms) {
|
||||||
struct timespec tv = {0};
|
|
||||||
tv.tv_sec = ms / 1000;
|
tv.tv_sec = ms / 1000;
|
||||||
tv.tv_nsec = (ms % 1000) * 1000000;
|
tv.tv_nsec = (ms % 1000) * 1000000;
|
||||||
nanosleep(&tv, nullptr);
|
nanosleep(&tv, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Threading::switchThread() { sleep(1); }
|
void Threading::sleep(const timespec& t_tv) { nanosleep(&t_tv, nullptr); }
|
||||||
|
|
||||||
|
void Threading::switchThread() {
|
||||||
|
tv.tv_sec = 0;
|
||||||
|
tv.tv_nsec = 500000; // 1/2ms
|
||||||
|
nanosleep(&tv, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
} // Namespace Tyra
|
} // Namespace Tyra
|
||||||
@@ -29,6 +29,7 @@
|
|||||||
"defines": [
|
"defines": [
|
||||||
"_EE",
|
"_EE",
|
||||||
"_IOP",
|
"_IOP",
|
||||||
|
"__SPU__",
|
||||||
"INTELLISENSE"
|
"INTELLISENSE"
|
||||||
],
|
],
|
||||||
"cppStandard": "c++20",
|
"cppStandard": "c++20",
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
"dependsOn": [
|
"dependsOn": [
|
||||||
"1. Copy source code to docker volume"
|
"1. Copy source code to docker volume"
|
||||||
],
|
],
|
||||||
"command": "docker exec -t tyra-compiler sh -c 'adpenc ${input:wav2adpcmSource} ${input:wav2adpcmTarget} && rsync -zac /src/${input:wav2adpcmTarget} /host/${input:wav2adpcmTarget}'"
|
"command": "docker exec -t tyra-game-compiler sh -c 'adpenc ${input:wav2adpcmSource} ${input:wav2adpcmTarget} && rsync -zac /src/${input:wav2adpcmTarget} /host/${input:wav2adpcmTarget}'"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
@@ -88,6 +88,11 @@
|
|||||||
"type": "shell",
|
"type": "shell",
|
||||||
"label": "Stop docker container",
|
"label": "Stop docker container",
|
||||||
"command": "docker compose down"
|
"command": "docker compose down"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"label": "[Debug] Copy obj directory to host",
|
||||||
|
"command": "docker exec -t tyra-game-compiler sh -c 'rsync -zac --include=\"*/\" --include=\"obj/**\" --exclude=\"*\" /src/ /host/'"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"inputs": [
|
"inputs": [
|
||||||
|
|||||||
Reference in New Issue
Block a user