Some adaptments for vita build.
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
*.o
|
||||||
|
*.a
|
||||||
|
|
||||||
/bin
|
/bin
|
||||||
/build
|
/build
|
||||||
/obj
|
/obj
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ CXX = $(PREFIX)-g++
|
|||||||
AR = $(PREFIX)-gcc-ar
|
AR = $(PREFIX)-gcc-ar
|
||||||
CFLAGS = -g -Wl,-q -O2 -ffast-math -mtune=cortex-a9 -mfpu=neon -ftree-vectorize \
|
CFLAGS = -g -Wl,-q -O2 -ffast-math -mtune=cortex-a9 -mfpu=neon -ftree-vectorize \
|
||||||
-DPSP2 -DDEBUG -DRW_GL3 -DLIBRW_GLAD
|
-DPSP2 -DDEBUG -DRW_GL3 -DLIBRW_GLAD
|
||||||
|
CXXFLAGS = $(CFLAGS)
|
||||||
ASFLAGS = $(CFLAGS)
|
ASFLAGS = $(CFLAGS)
|
||||||
|
|
||||||
all: $(TARGET).a
|
all: $(TARGET).a
|
||||||
|
|||||||
+11
-25
@@ -26,7 +26,7 @@ rasterCreateTexture(Raster *raster)
|
|||||||
Gl3Raster *natras = PLUGINOFFSET(Gl3Raster, raster, nativeRasterOffset);
|
Gl3Raster *natras = PLUGINOFFSET(Gl3Raster, raster, nativeRasterOffset);
|
||||||
switch(raster->format & 0xF00){
|
switch(raster->format & 0xF00){
|
||||||
case Raster::C8888:
|
case Raster::C8888:
|
||||||
natras->internalFormat = GL_RGBA8;
|
natras->internalFormat = GL_RGBA;
|
||||||
natras->format = GL_RGBA;
|
natras->format = GL_RGBA;
|
||||||
natras->type = GL_UNSIGNED_BYTE;
|
natras->type = GL_UNSIGNED_BYTE;
|
||||||
natras->hasAlpha = 1;
|
natras->hasAlpha = 1;
|
||||||
@@ -34,7 +34,7 @@ rasterCreateTexture(Raster *raster)
|
|||||||
raster->depth = 32;
|
raster->depth = 32;
|
||||||
break;
|
break;
|
||||||
case Raster::C888:
|
case Raster::C888:
|
||||||
natras->internalFormat = GL_RGB8;
|
natras->internalFormat = GL_RGB;
|
||||||
natras->format = GL_RGB;
|
natras->format = GL_RGB;
|
||||||
natras->type = GL_UNSIGNED_BYTE;
|
natras->type = GL_UNSIGNED_BYTE;
|
||||||
natras->hasAlpha = 0;
|
natras->hasAlpha = 0;
|
||||||
@@ -42,7 +42,7 @@ rasterCreateTexture(Raster *raster)
|
|||||||
raster->depth = 24;
|
raster->depth = 24;
|
||||||
break;
|
break;
|
||||||
case Raster::C1555:
|
case Raster::C1555:
|
||||||
natras->internalFormat = GL_RGB5_A1;
|
natras->internalFormat = GL_RGBA;
|
||||||
natras->format = GL_RGBA;
|
natras->format = GL_RGBA;
|
||||||
natras->type = GL_UNSIGNED_SHORT_5_5_5_1;
|
natras->type = GL_UNSIGNED_SHORT_5_5_5_1;
|
||||||
natras->hasAlpha = 1;
|
natras->hasAlpha = 1;
|
||||||
@@ -89,7 +89,7 @@ rasterCreateCameraTexture(Raster *raster)
|
|||||||
Gl3Raster *natras = PLUGINOFFSET(Gl3Raster, raster, nativeRasterOffset);
|
Gl3Raster *natras = PLUGINOFFSET(Gl3Raster, raster, nativeRasterOffset);
|
||||||
switch(raster->format & 0xF00){
|
switch(raster->format & 0xF00){
|
||||||
case Raster::C8888:
|
case Raster::C8888:
|
||||||
natras->internalFormat = GL_RGBA8;
|
natras->internalFormat = GL_RGBA;
|
||||||
natras->format = GL_RGBA;
|
natras->format = GL_RGBA;
|
||||||
natras->type = GL_UNSIGNED_BYTE;
|
natras->type = GL_UNSIGNED_BYTE;
|
||||||
natras->hasAlpha = 1;
|
natras->hasAlpha = 1;
|
||||||
@@ -97,14 +97,14 @@ rasterCreateCameraTexture(Raster *raster)
|
|||||||
break;
|
break;
|
||||||
case Raster::C888:
|
case Raster::C888:
|
||||||
default:
|
default:
|
||||||
natras->internalFormat = GL_RGB8;
|
natras->internalFormat = GL_RGB;
|
||||||
natras->format = GL_RGB;
|
natras->format = GL_RGB;
|
||||||
natras->type = GL_UNSIGNED_BYTE;
|
natras->type = GL_UNSIGNED_BYTE;
|
||||||
natras->hasAlpha = 0;
|
natras->hasAlpha = 0;
|
||||||
natras->bpp = 3;
|
natras->bpp = 3;
|
||||||
break;
|
break;
|
||||||
case Raster::C1555:
|
case Raster::C1555:
|
||||||
natras->internalFormat = GL_RGB5_A1;
|
natras->internalFormat = GL_RGBA;
|
||||||
natras->format = GL_RGBA;
|
natras->format = GL_RGBA;
|
||||||
natras->type = GL_UNSIGNED_SHORT_5_5_5_1;
|
natras->type = GL_UNSIGNED_SHORT_5_5_5_1;
|
||||||
natras->hasAlpha = 1;
|
natras->hasAlpha = 1;
|
||||||
@@ -136,7 +136,7 @@ rasterCreateCameraTexture(Raster *raster)
|
|||||||
|
|
||||||
glGenFramebuffers(1, &natras->fbo);
|
glGenFramebuffers(1, &natras->fbo);
|
||||||
bindFramebuffer(natras->fbo);
|
bindFramebuffer(natras->fbo);
|
||||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, natras->texid, 0);
|
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, natras->texid, 0);
|
||||||
bindFramebuffer(0);
|
bindFramebuffer(0);
|
||||||
natras->fboMate = nil;
|
natras->fboMate = nil;
|
||||||
|
|
||||||
@@ -172,7 +172,7 @@ rasterCreateZbuffer(Raster *raster)
|
|||||||
raster->stride = 0;
|
raster->stride = 0;
|
||||||
raster->pixels = nil;
|
raster->pixels = nil;
|
||||||
|
|
||||||
natras->internalFormat = GL_DEPTH_COMPONENT;
|
/*natras->internalFormat = GL_DEPTH_COMPONENT;
|
||||||
natras->format = GL_DEPTH_COMPONENT;
|
natras->format = GL_DEPTH_COMPONENT;
|
||||||
natras->type = GL_UNSIGNED_BYTE;
|
natras->type = GL_UNSIGNED_BYTE;
|
||||||
|
|
||||||
@@ -188,7 +188,7 @@ rasterCreateZbuffer(Raster *raster)
|
|||||||
bindTexture(prev);
|
bindTexture(prev);
|
||||||
|
|
||||||
natras->fbo = 0;
|
natras->fbo = 0;
|
||||||
natras->fboMate = nil;
|
natras->fboMate = nil; */
|
||||||
|
|
||||||
return raster;
|
return raster;
|
||||||
}
|
}
|
||||||
@@ -270,23 +270,9 @@ memset(px, 0, raster->stride*raster->height);
|
|||||||
raster->pixels = px;
|
raster->pixels = px;
|
||||||
|
|
||||||
if(lockMode & Raster::LOCKREAD || !(lockMode & Raster::LOCKNOFETCH)){
|
if(lockMode & Raster::LOCKREAD || !(lockMode & Raster::LOCKNOFETCH)){
|
||||||
#ifdef RW_GLES
|
|
||||||
GLuint fbo;
|
|
||||||
GLenum e;
|
|
||||||
glGenFramebuffers(1, &fbo);
|
|
||||||
bindFramebuffer(fbo);
|
|
||||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, natras->texid, 0);
|
|
||||||
e = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
|
||||||
assert(natras->format == GL_RGBA);
|
|
||||||
glReadPixels(0, 0, raster->width, raster->height, natras->format, natras->type, px);
|
|
||||||
//e = glGetError(); printf("GL err4 %x (%x)\n", e, natras->format);
|
|
||||||
bindFramebuffer(0);
|
|
||||||
glDeleteFramebuffers(1, &fbo);
|
|
||||||
#else
|
|
||||||
uint32 prev = bindTexture(natras->texid);
|
uint32 prev = bindTexture(natras->texid);
|
||||||
glGetTexImage(GL_TEXTURE_2D, level, natras->format, natras->type, px);
|
memcpy_neon(px, vglGetTexDataPointer(GL_TEXTURE_2D), raster->stride*raster->height);
|
||||||
bindTexture(prev);
|
bindTexture(prev);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
raster->privateFlags = lockMode;
|
raster->privateFlags = lockMode;
|
||||||
@@ -516,7 +502,7 @@ destroyNativeRaster(void *object, int32 offset, int32)
|
|||||||
Gl3Raster *oldfb = PLUGINOFFSET(Gl3Raster, natras->fboMate, nativeRasterOffset);
|
Gl3Raster *oldfb = PLUGINOFFSET(Gl3Raster, natras->fboMate, nativeRasterOffset);
|
||||||
if(oldfb->fbo){
|
if(oldfb->fbo){
|
||||||
bindFramebuffer(oldfb->fbo);
|
bindFramebuffer(oldfb->fbo);
|
||||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, 0, 0);
|
//glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, 0, 0);
|
||||||
}
|
}
|
||||||
oldfb->fboMate = nil;
|
oldfb->fboMate = nil;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-10
@@ -149,16 +149,7 @@ linkprogram(GLint vs, GLint fs, GLuint *program)
|
|||||||
glAttachShader(prog, vs);
|
glAttachShader(prog, vs);
|
||||||
glAttachShader(prog, fs);
|
glAttachShader(prog, fs);
|
||||||
glLinkProgram(prog);
|
glLinkProgram(prog);
|
||||||
glGetProgramiv(prog, GL_LINK_STATUS, &success);
|
|
||||||
if(!success){
|
|
||||||
fprintf(stderr, "Error in program\n");
|
|
||||||
glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &len);
|
|
||||||
log = (char*)rwMalloc(len, MEMDUR_FUNCTION);
|
|
||||||
glGetProgramInfoLog(prog, len, nil, log);
|
|
||||||
fprintf(stderr, "%s\n", log);
|
|
||||||
rwFree(log);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
*program = prog;
|
*program = prog;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-1
@@ -4,6 +4,10 @@
|
|||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef PSP2
|
||||||
|
#include <vitasdk.h>
|
||||||
|
#include <vitaGL.h>
|
||||||
|
#else
|
||||||
#ifndef LIBRW_GLAD
|
#ifndef LIBRW_GLAD
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
#else
|
#else
|
||||||
@@ -16,6 +20,7 @@
|
|||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace rw {
|
namespace rw {
|
||||||
|
|
||||||
@@ -25,7 +30,7 @@ struct EngineOpenParams
|
|||||||
#ifdef LIBRW_SDL2
|
#ifdef LIBRW_SDL2
|
||||||
SDL_Window **window;
|
SDL_Window **window;
|
||||||
bool32 fullscreen;
|
bool32 fullscreen;
|
||||||
#else
|
#elif !defined(PSP2)
|
||||||
GLFWwindow **window;
|
GLFWwindow **window;
|
||||||
#endif
|
#endif
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|||||||
Reference in New Issue
Block a user