z test patch
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
"defines": [
|
||||
"_EE",
|
||||
"_IOP",
|
||||
"__SPU__",
|
||||
"INTELLISENSE"
|
||||
],
|
||||
"cppStandard": "c++20",
|
||||
|
||||
@@ -83,6 +83,11 @@
|
||||
"type": "shell",
|
||||
"label": "Stop docker container",
|
||||
"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": [
|
||||
|
||||
@@ -53,7 +53,7 @@ void Skybox::allocateOptions() {
|
||||
options = new StaPipOptions();
|
||||
options->frustumCulling = Tyra::PipelineFrustumCulling_None;
|
||||
options->shadingType = Tyra::TyraShadingGouraud;
|
||||
options->zTestType = Tyra::StaPipZTest_AllPass;
|
||||
options->zTestType = Tyra::PipelineZTest_AllPass;
|
||||
options->textureMappingType = Tyra::TyraNearest;
|
||||
options->blendingEnabled = true;
|
||||
options->antiAliasingEnabled = false;
|
||||
|
||||
@@ -23,24 +23,22 @@ Terrain::Terrain(TextureRepository* repo)
|
||||
Vec4(-750.0F, 0.0F, -1400.0F, 1.0F), // Left up
|
||||
Vec4(920.0F, 0.0F, 1520.0F, 1.0F) // Right down
|
||||
) {
|
||||
ObjLoader loader;
|
||||
// ObjLoader loader;
|
||||
|
||||
ObjLoaderOptions objOptions;
|
||||
objOptions.flipUVs = true;
|
||||
objOptions.scale = 100.0F;
|
||||
// ObjLoaderOptions objOptions;
|
||||
// objOptions.flipUVs = true;
|
||||
// objOptions.scale = 100.0F;
|
||||
|
||||
auto* data = loader.load(
|
||||
FileUtils::fromCwd("game/models/terrain/terrain.obj"), objOptions);
|
||||
data->normalsEnabled = false;
|
||||
mesh = new StaticMesh(*data);
|
||||
// auto* data = loader.load(
|
||||
// FileUtils::fromCwd("game/models/terrain/terrain.obj"), objOptions);
|
||||
// data->normalsEnabled = false;
|
||||
// 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");
|
||||
|
||||
allocateOptions();
|
||||
|
||||
pair = new RendererStaticPair{mesh, options};
|
||||
// pair = new RendererStaticPair{mesh, options};
|
||||
}
|
||||
|
||||
float Terrain::getHeightOffset(const Vec4& playerPosition) {
|
||||
|
||||
@@ -14,11 +14,12 @@
|
||||
#define VU1_SINGLE_COLOR_ADDR 7
|
||||
#define VU1_OPTIONS_ADDR 8
|
||||
#define VU1_LOD_ADDR 9
|
||||
#define VU1_CLUT_ADDR 10
|
||||
#define VU1_LIGHTS_DIRS_ADDR 11
|
||||
#define VU1_LIGHTS_COLORS_ADDR 14
|
||||
#define VU1_SET_GIFTAG_ADDR 18
|
||||
#define VU1_LAST_ITEM_ADDR 18
|
||||
#define VU1_Z_TESTS_ADDR 10
|
||||
#define VU1_CLUT_ADDR 11
|
||||
#define VU1_LIGHTS_DIRS_ADDR 12
|
||||
#define VU1_LIGHTS_COLORS_ADDR 15
|
||||
#define VU1_SET_GIFTAG_ADDR 19
|
||||
#define VU1_DYNPIP_LAST_ITEM_ADDR 19
|
||||
|
||||
// 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_texture_mapping_type.hpp"
|
||||
#include "../pipeline_transformation_type.hpp"
|
||||
#include "../pipeline_z_test.hpp"
|
||||
#include "./pipeline_info_bag_frustum_culling.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
@@ -30,6 +31,7 @@ class PipelineInfoBag {
|
||||
antiAliasingEnabled = false;
|
||||
model = nullptr;
|
||||
frustumCulling = PipelineInfoBagFrustumCulling_None;
|
||||
zTestType = PipelineZTest_Standard;
|
||||
}
|
||||
~PipelineInfoBag() {}
|
||||
|
||||
@@ -51,6 +53,9 @@ class PipelineInfoBag {
|
||||
/** Anti-aliasing */
|
||||
bool antiAliasingEnabled;
|
||||
|
||||
/** Type of z buffer testing. */
|
||||
PipelineZTest zTestType;
|
||||
|
||||
/** Type of frustum culling */
|
||||
PipelineInfoBagFrustumCulling frustumCulling;
|
||||
};
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "../shared/pipeline_lighting_options.hpp"
|
||||
#include "../shared/pipeline_texture_mapping_type.hpp"
|
||||
#include "../shared/pipeline_transformation_type.hpp"
|
||||
#include "../shared/pipeline_z_test.hpp"
|
||||
#include "./pipeline_frustum_culling.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
@@ -27,6 +28,7 @@ class PipelineOptions {
|
||||
shadingType = TyraShadingFlat;
|
||||
textureMappingType = TyraLinear;
|
||||
transformationType = TyraMVP;
|
||||
zTestType = PipelineZTest_Standard;
|
||||
}
|
||||
~PipelineOptions() {}
|
||||
|
||||
@@ -45,6 +47,9 @@ class PipelineOptions {
|
||||
/** Anti-aliasing */
|
||||
bool antiAliasingEnabled;
|
||||
|
||||
/** Type of z-buffer testing. */
|
||||
PipelineZTest zTestType;
|
||||
|
||||
/** Multiply by model matrix by view-projection or projection matrix */
|
||||
PipelineTransformationType transformationType;
|
||||
|
||||
|
||||
+3
-3
@@ -12,9 +12,9 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
enum StaPipZTest {
|
||||
StaPipZTest_Standard = 0,
|
||||
StaPipZTest_AllPass = 1,
|
||||
enum PipelineZTest {
|
||||
PipelineZTest_Standard = 0,
|
||||
PipelineZTest_AllPass = 1,
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
@@ -11,16 +11,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "renderer/3d/pipeline/shared/bag/pipeline_info_bag.hpp"
|
||||
#include "renderer/3d/pipeline/static/stapip_ztest.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class StaPipInfoBag : public PipelineInfoBag {
|
||||
public:
|
||||
StaPipInfoBag() {
|
||||
fullClipChecks = false;
|
||||
zTestType = StaPipZTest_Standard;
|
||||
}
|
||||
StaPipInfoBag() { fullClipChecks = false; }
|
||||
~StaPipInfoBag() {}
|
||||
|
||||
/**
|
||||
@@ -33,9 +29,6 @@ class StaPipInfoBag : public PipelineInfoBag {
|
||||
* Force enabled in dynamic pipe, because of efficiency.
|
||||
*/
|
||||
bool fullClipChecks;
|
||||
|
||||
/** @brief Type of z buffer testing. */
|
||||
StaPipZTest zTestType;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
@@ -14,11 +14,12 @@
|
||||
#define VU1_SINGLE_COLOR_ADDR 7
|
||||
#define VU1_OPTIONS_ADDR 8
|
||||
#define VU1_LOD_ADDR 9
|
||||
#define VU1_CLUT_ADDR 10
|
||||
#define VU1_LIGHTS_DIRS_ADDR 11
|
||||
#define VU1_LIGHTS_COLORS_ADDR 14
|
||||
#define VU1_SET_GIFTAG_ADDR 18
|
||||
#define VU1_LAST_ITEM_ADDR 18
|
||||
#define VU1_Z_TESTS_ADDR 10
|
||||
#define VU1_CLUT_ADDR 11
|
||||
#define VU1_LIGHTS_DIRS_ADDR 12
|
||||
#define VU1_LIGHTS_COLORS_ADDR 15
|
||||
#define VU1_SET_GIFTAG_ADDR 19
|
||||
#define VU1_STAPIP_LAST_ITEM_ADDR 19
|
||||
|
||||
// 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_packager.hpp"
|
||||
#include "./stapip_qbuffer_renderer.hpp"
|
||||
#include "../stapip_ztest.hpp"
|
||||
#include "renderer/3d/pipeline/shared/pipeline_frustum_culling.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
@@ -11,21 +11,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "renderer/3d/pipeline/shared/pipeline_options.hpp"
|
||||
#include "./stapip_ztest.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class StaPipOptions : public PipelineOptions {
|
||||
public:
|
||||
StaPipOptions() {
|
||||
fullClipChecks = false;
|
||||
zTestType = StaPipZTest_Standard;
|
||||
}
|
||||
StaPipOptions() { fullClipChecks = false; }
|
||||
~StaPipOptions() {}
|
||||
|
||||
/** @brief Type of z buffer testing. */
|
||||
StaPipZTest zTestType;
|
||||
|
||||
/**
|
||||
* @brief Experimental! True -> enables "clip against each plane" algorithm.
|
||||
* Mandatory, default: False.
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "renderer/renderer_settings.hpp"
|
||||
#include "./renderer_core_gs_vram.hpp"
|
||||
#include "../renderer_core_sync.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
@@ -27,10 +28,6 @@ class RendererCoreGS {
|
||||
|
||||
void flipBuffers();
|
||||
|
||||
void setStandardZTest();
|
||||
|
||||
void setAllPassZTest();
|
||||
|
||||
private:
|
||||
constexpr static float gsCenter = 4096.0F;
|
||||
constexpr static float screenCenter = gsCenter / 2.0F;
|
||||
@@ -48,7 +45,6 @@ class RendererCoreGS {
|
||||
void updateCurrentField();
|
||||
qword_t* setXYOffset(qword_t* q, const int& drawContext, const float& x,
|
||||
const float& y);
|
||||
qword_t* addAllPassZTest(qword_t* q, int context, zbuffer_t* z);
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <tamtypes.h>
|
||||
#include <time.h>
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
@@ -20,8 +21,12 @@ class Threading {
|
||||
~Threading();
|
||||
|
||||
static void sleep(const u32& ms);
|
||||
static void sleep(const timespec& tv);
|
||||
|
||||
static void switchThread();
|
||||
|
||||
private:
|
||||
static timespec tv;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
@@ -28,7 +28,7 @@ DynPipRenderer::~DynPipRenderer() {
|
||||
|
||||
void DynPipRenderer::allocateOnUse(const u32& t_packetSize) {
|
||||
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;
|
||||
|
||||
@@ -129,6 +129,19 @@ void DynPipRenderer::sendObjectData(
|
||||
|
||||
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) {
|
||||
rendererCore->texture.updateClutBuffer(texBuffers->clut);
|
||||
|
||||
@@ -195,7 +208,7 @@ void DynPipRenderer::uploadPrograms() {
|
||||
}
|
||||
|
||||
void DynPipRenderer::setDoubleBuffer() {
|
||||
u16 startingAddr = VU1_LAST_ITEM_ADDR + 1;
|
||||
u16 startingAddr = VU1_DYNPIP_LAST_ITEM_ADDR + 1;
|
||||
const u16 bufferMaxSize = 1000;
|
||||
bufferSize = (bufferMaxSize - startingAddr) / 2;
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ void DynPipVU1Program::addStandardBufferDataToPacket(packet2_t* packet,
|
||||
}
|
||||
|
||||
u16 DynPipVU1Program::getMaxVertCount(const u16& bufferSize) const {
|
||||
u16 res = bufferSize - 4;
|
||||
u16 res = bufferSize - 7; // 7 because of -> StoreTyraGifTags{}
|
||||
res /= (elementsPerVertex + reglistCount);
|
||||
|
||||
// Buffer size = VU1 double buffer size (xtop)
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
MatrixLoad{ mvp, VU1_MVP_MATRIX_ADDR, vi00 }
|
||||
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 }
|
||||
|
||||
begin:
|
||||
@@ -43,13 +43,13 @@ begin:
|
||||
LoadTyraPrimTag{ primTag, 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 destAddress, kickAddress, vertexCount
|
||||
iadd kickAddress, kickAddress, vertexCount
|
||||
|
||||
StoreTyraGifTags{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, destAddress }
|
||||
StoreTyraGifTags{ gifSetTag, lodGifTag, primTag, testsTag, destAddress }
|
||||
LoadTyraLerpValue{ interp, VU1_OPTIONS_ADDR }
|
||||
LoadTyraScaleValue{ scale, buffer }
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ std::string DynPipCVU1Program::getStringName() const {
|
||||
|
||||
void DynPipCVU1Program::addProgramQBufferDataToPacket(packet2_t* packet,
|
||||
DynPipBag* bag) const {
|
||||
u32 addr = VU1_VERT_DATA_ADDR;
|
||||
u32 addr = VU1_DYNPIP_VERT_DATA_ADDR;
|
||||
|
||||
// Add vertices
|
||||
packet2_utils_vu_add_unpack_data(packet, addr, bag->verticesFrom, bag->count,
|
||||
|
||||
@@ -34,14 +34,14 @@
|
||||
ResetClipFlags{ }
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
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:
|
||||
xtop buffer
|
||||
LoadTyraPrimTag{ primTag, 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, normalDataFrom, vertexCount
|
||||
@@ -50,7 +50,7 @@ begin:
|
||||
iadd destAddress, kickAddress, vertexCount
|
||||
iadd kickAddress, kickAddress, vertexCount
|
||||
|
||||
StoreTyraGifTags{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, destAddress }
|
||||
StoreTyraGifTags{ gifSetTag, lodGifTag, primTag, testsTag, destAddress }
|
||||
LoadTyraLerpValue{ interp, VU1_OPTIONS_ADDR }
|
||||
LoadTyraScaleValue{ scale, buffer }
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ std::string DynPipDVU1Program::getStringName() const {
|
||||
|
||||
void DynPipDVU1Program::addProgramQBufferDataToPacket(packet2_t* packet,
|
||||
DynPipBag* bag) const {
|
||||
u32 addr = VU1_VERT_DATA_ADDR;
|
||||
u32 addr = VU1_DYNPIP_VERT_DATA_ADDR;
|
||||
|
||||
// Add vertices
|
||||
packet2_utils_vu_add_unpack_data(packet, addr, bag->verticesFrom, bag->count,
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
MatrixLoad{ mvp, VU1_MVP_MATRIX_ADDR, vi00 }
|
||||
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 }
|
||||
|
||||
begin:
|
||||
@@ -44,7 +44,7 @@ begin:
|
||||
LoadTyraPrimTag{ primTag, 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, stqDataFrom, vertexCount
|
||||
@@ -53,7 +53,7 @@ begin:
|
||||
iadd destAddress, kickAddress, vertexCount
|
||||
iadd kickAddress, kickAddress, vertexCount
|
||||
|
||||
StoreTyraGifTags{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, destAddress }
|
||||
StoreTyraGifTagsTexture{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, testsTag, destAddress }
|
||||
LoadTyraLerpValue{ interp, VU1_OPTIONS_ADDR }
|
||||
LoadTyraScaleValue{ scale, buffer }
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ std::string DynPipTCVU1Program::getStringName() const {
|
||||
|
||||
void DynPipTCVU1Program::addProgramQBufferDataToPacket(packet2_t* packet,
|
||||
DynPipBag* bag) const {
|
||||
u32 addr = VU1_VERT_DATA_ADDR;
|
||||
u32 addr = VU1_DYNPIP_VERT_DATA_ADDR;
|
||||
|
||||
// Add vertices
|
||||
packet2_utils_vu_add_unpack_data(packet, addr, bag->verticesFrom, bag->count,
|
||||
|
||||
@@ -35,14 +35,14 @@
|
||||
ResetClipFlags{ }
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
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:
|
||||
xtop buffer
|
||||
LoadTyraPrimTag{ primTag, 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, stqDataFrom, vertexCount
|
||||
@@ -54,7 +54,7 @@ begin:
|
||||
iadd destAddress, kickAddress, vertexCount
|
||||
iadd kickAddress, kickAddress, vertexCount
|
||||
|
||||
StoreTyraGifTags{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, destAddress }
|
||||
StoreTyraGifTagsTexture{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, testsTag, destAddress }
|
||||
LoadTyraLerpValue{ interp, VU1_OPTIONS_ADDR }
|
||||
LoadTyraScaleValue{ scale, buffer }
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ std::string DynPipTDVU1Program::getStringName() const {
|
||||
|
||||
void DynPipTDVU1Program::addProgramQBufferDataToPacket(packet2_t* packet,
|
||||
DynPipBag* bag) const {
|
||||
u32 addr = VU1_VERT_DATA_ADDR;
|
||||
u32 addr = VU1_DYNPIP_VERT_DATA_ADDR;
|
||||
|
||||
// Add vertices
|
||||
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->textureMappingType = options->textureMappingType;
|
||||
result->transformationType = options->transformationType;
|
||||
result->zTestType = options->zTestType;
|
||||
result->frustumCulling =
|
||||
options->frustumCulling == PipelineFrustumCulling_Precise
|
||||
? PipelineInfoBagFrustumCulling_Precise
|
||||
|
||||
@@ -17,6 +17,9 @@ BlockizerProgramsManager::BlockizerProgramsManager() {
|
||||
context = 0;
|
||||
vu1BlockData = BlockNotUploaded;
|
||||
|
||||
dma_channel_initialize(DMA_CHANNEL_VIF1, NULL, 0);
|
||||
dma_channel_fast_waits(DMA_CHANNEL_VIF1);
|
||||
|
||||
setProgramsCache();
|
||||
}
|
||||
|
||||
|
||||
@@ -34,13 +34,25 @@
|
||||
;//---------------------------------------------------------
|
||||
;// LoadTyraTags - Load lod, texture buffer and clut
|
||||
;// 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_testsGifTag, t_testsAddr(vi00)
|
||||
lq t_texBufferClutGifTag, t_ClutAddr(vi00)
|
||||
#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
|
||||
;// 2 - GIF tag - tell GS how many data we will send
|
||||
@@ -77,17 +89,33 @@
|
||||
lq.xyz t_ambientColor, t_colorOffset+3(vi00)
|
||||
#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.
|
||||
;// Not using sqi instruction, because VCL cannot optimize it.
|
||||
;// 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_lodGifTag, 1(t_destAddress)
|
||||
sq t_testsTag, 1(t_destAddress)
|
||||
sq t_gifSetTag, 2(t_destAddress)
|
||||
sq t_texBufferClutGifTag, 3(t_destAddress)
|
||||
sq t_primTag, 4(t_destAddress)
|
||||
sq t_lodGifTag, 3(t_destAddress)
|
||||
sq t_primTag, 6(t_destAddress)
|
||||
iaddiu t_destAddress, t_destAddress, 5
|
||||
#endmacro
|
||||
|
||||
|
||||
@@ -32,13 +32,13 @@
|
||||
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
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:
|
||||
xtop 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)
|
||||
iadd colorData, vertexData, vertexCount
|
||||
iblez singleColorEnabled, setDestAddrMultiColor
|
||||
@@ -49,7 +49,7 @@ setDestAddrMultiColor:
|
||||
setDestAddr:
|
||||
iaddiu destAddress, kickAddress, 0
|
||||
|
||||
StoreTyraGifTags{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, destAddress }
|
||||
StoreTyraGifTags{ gifSetTag, lodGifTag, primTag, testsTag, destAddress }
|
||||
|
||||
;--- Loop
|
||||
iadd vertexCounter, buffer, vertexCount
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ std::string StaPipAsIsCVU1Program::getStringName() const {
|
||||
|
||||
void StaPipAsIsCVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||
u32 addr = VU1_VERT_DATA_ADDR;
|
||||
u32 addr = VU1_STAPIP_VERT_DATA_ADDR;
|
||||
|
||||
// Add vertices
|
||||
packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->vertices,
|
||||
|
||||
@@ -32,19 +32,19 @@
|
||||
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
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:
|
||||
xtop 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)
|
||||
iadd normalData, vertexData, vertexCount
|
||||
iadd kickAddress, normalData, vertexCount
|
||||
iadd destAddress, normalData, vertexCount
|
||||
|
||||
StoreTyraGifTags{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, destAddress }
|
||||
StoreTyraGifTags{ gifSetTag, lodGifTag, primTag, testsTag, destAddress }
|
||||
|
||||
;--- Loop
|
||||
iadd vertexCounter, buffer, vertexCount
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ std::string StaPipAsIsDVU1Program::getStringName() const {
|
||||
|
||||
void StaPipAsIsDVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||
u32 addr = VU1_VERT_DATA_ADDR;
|
||||
u32 addr = VU1_STAPIP_VERT_DATA_ADDR;
|
||||
|
||||
// Add vertices
|
||||
packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->vertices,
|
||||
|
||||
+3
-3
@@ -33,13 +33,13 @@
|
||||
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
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:
|
||||
xtop 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)
|
||||
iadd stqData, vertexData, vertexCount
|
||||
iadd colorData, stqData, vertexCount
|
||||
@@ -51,7 +51,7 @@ setDestAddrMultiColor:
|
||||
setDestAddr:
|
||||
iaddiu destAddress, kickAddress, 0
|
||||
|
||||
StoreTyraGifTags{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, destAddress }
|
||||
StoreTyraGifTagsTexture{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, testsTag, destAddress }
|
||||
|
||||
;--- Loop
|
||||
iadd vertexCounter, buffer, vertexCount
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ std::string StaPipAsIsTCVU1Program::getStringName() const {
|
||||
|
||||
void StaPipAsIsTCVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||
u32 addr = VU1_VERT_DATA_ADDR;
|
||||
u32 addr = VU1_STAPIP_VERT_DATA_ADDR;
|
||||
|
||||
// Add vertices
|
||||
packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->vertices,
|
||||
|
||||
+3
-3
@@ -33,20 +33,20 @@
|
||||
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
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:
|
||||
xtop 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)
|
||||
iadd stqData, vertexData, vertexCount
|
||||
iadd normalData, stqData, vertexCount
|
||||
iadd kickAddress, normalData, vertexCount
|
||||
iadd destAddress, normalData, vertexCount
|
||||
|
||||
StoreTyraGifTags{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, destAddress }
|
||||
StoreTyraGifTagsTexture{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, testsTag, destAddress }
|
||||
|
||||
;--- Loop
|
||||
iadd vertexCounter, buffer, vertexCount
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ std::string StaPipAsIsTDVU1Program::getStringName() const {
|
||||
|
||||
void StaPipAsIsTDVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||
u32 addr = VU1_VERT_DATA_ADDR;
|
||||
u32 addr = VU1_STAPIP_VERT_DATA_ADDR;
|
||||
|
||||
// Add vertices
|
||||
packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->vertices,
|
||||
|
||||
@@ -34,13 +34,13 @@
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
MatrixLoad{ mvp, VU1_MVP_MATRIX_ADDR, vi00 }
|
||||
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:
|
||||
xtop 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)
|
||||
iadd colorData, vertexData, vertexCount
|
||||
iblez singleColorEnabled, setDestAddrMultiColor
|
||||
@@ -51,7 +51,7 @@ setDestAddrMultiColor:
|
||||
setDestAddr:
|
||||
iaddiu destAddress, kickAddress, 0
|
||||
|
||||
StoreTyraGifTags{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, destAddress }
|
||||
StoreTyraGifTags{ gifSetTag, lodGifTag, primTag, testsTag, destAddress }
|
||||
|
||||
;--- Loop
|
||||
iadd vertexCounter, buffer, vertexCount
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ std::string StaPipCullCVU1Program::getStringName() const {
|
||||
|
||||
void StaPipCullCVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||
u32 addr = VU1_VERT_DATA_ADDR;
|
||||
u32 addr = VU1_STAPIP_VERT_DATA_ADDR;
|
||||
|
||||
// Add vertices
|
||||
packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->vertices,
|
||||
|
||||
@@ -34,19 +34,19 @@
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
MatrixLoad{ mvp, VU1_MVP_MATRIX_ADDR, vi00 }
|
||||
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:
|
||||
xtop 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)
|
||||
iadd normalData, vertexData, vertexCount
|
||||
iadd kickAddress, normalData, vertexCount
|
||||
iadd destAddress, normalData, vertexCount
|
||||
|
||||
StoreTyraGifTags{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, destAddress }
|
||||
StoreTyraGifTags{ gifSetTag, lodGifTag, primTag, testsTag, destAddress }
|
||||
|
||||
;--- Loop
|
||||
iadd vertexCounter, buffer, vertexCount
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ std::string StaPipCullDVU1Program::getStringName() const {
|
||||
|
||||
void StaPipCullDVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||
u32 addr = VU1_VERT_DATA_ADDR;
|
||||
u32 addr = VU1_STAPIP_VERT_DATA_ADDR;
|
||||
|
||||
// Add vertices
|
||||
packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->vertices,
|
||||
|
||||
@@ -35,13 +35,13 @@
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
MatrixLoad{ mvp, VU1_MVP_MATRIX_ADDR, vi00 }
|
||||
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:
|
||||
xtop 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)
|
||||
iadd stqData, vertexData, vertexCount
|
||||
iadd colorData, stqData, vertexCount
|
||||
@@ -53,7 +53,7 @@ setDestAddrMultiColor:
|
||||
setDestAddr:
|
||||
iaddiu destAddress, kickAddress, 0
|
||||
|
||||
StoreTyraGifTags{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, destAddress }
|
||||
StoreTyraGifTagsTexture{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, testsTag, destAddress }
|
||||
|
||||
;--- Loop
|
||||
iadd vertexCounter, buffer, vertexCount
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ std::string StaPipCullTCVU1Program::getStringName() const {
|
||||
|
||||
void StaPipCullTCVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||
u32 addr = VU1_VERT_DATA_ADDR;
|
||||
u32 addr = VU1_STAPIP_VERT_DATA_ADDR;
|
||||
|
||||
// Add vertices
|
||||
packet2_utils_vu_add_unpack_data(packet, addr, qbuffer->vertices,
|
||||
|
||||
@@ -35,20 +35,20 @@
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
MatrixLoad{ mvp, VU1_MVP_MATRIX_ADDR, vi00 }
|
||||
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:
|
||||
xtop 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)
|
||||
iadd stqData, vertexData, vertexCount
|
||||
iadd normalData, stqData, vertexCount
|
||||
iadd kickAddress, normalData, vertexCount
|
||||
iadd destAddress, normalData, vertexCount
|
||||
|
||||
StoreTyraGifTags{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, destAddress }
|
||||
StoreTyraGifTagsTexture{ gifSetTag, lodGifTag, texBufferClutGifTag, primTag, testsTag, destAddress }
|
||||
|
||||
;--- Loop
|
||||
iadd vertexCounter, buffer, vertexCount
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ std::string StaPipCullTDVU1Program::getStringName() const {
|
||||
|
||||
void StaPipCullTDVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||
u32 addr = VU1_VERT_DATA_ADDR;
|
||||
u32 addr = VU1_STAPIP_VERT_DATA_ADDR;
|
||||
|
||||
// Add 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);
|
||||
|
||||
M4x4 mvp;
|
||||
@@ -211,10 +207,6 @@ void StaPipCore::render(StaPipBag* bag, StaPipBagPackagesBBox* bbox) {
|
||||
|
||||
qbufferRenderer.flushBuffers();
|
||||
|
||||
if (bag->info->zTestType == StaPipZTest_AllPass) {
|
||||
rendererCore->gs.setStandardZTest();
|
||||
}
|
||||
|
||||
Verbose("Render finished");
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ StaPipQBufferRenderer::StaPipQBufferRenderer() {
|
||||
|
||||
void StaPipQBufferRenderer::allocateOnUse() {
|
||||
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];
|
||||
for (u16 i = 0; i < 2; i++)
|
||||
@@ -149,6 +149,19 @@ void StaPipQBufferRenderer::sendObjectData(
|
||||
|
||||
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) {
|
||||
rendererCore->texture.updateClutBuffer(texBuffers->clut);
|
||||
|
||||
@@ -209,7 +222,7 @@ void StaPipQBufferRenderer::uploadPrograms() {
|
||||
}
|
||||
|
||||
void StaPipQBufferRenderer::setDoubleBuffer() {
|
||||
u16 startingAddr = VU1_LAST_ITEM_ADDR + 1;
|
||||
u16 startingAddr = VU1_STAPIP_LAST_ITEM_ADDR + 1;
|
||||
const u16 bufferMaxSize = 1000;
|
||||
bufferSize = (bufferMaxSize - startingAddr) / 2;
|
||||
|
||||
@@ -347,12 +360,13 @@ void StaPipQBufferRenderer::addBuffersDataToPacket(const u32& from,
|
||||
|
||||
void StaPipQBufferRenderer::sendPacket() {
|
||||
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,
|
||||
"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
|
||||
context = !context;
|
||||
}
|
||||
|
||||
@@ -63,9 +63,9 @@ void StaPipVU1Program::addStandardBufferDataToPacket(packet2_t* packet,
|
||||
|
||||
u16 StaPipVU1Program::getMaxVertCount(const bool& singleColorEnabled,
|
||||
const u16& bufferSize) const {
|
||||
u16 res = bufferSize - 4;
|
||||
u16 res = bufferSize - 7; // 7 because of -> StoreTyraGifTags{}
|
||||
u8 colorElementsPerVertex =
|
||||
singleColorEnabled ? (elementsPerVertex - 1) : elementsPerVertex;
|
||||
singleColorEnabled ? elementsPerVertex - 1 : elementsPerVertex;
|
||||
res /= (colorElementsPerVertex + reglistCount);
|
||||
|
||||
// Buffer size = VU1 double buffer size (xtop)
|
||||
|
||||
@@ -14,10 +14,7 @@
|
||||
#include <graph.h>
|
||||
#include <gs_privileged.h>
|
||||
#include <gs_psm.h>
|
||||
#include <packet2.h>
|
||||
#include <packet2_utils.h>
|
||||
#include <packet2_chain.h>
|
||||
#include <packet2_types.h>
|
||||
#include "debug/debug.hpp"
|
||||
#include "renderer/core/gs/renderer_core_gs.hpp"
|
||||
|
||||
@@ -42,7 +39,7 @@ void RendererCoreGS::init(RendererSettings* t_settings) {
|
||||
|
||||
initChannels();
|
||||
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();
|
||||
initDrawingEnvironment();
|
||||
|
||||
@@ -53,21 +50,6 @@ void RendererCoreGS::initChannels() {
|
||||
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() {
|
||||
frameBuffers[0].width = static_cast<unsigned int>(settings->getWidth());
|
||||
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;
|
||||
}
|
||||
|
||||
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() {
|
||||
graph_set_framebuffer_filtered(frameBuffers[context].address,
|
||||
frameBuffers[context].width,
|
||||
|
||||
@@ -17,12 +17,12 @@ RendererCore::RendererCore() { isFrameLimitOn = true; }
|
||||
RendererCore::~RendererCore() {}
|
||||
|
||||
void RendererCore::init() {
|
||||
path3.init(&settings);
|
||||
sync.init(&path3, &path1);
|
||||
gs.init(&settings);
|
||||
texture.init(&gs, &path3);
|
||||
path3.init(&settings);
|
||||
renderer3D.init(&settings, &path1);
|
||||
renderer2D.init(&settings, &texture.clut);
|
||||
sync.init(&path3, &path1);
|
||||
}
|
||||
|
||||
void RendererCore::setClearScreenColor(const Color& color) { bgColor = color; }
|
||||
|
||||
@@ -13,13 +13,20 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
timespec Threading::tv = {0, 0};
|
||||
|
||||
void Threading::sleep(const u32& ms) {
|
||||
struct timespec tv = {0};
|
||||
tv.tv_sec = ms / 1000;
|
||||
tv.tv_nsec = (ms % 1000) * 1000000;
|
||||
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
|
||||
@@ -29,6 +29,7 @@
|
||||
"defines": [
|
||||
"_EE",
|
||||
"_IOP",
|
||||
"__SPU__",
|
||||
"INTELLISENSE"
|
||||
],
|
||||
"cppStandard": "c++20",
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
"dependsOn": [
|
||||
"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",
|
||||
@@ -88,6 +88,11 @@
|
||||
"type": "shell",
|
||||
"label": "Stop docker container",
|
||||
"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": [
|
||||
|
||||
Reference in New Issue
Block a user