mirror of
https://github.com/pspdev/pspsdk.git
synced 2025-12-24 12:42:36 +00:00
Update samples to use internal vram functions
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
#include <pspgu.h>
|
||||
|
||||
#include "../common/callbacks.h"
|
||||
#include "../common/vram.h"
|
||||
|
||||
PSP_MODULE_INFO("Blend Sample", 0, 1, 1);
|
||||
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER);
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include <psprtc.h>
|
||||
|
||||
#include "../common/callbacks.h"
|
||||
#include "../common/vram.h"
|
||||
|
||||
PSP_MODULE_INFO("Blit Sample", 0, 1, 1);
|
||||
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER);
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
#include "vram.h"
|
||||
|
||||
#include <pspge.h>
|
||||
#include <pspgu.h>
|
||||
|
||||
static unsigned int staticOffset = 0;
|
||||
|
||||
static unsigned int getMemorySize(unsigned int width, unsigned int height, unsigned int psm)
|
||||
{
|
||||
switch (psm)
|
||||
{
|
||||
case GU_PSM_T4:
|
||||
return (width * height) >> 1;
|
||||
|
||||
case GU_PSM_T8:
|
||||
return width * height;
|
||||
|
||||
case GU_PSM_5650:
|
||||
case GU_PSM_5551:
|
||||
case GU_PSM_4444:
|
||||
case GU_PSM_T16:
|
||||
return 2 * width * height;
|
||||
|
||||
case GU_PSM_8888:
|
||||
case GU_PSM_T32:
|
||||
return 4 * width * height;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void* getStaticVramBuffer(unsigned int width, unsigned int height, unsigned int psm)
|
||||
{
|
||||
unsigned int memSize = getMemorySize(width,height,psm);
|
||||
void* result = (void*)staticOffset;
|
||||
staticOffset += memSize;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void* getStaticVramTexture(unsigned int width, unsigned int height, unsigned int psm)
|
||||
{
|
||||
void* result = getStaticVramBuffer(width,height,psm);
|
||||
return (void*)(((unsigned int)result) + ((unsigned int)sceGeEdramGetAddr()));
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
#ifndef common_vram_h
|
||||
#define common_vram_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
The following are a few helperfunctions to help manage vram in gu-examples.
|
||||
Do not use for your own code, it's better you manage it in your own way.
|
||||
*/
|
||||
|
||||
/* make a static allocation of vram memory and return pointer relative to vram start */
|
||||
void* getStaticVramBuffer(unsigned int width, unsigned int height, unsigned int psm);
|
||||
/* make a static allocation of vram memory and return absolute pointer */
|
||||
void* getStaticVramTexture(unsigned int width, unsigned int height, unsigned int psm);
|
||||
|
||||
// the following is not yet implemented
|
||||
/*
|
||||
void beginDynamicVramFrame();
|
||||
void endDynamicVramFrame();
|
||||
|
||||
void* getDynamicVramBuffer(unsigned int width, unsigned int height, unsigned int psm);
|
||||
void* getDynamicVramTexture(unsigned int width, unsigned int height, unsigned int psm);
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <pspgu.h>
|
||||
|
||||
#include "../common/callbacks.h"
|
||||
#include "../common/vram.h"
|
||||
|
||||
PSP_MODULE_INFO("CopyImage Sample", 0, 1, 1);
|
||||
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER);
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <pspgum.h>
|
||||
|
||||
#include "../common/callbacks.h"
|
||||
#include "../common/vram.h"
|
||||
|
||||
PSP_MODULE_INFO("Cube Sample", 0, 1, 1);
|
||||
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER);
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#include "../common/callbacks.h"
|
||||
#include "../common/geometry.h"
|
||||
#include "../common/vram.h"
|
||||
|
||||
PSP_MODULE_INFO("EnvMap Sample", 0, 1, 1);
|
||||
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER);
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include "../common/callbacks.h"
|
||||
#include "../common/geometry.h"
|
||||
#include "../common/vram.h"
|
||||
|
||||
PSP_MODULE_INFO("Lights Sample", 0, 1, 1);
|
||||
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER);
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <pspgu.h>
|
||||
|
||||
#include "../common/callbacks.h"
|
||||
#include "../common/vram.h"
|
||||
|
||||
PSP_MODULE_INFO("Lines Sample", 0, 1, 1);
|
||||
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER);
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <pspgu.h>
|
||||
|
||||
#include "../common/callbacks.h"
|
||||
#include "../common/vram.h"
|
||||
|
||||
PSP_MODULE_INFO("Logic Sample", 0, 1, 1);
|
||||
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER);
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <pspgum.h>
|
||||
|
||||
#include "../common/callbacks.h"
|
||||
#include "../common/vram.h"
|
||||
|
||||
PSP_MODULE_INFO("Orthographic Projection", 0, 1, 1);
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include <psprtc.h>
|
||||
|
||||
#include "../common/callbacks.h"
|
||||
#include "../common/vram.h"
|
||||
|
||||
PSP_MODULE_INFO("Memory Speed Sample", 0, 1, 1);
|
||||
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER);
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <pspgum.h>
|
||||
|
||||
#include "../common/callbacks.h"
|
||||
#include "../common/vram.h"
|
||||
|
||||
PSP_MODULE_INFO("Spline Surface Sample", 0, 1, 1);
|
||||
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER);
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <pspgum.h>
|
||||
|
||||
#include "../common/callbacks.h"
|
||||
#include "../common/vram.h"
|
||||
|
||||
PSP_MODULE_INFO("Sprite Sample", 0, 1, 1);
|
||||
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER);
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <pspgum.h>
|
||||
|
||||
#include "../common/callbacks.h"
|
||||
#include "../common/vram.h"
|
||||
#include "../common/menu.h"
|
||||
|
||||
PSP_MODULE_INFO("Vertex Speed Sample", 0, 1, 1);
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
#include "../common/callbacks.h"
|
||||
#include "../common/geometry.h"
|
||||
#include "../common/vram.h"
|
||||
|
||||
PSP_MODULE_INFO("Depth Buffer Fog Sample", 0, 1, 1);
|
||||
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER);
|
||||
|
||||
Reference in New Issue
Block a user