Presentation is loading. Please wait.

Presentation is loading. Please wait.

Advanced programming for 3D Graphics Applications Console developement.

Similar presentations


Presentation on theme: "Advanced programming for 3D Graphics Applications Console developement."— Presentation transcript:

1 Advanced programming for 3D Graphics Applications Console developement

2 Components of a Video Game 3D graphics 3D graphics User interaction User interaction Sound effects and music Sound effects and music 3D models 3D models 2D textures 2D textures Animation Animation Game and level design Game and level design Immersion, excitement, alternate reality Immersion, excitement, alternate reality

3 PlayStation Net Yaroze (1997) (Official “hobbyist” Game Development) Host-target Development Host-target Development Net Yaroze games dev libraries Net Yaroze games dev libraries No access to hardware No access to hardware Sub-optimal Performance Sub-optimal Performance

4 PlayStation2 Games Console European Launch: November 2000

5

6 Professional Development Environment The TOOL Use the Linux-based tools that come with the TOOL Use the Linux-based tools that come with the TOOL LAN PC TV Controllers Use third party dev tools such as CodeWarrior or SN systems Use third party dev tools such as CodeWarrior or SN systems Linux Box Linux Box

7 USB keyboard & mouse USB keyboard & mouse 10/100 Ethernet Adapter 10/100 Ethernet Adapter 40GB Hard Disk 40GB Hard Disk DVDs DVDs –Linux operating system –Hardware Manuals –Development Tools –Example Applications PlayStation2 Linux Kit – May 2002

8 Graphics Transformation Pipeline Transforms vertices from model or local space to 2D screen space for rasterisation Transforms vertices from model or local space to 2D screen space for rasterisation

9 PS2 Graphics Architecture

10 PS2 Specific Pipeline Transformation Matrices built by CPU Transformation Matrices built by CPU Matrices and untransformed vertex data sent to VU1 Matrices and untransformed vertex data sent to VU1 VU1 performs vertex transformation, clipping, lighting, view port scaling. VU1 performs vertex transformation, clipping, lighting, view port scaling. Transformed data sent to GS. Transformed data sent to GS. GS performs texturing and rasterisation. GS performs texturing and rasterisation. All above (3 processes) can run in parallel !! All above (3 processes) can run in parallel !!

11 Organisation of Memory Dynamic buffer contains data that changes from frame to frame, e.g. transformed data, transformation matrices. Dynamic buffer contains data that changes from frame to frame, e.g. transformed data, transformation matrices. Two dynamic buffers needed to exploit parallelism of PS2 Two dynamic buffers needed to exploit parallelism of PS2 One buffer is being compiled by the CPU whilst the other is being sent for rendering. One buffer is being compiled by the CPU whilst the other is being sent for rendering. Utilises Parallelism of PS2 Utilises Parallelism of PS2 Written by CPU Read by DMAC Swap Every Frame

