diff --git a/dependencies/egg-ps2-graphics-lib/Makefile.vuprogs b/dependencies/egg-ps2-graphics-lib/Makefile.vuprogs index abb11b2..0ba11e2 100644 --- a/dependencies/egg-ps2-graphics-lib/Makefile.vuprogs +++ b/dependencies/egg-ps2-graphics-lib/Makefile.vuprogs @@ -2,7 +2,6 @@ EE_DVP = dvp-as VCL = vcl RENDERERS = \ - vertex_color_renderer \ vertex_color_texture_renderer \ project \ project_clip \ diff --git a/dependencies/egg-ps2-graphics-lib/include/egg-ps2-graphics-lib/vu_programs.hpp b/dependencies/egg-ps2-graphics-lib/include/egg-ps2-graphics-lib/vu_programs.hpp index 8e2c5d1..c0fd62e 100644 --- a/dependencies/egg-ps2-graphics-lib/include/egg-ps2-graphics-lib/vu_programs.hpp +++ b/dependencies/egg-ps2-graphics-lib/include/egg-ps2-graphics-lib/vu_programs.hpp @@ -65,7 +65,6 @@ namespace egg::ps2::graphics::vu1_programs { DECLARE_VU_PROGRAM(xgkick); DECLARE_VU_PROGRAM(vertex_color_texture_renderer); -DECLARE_VU_PROGRAM(vertex_color_renderer); DECLARE_VU_PROGRAM(project); DECLARE_VU_PROGRAM(project_clip); DECLARE_VU_PROGRAM(vertex_color); diff --git a/dependencies/egg-ps2-graphics-lib/src/vu_programs.cc b/dependencies/egg-ps2-graphics-lib/src/vu_programs.cc index f334757..1f8075b 100644 --- a/dependencies/egg-ps2-graphics-lib/src/vu_programs.cc +++ b/dependencies/egg-ps2-graphics-lib/src/vu_programs.cc @@ -21,7 +21,6 @@ namespace vu1_programs { DEFINE_VU_PROGRAM(xgkick, xgkick); DEFINE_VU_PROGRAM(vertex_color_texture_renderer, VertexColorTextureRenderer); -DEFINE_VU_PROGRAM(vertex_color_renderer, VertexColorRenderer); DEFINE_VU_PROGRAM(project, Project); DEFINE_VU_PROGRAM(project_clip, ProjectClip); DEFINE_VU_PROGRAM(vertex_color, VertexColor); diff --git a/dependencies/egg-ps2-graphics-lib/vu1/vertex_color_renderer.vcl b/dependencies/egg-ps2-graphics-lib/vu1/vertex_color_renderer.vcl deleted file mode 100644 index 9ff89ca..0000000 --- a/dependencies/egg-ps2-graphics-lib/vu1/vertex_color_renderer.vcl +++ /dev/null @@ -1,141 +0,0 @@ -#include "vu1_defs.h" - -.syntax new -.name vsmVertexColorRenderer -.vu -.init_vf_all -.init_vi_all - ---enter ---endenter - - ;///////////////////////////////////////////// - - fcset 0x000000 ; VCL wont let us use CLIP without first zeroing - ; the clip flags - - - ;//////////// --- Load data --- ///////////// - ; Updated dynamically - xtop iBase - - lq matrixRow0, MATRIXROW0(iBase) ; load view-projection matrix - lq matrixRow1, MATRIXROW1(iBase) - lq matrixRow2, MATRIXROW2(iBase) - lq matrixRow3, MATRIXROW3(iBase) - - lq.xyz scale, SCALE(iBase) ; load program params - ; float : X, Y, Z - scale vector that we will use to scale the verts after projecting them. - ; float : W - vert count. - ilw.w vertCount, SCALE(iBase) - lq primTag, PRIMTAG(iBase) ; GIF tag - tell GS how many data we will send and what type - lq rgba, RGBA(iBase) ; RGBA mul - ; u32 : R, G, B, A (0-128) - - lq fogSetting, FOG(iBase) ; x = offset, y = scale - - iaddiu vertexPtr, iBase, VERTEXIN ; pointer to vertex data - iadd colorPtr, vertexPtr, vertCount ; pointer to color data - iadd kickAddress, colorPtr, vertCount ; pointer for XGKICK - iadd destAddress, colorPtr, vertCount ; helper pointer for data inserting - ;//////////////////////////////////////////// - - ;/////////// --- Store tags --- ///////////// - sqi primTag, (destAddress++) ; prim + tell gs how many data will be - ;//////////////////////////////////////////// - - ;/////////////// --- Loop --- /////////////// - iadd vertexCounter, iBase, vertCount ; loop vertCount times - vertexLoop: - - ;////////// --- Load loop data --- ////////// - lq.xyz vertex, 0(vertexPtr) ; load xyz - ; float : X, Y, Z - ; any32 : _ = 0 - - lq.xyzw color, 0(colorPtr) - - ;////////////// --- Color --- ////////////// - ; Color in the model is from 0-1, we need to convert it to 0-255 fixed point - loi 255.0 - muli.xyzw color, color, i - ftoi0.xyzw color, color - - - ;////////////// --- Vertex --- ////////////// - mul acc, matrixRow0, vertex[x] - madd acc, matrixRow1, vertex[y] - madd acc, matrixRow2, vertex[z] - madd vertex, matrixRow3, vf00[w] - - ; Clipping - clipw.xyz vertex, vertex ; Dr. Fortuna: This instruction checks if the vertex is outside - ; the viewing frustum. If it is, then the appropriate - ; clipping flags are set - fcand VI01, 0x3FFFF ; Bitwise AND the clipping flags with 0x3FFFF, this makes - ; sure that we get the clipping judgement for the last three - ; verts (i.e. that make up the triangle we are about to draw) - iaddiu adcBit, VI01, 0x7FFF ; Add 0x7FFF. If any of the clipping flags were set this will - ; cause the triangle not to be drawn (any values above 0x8000 - ; that are stored in the w component of XYZ2 will set the ADC - ; bit, which tells the GS not to perform a drawing kick on this - ; triangle. - - ; Fog mask (why is this like this? strange...) - iaddiu fogMask, vi00, 0x7fff - iaddiu fogMask, fogMask, 1 - iand adcBit, fogMask, adcBit - - - ; Perspective divide - div q, vf00[w], vertex[w] ; perspective divide (1/vert[w]): - mul.xyz vertex, vertex, q - - - ; Fog - muly.w fog, vertex, fogSetting ; multiply the vertexs z by the fog scale (fogSetting[y]) - addx.w fog, fog, fogSetting ; add the fog start offset (fogSetting[x]) - - ; Clamp fog from 0-255 - loi 255.0 - minii.w fog, fog, i - maxx.w fog, fog, vf00 - - ; Convert the fog to an integer, move it to an integer register (fogColor) - ftoi4.w fog, fog - mtir fogColor, fog[w] - - ; Combine clipping + fog settings - ior adcBit, adcBit, fogColor - - - - ; Scale to screen space - mula.xyz acc, scale, vf00[w] ; scale to GS screen space - madd.xyz vertex, vertex, scale ; multiply and add the scales -> vert = vert * scale + scale - ftoi4.xyz vertex, vertex ; convert vertex to 12:4 fixed point format - - ; Add clipping bit - mfir.w vertex, adcBit - - - ;//////////// --- Store data --- //////////// - sq.xyzw color, 0(destAddress) - sq.xyzw vertex, 1(destAddress) ; XYZ2F - ;//////////////////////////////////////////// - - iaddiu colorPtr, colorPtr, 1 - iaddiu vertexPtr, vertexPtr, 1 - iaddiu destAddress, destAddress, 2 - - iaddi vertexCounter, vertexCounter, -1 ; decrement the loop counter - ibne vertexCounter, iBase, vertexLoop ; and repeat if needed - - ;//////////////////////////////////////////// - - --barrier - - xgkick kickAddress ; dispatch to the GS rasterizer. - ---exit ---endexit \ No newline at end of file diff --git a/dependencies/egg-ps2-graphics-lib/vu1/vu1_defs.h b/dependencies/egg-ps2-graphics-lib/vu1/vu1_defs.h index 91d43cd..6e64bf0 100644 --- a/dependencies/egg-ps2-graphics-lib/vu1/vu1_defs.h +++ b/dependencies/egg-ps2-graphics-lib/vu1/vu1_defs.h @@ -17,11 +17,11 @@ #define VERTEXIN (JUMPTABLE + 2) +#define BASE_REG VI14 + // Return address register. // Used for returning from programs back to the jump table -#define RETADDR_REG VI13 - -#define BASE_REG VI12 +#define RETADDR_REG VI15 #define RETURN jr retaddr: dummy diff --git a/src/renderer/gs.cc b/src/renderer/gs.cc index f1eeef9..eedfa6c 100644 --- a/src/renderer/gs.cc +++ b/src/renderer/gs.cc @@ -91,10 +91,6 @@ void init() epg::init(gs_options); - // Load vertex color + textured vertex color programs - epg::vu1_programs::get_vertex_color_renderer().load_program(); - epg::vu1_programs::get_vertex_color_texture_renderer().load_program(); - epg::gs_mem::allocate_texture_slot(1); epg::gs_mem::allocate_texture_slot(1); epg::gs_mem::allocate_texture_slot(1);