//////////////////////////////////////////////////////////////////////////////
//
// Asura_PS2_BeamDefines.h
//
// Copyright (c) 2003 Rebellion. All rights reserved.
//
// Created by Pete Ellacott
//
// Changes:
//
//     (MP - 11.07.2003) Added clipping code.
//
// Description:
//
//     Renders laser beams and the like
//
//     The renderer assumes the camera count is in the range [1, 4].
//
// Memory layout:
//
//     Calculation of verts per packet:
//
//         Input buffer size    = 2(3N)
//         Output buffer size   = 2(4 + 3N)
//         Total IO buffer size = 6N + 8 + 6N
//                              = 8 + 12N
//
//         GIF tag buffer       = 2
//         Camera data buffers  = 2(2 + 3 * 4)
//                              = 28
//         Clipper work buffers = 2(9 * 3)
//                              = 54
//
//         Space for IO buffers = 1024 - (2 + 28 + 54)
//                              = 940
//
//         => N = (940 - 8) / 12 = 77
//
//     Hence:

//        0    /--------------------------\ 
//             |   camera setup GIF tag   |    1 QW  - GIF tag [ NLOOP 2, EOP 0, NREG 1, REG(S): A+D ]
//        1    |--------------------------|
//             |     tristrip GIF tag     |    1 QW  - GIF tag [ NOOP <from microcode>, EOP 1, NREG 3, REG(S): ST, RGBAQ, XYZ ]
//        2    |--------------------------|
//             |      camera buffer 0     |   14 QWs - W->S, W->C, C->S, SCISSOR, XYOFFSET
//       16    |--------------------------|
//             |      camera buffer 1     |   14 QWs - W->S, W->C, C->S, SCISSOR, XYOFFSET
//       30    |--------------------------|
//             |      input buffer 0      |  231 QWs - (XYZ, STQ, RGBA) x N
//      261    |--------------------------|
//             |      input buffer 1      |  231 QWs - (XYZ, STQ, RGBA) x N
//      492    |--------------------------|
//             |      output buffer 0     |  235 QWs - GIF tag, SCISSOR, XYOFFSET, GIF tag, (STQ, RGBAQ, XYZ) x N
//      727    |--------------------------|             
//             |      output buffer 1     |  235 QWs - GIF tag, SCISSOR, XYOFFSET, GIF tag, (STQ, RGBAQ, XYZ) x N
//      962    |--------------------------|
//             |   clipper work buffer 0  |   27 QWs - (XYZ, STQ, RGBA) * 9
//      989    |--------------------------|
//             |   clipper work buffer 1  |   27 QWs - (XYZ, STQ, RGBA) * 9
//     1016    |--------------------------|
//             |          unused          |    8 QWs
//     1024    \--------------------------/ 
//
//////////////////////////////////////////////////////////////////////////////

// B E G I N   F I L E   W R A P P E R ///////////////////////////////////////

#ifdef ASURA_USE_PRAGMA_ONCE
    #pragma once
#endif

#ifndef ___ASURA_PS2_BEAMDEFINES_H___
#define ___ASURA_PS2_BEAMDEFINES_H___ 1

// M A C R O S ///////////////////////////////////////////////////////////////

#define ASURA_PS2_BEAM__MAX_VERTICES_PER_BUFFER     (   77)

#define ASURA_PS2_BEAM__FLAG__CAMERA_BUFFER         (0x200)

#define ASURA_PS2_BEAM__MASK__CAMERA_BUFFER         (0x1FF)

#define ASURA_PS2_BEAM__ADDR__CAMERA_BUFFER_0       (    2)
#define ASURA_PS2_BEAM__ADDR__CAMERA_BUFFER_1       (   16)
#define ASURA_PS2_BEAM__ADDR__INPUT_BUFFER_0        (   30)
#define ASURA_PS2_BEAM__ADDR__INPUT_BUFFER_1        (  261)
#define ASURA_PS2_BEAM__ADDR__OUTPUT_BUFFER_0       (  492)
#define ASURA_PS2_BEAM__ADDR__OUTPUT_BUFFER_1       (  727)
#define ASURA_PS2_BEAM__ADDR__CLIPPER_WORKSPACE_0   (  962)
#define ASURA_PS2_BEAM__ADDR__CLIPPER_WORKSPACE_1   (  989)

#define ASURA_PS2_BEAM__SIZE__CAMERA_BUFFER         (ASURA_PS2_BEAM__ADDR__CAMERA_BUFFER_1     - ASURA_PS2_BEAM__ADDR__CAMERA_BUFFER_0    )
#define ASURA_PS2_BEAM__SIZE__INPUT_BUFFER          (ASURA_PS2_BEAM__ADDR__INPUT_BUFFER_1      - ASURA_PS2_BEAM__ADDR__INPUT_BUFFER_0     )
#define ASURA_PS2_BEAM__SIZE__OUTPUT_BUFFER         (ASURA_PS2_BEAM__ADDR__OUTPUT_BUFFER_1     - ASURA_PS2_BEAM__ADDR__OUTPUT_BUFFER_0    )
#define ASURA_PS2_BEAM__SIZE__CLIPPER_WORKSPACE     (ASURA_PS2_BEAM__ADDR__CLIPPER_WORKSPACE_1 - ASURA_PS2_BEAM__ADDR__CLIPPER_WORKSPACE_0)

// E N D   F I L E   W R A P P E R ///////////////////////////////////////////

#endif // #ifndef ___ASURA_PS2_OBJECTDEFINES_H___