12 The Game Loop while(Game_Running){ Fire();// Start data transfer GetUserInput();// DoGameLogic();// AI, Physics, Logic…. // Following code ONLY puts render data into memory BeginScene();// Clear frame buffer SetStaticData();// textures, 3d models etc SetDynamicData();// Matrices, T&L, etc. EndScene();// Wait for previous frame to render }

13 VU Overview

14 Architecture of VU1 16k data memory, address in qwords (128-bit) 16k data memory, address in qwords (128-bit) 16k program memory, address in dwords (64-bit) 16k program memory, address in dwords (64-bit) 32 x 128-bit floating point registers 32 x 128-bit floating point registers 16 x 16-bit integer registers (newbie killer!) 16 x 16-bit integer registers (newbie killer!) Two execution units (upper and lower) Two execution units (upper and lower) Special registers (ACC, I, Q, R, P) Special registers (ACC, I, Q, R, P) Dual stream assembly language (.vsm file) Dual stream assembly language (.vsm file) VU assembler provided by Sony ( ee-dvp-as) VU assembler provided by Sony ( ee-dvp-as) –Latency, scheduling, pairing, issues.

15 Typical vsm assembly (dual stream) NOP lq VF06,7(VI02) NOP lq VF06,7(VI02) mulax ACC,VF02,VF06x iaddiu VI01,VI01,0x00000001 mulax ACC,VF02,VF06x iaddiu VI01,VI01,0x00000001 madday ACC,VF03,VF06y iaddiu VI02,VI02,0x00000002 madday ACC,VF03,VF06y iaddiu VI02,VI02,0x00000002 maddaz ACC,VF04,VF06z NOP maddaz ACC,VF04,VF06z NOP maddw VF06,VF05,VF06w NOP maddw VF06,VF05,VF06w NOP NOP NOP NOP NOP mulaw.xyz ACC,VF01,VF00w div Q,VF00w,VF06w mulaw.xyz ACC,VF01,VF00w div Q,VF00w,VF06w NOP NOP NOP NOP mulq.xyz VF06,VF06,Q waitq mulq.xyz VF06,VF06,Q waitq NOP NOP NOP NOP

16 Typical VCL (Single Stream) loop: lqVert, StartVert(iVertPtr) MatrixMultiplyVertex Vert, fTransform, Vert div q, vf00[w], Vert[w] div q, vf00[w], Vert[w] mul.xyz Vert, Vert, q mul.xyz Vert, Vert, q mula.xyzacc, fScales, vf00[w] mula.xyzacc, fScales, vf00[w] madd.xyzVert, Vert, fScales madd.xyzVert, Vert, fScales ftoi4.xyzVert, Vert

17

18 Why is the PS2 used? Introduce console development topics Introduce console development topics 2D graphics, frame buffers, graphics packets, graphics processors, memory management, console architecture…. 2D graphics, frame buffers, graphics packets, graphics processors, memory management, console architecture…. 3D graphics, 3D console architecture, Vector Units, Parallel processing, vertex transformation, clipping, lighting. 3D graphics, 3D console architecture, Vector Units, Parallel processing, vertex transformation, clipping, lighting. C++ concepts in a games context, Sprite classes etc., structure of a games program, Low level vertex processing. C++ concepts in a games context, Sprite classes etc., structure of a games program, Low level vertex processing. Creating a 3D game engine Creating a 3D game engine

19 Development Configuration (Several Options) Host/Target Host/Target Native Native

20

21 Development Tools GNU gcc and g++ compilers GNU gcc and g++ compilers GNU gdb debugger! GNU gdb debugger! Vector Command Line Pre-processor Vector Command Line Pre-processor Vector Unit assembler Vector Unit assembler Visual Vector Unit Debugger Visual Vector Unit Debugger Development can be done “offline” with Visual Studio” Development can be done “offline” with Visual Studio”

22 Development Environment

23 SPS2: Direct Access Environment Developed by PS2Linux developer community 1.What is it? 2.Why use it? 3.How do I use it? 4.Are there disadvantages?

24 What is SPS2? Kernel module loaded at runtime Gives direct access to the hardware Has been used to create samples requiring lots of processing power Linux friendly

25 Advantages Required for DMA transfers –Guarantee to have unswappable/unmovable memory Only 4kb continuous memory is guarantied –Physical address of memory You fill the buffers using Linux virtual addresses and sends the data using physical addresses –Direct access to the hardware registers EE GS

26 DMA packet checker –Set of functions for debugging purposes –Helps prevent crashes Easy to crash the system Very good documentation Samples to illustrate usage Currently being developed and improved The module can be installed/uninstalled at runtime –No need to recompile the kernel –No memory is reserved –No need to even reboot

27 How to use SPS2 Load the kernel at runtime –Scripts are provided to make it easy Use the library provided –Just a set of headers to include –System calls are taken care of Build DMA packets the same way you’d do on a DevKit –Use memory allocated by the module –Build small 4kb chunks linked in a chain Use macros to set the DMA registers –Macros are assembly code writing directly to the registers

28 SPS2 project framework Written by members of the community –Professional developers Takes cares of display initialisation Deals with DMA packet building Provides a solid base for your code Samples of advanced techniques used in a game –Mskpath3 –Bump mapping –Interlock

29 Evaluation Games Employers Value Console Skills Games Employers Value Console Skills Steep learning curve for students Steep learning curve for students In-house development framework needed In-house development framework needed Similarities to Pro-development Similarities to Pro-development Motivational for students Motivational for students Introduces Linux & Linux development tool chain Introduces Linux & Linux development tool chain


Download ppt "Advanced programming for 3D Graphics Applications Console developement."

Similar presentations


Ads by Google