Skip to content

Commit

Permalink
gapi* and trigger headers renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
XProger committed Mar 19, 2019
1 parent 46a1523 commit 339b70f
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 29 deletions.
13 changes: 7 additions & 6 deletions src/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -638,17 +638,17 @@ namespace Core {
}

#ifdef _GAPI_GL
#include "gapi_gl.h"
#include "gapi/gl.h"
#elif _GAPI_D3D9
#include "gapi_d3d9.h"
#include "gapi/d3d9.h"
#elif _OS_3DS
#include "gapi_c3d.h"
#include "gapi/c3d.h"
#elif _GAPI_GU
#include "gapi_gu.h"
#include "gapi/gu.h"
#elif _GAPI_GXM
#include "gapi_gxm.h"
#include "gapi/gxm.h"
#elif _GAPI_VULKAN
#include "gapi_vk.h"
#include "gapi/vk.h"
#endif

#include "texture.h"
Expand Down Expand Up @@ -701,6 +701,7 @@ namespace Core {

memset(&support, 0, sizeof(support));
support.texMinSize = 1;
Core::support.derivatives = true;

#ifdef USE_INFLATE
tinf_init();
Expand Down
2 changes: 1 addition & 1 deletion src/enemy.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define H_ENEMY

#include "character.h"
#include "trigger.h"
#include "objects.h"

#define STALK_BOX (1024 * 3)
#define ESCAPE_BOX (1024 * 5)
Expand Down
File renamed without changes.
4 changes: 3 additions & 1 deletion src/gapi_d3d9.h → src/gapi/d3d9.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ namespace GAPI {
break;
case passShadow :
switch (type) {
case 3 : vSrc = SHADER ( shadow_entity, v ); fSrc = SHADER ( shadow_entity, f ); break;
case 3 :
case 4 : vSrc = SHADER ( shadow_entity, v ); fSrc = SHADER ( shadow_entity, f ); break;
default : ASSERT(false);
}
break;
Expand All @@ -176,6 +177,7 @@ namespace GAPI {
default : ASSERT(false);
}
break;
case passSky : vSrc = SHADER ( gui, v ); fSrc = SHADER ( gui, f ); break; // TODO
case passWater :
switch (type) {
case 0 : vSrc = SHADER ( water_drop, v ); fSrc = SHADER ( water_drop, f ); break;
Expand Down
File renamed without changes.
File renamed without changes.
45 changes: 26 additions & 19 deletions src/gapi_gxm.h → src/gapi/gxm.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ namespace GAPI {
void *mem;

if (type == SCE_KERNEL_MEMBLOCK_TYPE_USER_CDRAM_RW) {
size = ALIGN(size, 256 * 1024);
size = ALIGNADDR(size, 256 * 1024);
} else {
size = ALIGN(size, 4 * 1024);
size = ALIGNADDR(size, 4 * 1024);
}

*uid = sceKernelAllocMemBlock("gpu_mem", type, size, NULL);
Expand Down Expand Up @@ -127,7 +127,7 @@ namespace GAPI {
void* allocVertexUSSE(unsigned int size, SceUID *uid, unsigned int *usse_offset) {
void *mem = NULL;

size = ALIGN(size, 4096);
size = ALIGNADDR(size, 4096);

*uid = sceKernelAllocMemBlock("vertex_usse", SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, size, NULL);

Expand Down Expand Up @@ -155,7 +155,7 @@ namespace GAPI {
void* allocFragmentUSSE(unsigned int size, SceUID *uid, unsigned int *usse_offset) {
void *mem = NULL;

size = ALIGN(size, 4096);
size = ALIGNADDR(size, 4096);

*uid = sceKernelAllocMemBlock("fragment_usse", SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, size, NULL);

Expand Down Expand Up @@ -371,8 +371,8 @@ namespace GAPI {
sceGxmSyncObjectCreate(&color.syncObj);
}

uint32 dsWidth = ALIGN(DISPLAY_WIDTH, SCE_GXM_TILE_SIZEX);
uint32 dsHeight = ALIGN(DISPLAY_HEIGHT, SCE_GXM_TILE_SIZEY);
uint32 dsWidth = ALIGNADDR(DISPLAY_WIDTH, SCE_GXM_TILE_SIZEX);
uint32 dsHeight = ALIGNADDR(DISPLAY_HEIGHT, SCE_GXM_TILE_SIZEY);

depthBuffer.data = Context::allocGPU(
SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE,
Expand Down Expand Up @@ -473,6 +473,7 @@ namespace GAPI {
bool rebind;

void init(Pass pass, int type, int *def, int defCount) {
LOG("init shader %d %d ", int(pass), int(type));
memset(pso, 0, sizeof(pso));

outputFmt = SCE_GXM_OUTPUT_REGISTER_FORMAT_UCHAR4;
Expand All @@ -498,7 +499,7 @@ namespace GAPI {
#define SHADER_U(S,P) (underwater ? SHADER(S##_u,P) : SHADER(S,P))
#define SHADER_AU(S,P) ((underwater && alphatest) ? SHADER(S##_au,P) : (alphatest ? SHADER(S##_a,P) : SHADER_U(S,P)))

const uint8 *vSrc, *fSrc;
const uint8 *vSrc = NULL, *fSrc = NULL;
switch (pass) {
case passCompose :
switch (type) {
Expand All @@ -512,7 +513,8 @@ namespace GAPI {
break;
case passShadow :
switch (type) {
case 3 : vSrc = SHADER ( shadow_entity, v ); fSrc = SHADER ( shadow_entity, f ); break;
case 3 :
case 4 : vSrc = SHADER ( shadow_entity, v ); fSrc = SHADER ( shadow_entity, f ); break;
default : ASSERT(false);
}
break;
Expand Down Expand Up @@ -545,10 +547,13 @@ namespace GAPI {
}
break;
case passGUI : vSrc = SHADER ( gui, v ); fSrc = SHADER ( gui, f ); break;
case passSky : vSrc = SHADER ( gui, v ); fSrc = SHADER ( gui, f ); break;
case PASS_CLEAR : vSrc = SHADER ( clear, v ); fSrc = SHADER ( clear, f ); break;
default : ASSERT(false); LOG("! wrong pass id\n"); return;
}

LOG(" %s", vSrc != NULL ? "true" : "false");

#undef SHADER_A
#undef SHADER_U
#undef SHADER_AU
Expand Down Expand Up @@ -604,6 +609,8 @@ namespace GAPI {
}

colorMask = blendMode = -1;

LOG("done\n");
}

void deinit() {
Expand Down Expand Up @@ -750,7 +757,7 @@ namespace GAPI {
uint8 *data;
SceUID uid;

int width, height, origWidth, origHeight, aWidth, aHeight;
int width, height, depth, origWidth, origHeight, origDepth, aWidth, aHeight;
TexFormat fmt;
uint32 opt;
int mipCount;
Expand All @@ -762,7 +769,7 @@ namespace GAPI {
SceGxmDepthStencilSurface depthSurface;
void *depthBufferData;

Texture(int width, int height, uint32 opt) : width(width), height(height), origWidth(width), origHeight(height), fmt(FMT_RGBA), opt(opt) { opt |= OPT_NEAREST; }
Texture(int width, int height, int depth, uint32 opt) : width(width), height(height), depth(depth), origWidth(width), origHeight(height), origDepth(depth), fmt(FMT_RGBA), opt(opt) { opt |= OPT_NEAREST; }

void init(void *data) {
ASSERT((opt & OPT_PROXY) == 0);
Expand All @@ -781,10 +788,10 @@ namespace GAPI {
aWidth = width = nextPow2(width);
aHeight = height = nextPow2(height);
} else if (isTiled) {
aWidth = ALIGN(width, SCE_GXM_TILE_SIZEX);
aHeight = ALIGN(height, SCE_GXM_TILE_SIZEY);
aWidth = ALIGNADDR(width, SCE_GXM_TILE_SIZEX);
aHeight = ALIGNADDR(height, SCE_GXM_TILE_SIZEY);
} else {
aWidth = ALIGN(width, 8);
aWidth = ALIGNADDR(width, 8);
aHeight = height;
}

Expand All @@ -799,7 +806,7 @@ namespace GAPI {
int w = width;
int h = height;
while (w > 15 && h > 15 && mipCount < 4) {
size += ALIGN(w, 8) * h;
size += ALIGNADDR(w, 8) * h;
w /= 2;
h /= 2;
mipCount++;
Expand Down Expand Up @@ -890,8 +897,8 @@ namespace GAPI {
desc.bpp > 32 ? SCE_GXM_OUTPUT_REGISTER_SIZE_64BIT : SCE_GXM_OUTPUT_REGISTER_SIZE_32BIT,
aWidth, aHeight, aWidth, this->data);

uint32 dsWidth = ALIGN(width, SCE_GXM_TILE_SIZEX);
uint32 dsHeight = ALIGN(height, SCE_GXM_TILE_SIZEY);
uint32 dsWidth = ALIGNADDR(width, SCE_GXM_TILE_SIZEX);
uint32 dsHeight = ALIGNADDR(height, SCE_GXM_TILE_SIZEY);

depthBufferData = Context::allocGPU(
SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE,
Expand Down Expand Up @@ -934,11 +941,11 @@ namespace GAPI {
int h = height;

uint8 *src = this->data;
int srcStride = ALIGN(w, 8) * 4;
int srcStride = ALIGNADDR(w, 8) * 4;

for (int i = 0; i < mipCount - 1; i++) {
uint8 *dst = src + srcStride * h;
int dstStride = ALIGN(w / 2, 8) * 4;
int dstStride = ALIGNADDR(w / 2, 8) * 4;

// TODO: check for NPOT
if (w > 1024 || h > 1024) { // sceGxmTransferDownscale supports blocks less than 1024
Expand Down Expand Up @@ -1214,7 +1221,7 @@ namespace GAPI {
}

bool hasScene;
Texture defTarget(DISPLAY_WIDTH, DISPLAY_HEIGHT, OPT_TARGET);
Texture defTarget(DISPLAY_WIDTH, DISPLAY_HEIGHT, 1, OPT_TARGET);

void resetState() {
hasScene = false;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/lara.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/* Desine sperare qui hic intras */
/*****************************************/
#include "character.h"
#include "trigger.h"
#include "objects.h"
#include "sprite.h"
#include "enemy.h"
#include "inventory.h"
Expand Down
2 changes: 1 addition & 1 deletion src/level.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "enemy.h"
#include "camera.h"
#include "lara.h"
#include "trigger.h"
#include "objects.h"
#include "inventory.h"
#include "savegame.h"
#include "network.h"
Expand Down
File renamed without changes.

0 comments on commit 339b70f

Please sign in to comment.