1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-06 13:16:52 +02:00

gapi* and trigger headers renaming

This commit is contained in:
XProger
2019-03-20 01:49:37 +03:00
parent 46a15236e7
commit 339b70f593
11 changed files with 39 additions and 29 deletions

View File

@@ -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"
@@ -701,6 +701,7 @@ namespace Core {
memset(&support, 0, sizeof(support));
support.texMinSize = 1;
Core::support.derivatives = true;
#ifdef USE_INFLATE
tinf_init();

View File

@@ -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)

View File

@@ -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;
@@ -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;

View File

@@ -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);
@@ -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);
@@ -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);
@@ -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,
@@ -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;
@@ -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) {
@@ -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;
@@ -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
@@ -604,6 +609,8 @@ namespace GAPI {
}
colorMask = blendMode = -1;
LOG("done\n");
}
void deinit() {
@@ -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;
@@ -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);
@@ -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;
}
@@ -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++;
@@ -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,
@@ -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
@@ -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;

View File

@@ -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"

View File

@@ -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"