early-access version 1988
This commit is contained in:
22
externals/SDL/src/render/SDL_render.c
vendored
22
externals/SDL/src/render/SDL_render.c
vendored
@@ -119,9 +119,6 @@ static const SDL_RenderDriver *render_drivers[] = {
|
||||
#if SDL_VIDEO_RENDER_VITA_GXM
|
||||
&VITA_GXM_RenderDriver,
|
||||
#endif
|
||||
#if SDL_VIDEO_RENDER_VITA_GLES2
|
||||
&VITA_GLES2_RenderDriver,
|
||||
#endif
|
||||
#if SDL_VIDEO_RENDER_SW
|
||||
&SW_RenderDriver
|
||||
#endif
|
||||
@@ -622,6 +619,17 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event)
|
||||
SDL_SetRenderTarget(renderer, NULL);
|
||||
}
|
||||
|
||||
/* Update the DPI scale if the window has been resized. */
|
||||
if (window && renderer->GetOutputSize) {
|
||||
int window_w, window_h;
|
||||
int output_w, output_h;
|
||||
if (renderer->GetOutputSize(renderer, &output_w, &output_h) == 0) {
|
||||
SDL_GetWindowSize(renderer->window, &window_w, &window_h);
|
||||
renderer->dpi_scale.x = (float)window_w / output_w;
|
||||
renderer->dpi_scale.y = (float)window_h / output_h;
|
||||
}
|
||||
}
|
||||
|
||||
if (renderer->logical_w) {
|
||||
UpdateLogicalSize(renderer);
|
||||
} else {
|
||||
@@ -2669,7 +2677,9 @@ RenderDrawLinesWithRects(SDL_Renderer * renderer,
|
||||
}
|
||||
}
|
||||
|
||||
retval += QueueCmdFillRects(renderer, frects, nrects);
|
||||
if (nrects) {
|
||||
retval += QueueCmdFillRects(renderer, frects, nrects);
|
||||
}
|
||||
|
||||
SDL_small_free(frects, isstack);
|
||||
|
||||
@@ -2724,7 +2734,9 @@ RenderDrawLinesWithRectsF(SDL_Renderer * renderer,
|
||||
}
|
||||
}
|
||||
|
||||
retval += QueueCmdFillRects(renderer, frects, nrects);
|
||||
if (nrects) {
|
||||
retval += QueueCmdFillRects(renderer, frects, nrects);
|
||||
}
|
||||
|
||||
SDL_small_free(frects, isstack);
|
||||
|
||||
|
1
externals/SDL/src/render/SDL_sysrender.h
vendored
1
externals/SDL/src/render/SDL_sysrender.h
vendored
@@ -250,7 +250,6 @@ extern SDL_RenderDriver DirectFB_RenderDriver;
|
||||
extern SDL_RenderDriver METAL_RenderDriver;
|
||||
extern SDL_RenderDriver PSP_RenderDriver;
|
||||
extern SDL_RenderDriver SW_RenderDriver;
|
||||
extern SDL_RenderDriver VITA_GLES2_RenderDriver;
|
||||
extern SDL_RenderDriver VITA_GXM_RenderDriver;
|
||||
|
||||
/* Blend mode functions */
|
||||
|
@@ -1318,20 +1318,21 @@ D3D_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *verti
|
||||
const SDL_Rect *viewport = &data->drawstate.viewport;
|
||||
const int backw = istarget ? renderer->target->w : data->pparams.BackBufferWidth;
|
||||
const int backh = istarget ? renderer->target->h : data->pparams.BackBufferHeight;
|
||||
const SDL_bool viewport_equal = ((viewport->x == 0) && (viewport->y == 0) && (viewport->w == backw) && (viewport->h == backh)) ? SDL_TRUE : SDL_FALSE;
|
||||
|
||||
if (data->drawstate.cliprect_enabled) {
|
||||
if (data->drawstate.cliprect_enabled || data->drawstate.cliprect_enabled_dirty) {
|
||||
IDirect3DDevice9_SetRenderState(data->device, D3DRS_SCISSORTESTENABLE, FALSE);
|
||||
data->drawstate.cliprect_enabled_dirty = SDL_TRUE;
|
||||
data->drawstate.cliprect_enabled_dirty = data->drawstate.cliprect_enabled;
|
||||
}
|
||||
|
||||
/* Don't reset the viewport if we don't have to! */
|
||||
if (!viewport->x && !viewport->y && (viewport->w == backw) && (viewport->h == backh)) {
|
||||
if (!data->drawstate.viewport_dirty && viewport_equal) {
|
||||
IDirect3DDevice9_Clear(data->device, 0, NULL, D3DCLEAR_TARGET, color, 0.0f, 0);
|
||||
} else {
|
||||
/* Clear is defined to clear the entire render target */
|
||||
const D3DVIEWPORT9 wholeviewport = { 0, 0, backw, backh, 0.0f, 1.0f };
|
||||
IDirect3DDevice9_SetViewport(data->device, &wholeviewport);
|
||||
data->drawstate.viewport_dirty = SDL_TRUE;
|
||||
data->drawstate.viewport_dirty = SDL_TRUE; /* we still need to (re)set orthographic projection, so always mark it dirty. */
|
||||
IDirect3DDevice9_Clear(data->device, 0, NULL, D3DCLEAR_TARGET, color, 0.0f, 0);
|
||||
}
|
||||
|
||||
|
@@ -183,11 +183,13 @@ typedef struct
|
||||
|
||||
static const GUID SDL_IID_IDXGIFactory2 = { 0x50c83a1c, 0xe072, 0x4c48, { 0x87, 0xb0, 0x36, 0x30, 0xfa, 0x36, 0xa6, 0xd0 } };
|
||||
static const GUID SDL_IID_IDXGIDevice1 = { 0x77db970f, 0x6276, 0x48ba, { 0xba, 0x28, 0x07, 0x01, 0x43, 0xb4, 0x39, 0x2c } };
|
||||
#if defined(__WINRT__) && NTDDI_VERSION > NTDDI_WIN8
|
||||
static const GUID SDL_IID_IDXGIDevice3 = { 0x6007896c, 0x3244, 0x4afd, { 0xbf, 0x18, 0xa6, 0xd3, 0xbe, 0xda, 0x50, 0x23 } };
|
||||
#endif
|
||||
static const GUID SDL_IID_ID3D11Texture2D = { 0x6f15aaf2, 0xd208, 0x4e89, { 0x9a, 0xb4, 0x48, 0x95, 0x35, 0xd3, 0x4f, 0x9c } };
|
||||
static const GUID SDL_IID_ID3D11Device1 = { 0xa04bfb29, 0x08ef, 0x43d6, { 0xa4, 0x9c, 0xa9, 0xbd, 0xbd, 0xcb, 0xe6, 0x86 } };
|
||||
static const GUID SDL_IID_ID3D11DeviceContext1 = { 0xbb2c6faa, 0xb5fb, 0x4082, { 0x8e, 0x6b, 0x38, 0x8b, 0x8c, 0xfa, 0x90, 0xe1 } };
|
||||
static const GUID SDL_IID_ID3D11Debug = { 0x79cf2233, 0x7536, 0x4948, { 0x9d, 0x36, 0x1e, 0x46, 0x92, 0xdc, 0x57, 0x60 } };
|
||||
/*static const GUID SDL_IID_ID3D11Debug = { 0x79cf2233, 0x7536, 0x4948, { 0x9d, 0x36, 0x1e, 0x46, 0x92, 0xdc, 0x57, 0x60 } };*/
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
|
@@ -961,7 +961,7 @@ SetDrawState(GLES2_RenderData *data, const SDL_RenderCommand *cmd, const GLES2_I
|
||||
}
|
||||
|
||||
if (texture) {
|
||||
data->glVertexAttribPointer(GLES2_ATTRIBUTE_TEXCOORD, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid *) (cmd->data.draw.first + (sizeof (GLfloat) * 8)));
|
||||
data->glVertexAttribPointer(GLES2_ATTRIBUTE_TEXCOORD, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid *) (uintptr_t) (cmd->data.draw.first + (sizeof (GLfloat) * 8)));
|
||||
}
|
||||
|
||||
if (GLES2_SelectProgram(data, imgsrc, texture ? texture->w : 0, texture ? texture->h : 0) < 0) {
|
||||
@@ -1004,7 +1004,7 @@ SetDrawState(GLES2_RenderData *data, const SDL_RenderCommand *cmd, const GLES2_I
|
||||
}
|
||||
|
||||
/* all drawing commands use this */
|
||||
data->glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid *) cmd->data.draw.first);
|
||||
data->glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid *) (uintptr_t) cmd->data.draw.first);
|
||||
|
||||
if (is_copy_ex != was_copy_ex) {
|
||||
if (is_copy_ex) {
|
||||
@@ -1018,8 +1018,8 @@ SetDrawState(GLES2_RenderData *data, const SDL_RenderCommand *cmd, const GLES2_I
|
||||
}
|
||||
|
||||
if (is_copy_ex) {
|
||||
data->glVertexAttribPointer(GLES2_ATTRIBUTE_ANGLE, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid *) (cmd->data.draw.first + (sizeof (GLfloat) * 16)));
|
||||
data->glVertexAttribPointer(GLES2_ATTRIBUTE_CENTER, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid *) (cmd->data.draw.first + (sizeof (GLfloat) * 24)));
|
||||
data->glVertexAttribPointer(GLES2_ATTRIBUTE_ANGLE, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid *) (uintptr_t) (cmd->data.draw.first + (sizeof (GLfloat) * 16)));
|
||||
data->glVertexAttribPointer(GLES2_ATTRIBUTE_CENTER, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid *) (uintptr_t) (cmd->data.draw.first + (sizeof (GLfloat) * 24)));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@@ -38,6 +38,12 @@
|
||||
|
||||
#include <psp2/common_dialog.h>
|
||||
|
||||
/* #define DEBUG_RAZOR */
|
||||
|
||||
#if DEBUG_RAZOR
|
||||
#include <psp2/sysmodule.h>
|
||||
#endif
|
||||
|
||||
static SDL_Renderer *VITA_GXM_CreateRenderer(SDL_Window *window, Uint32 flags);
|
||||
|
||||
static void VITA_GXM_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *event);
|
||||
@@ -109,14 +115,12 @@ SDL_RenderDriver VITA_GXM_RenderDriver = {
|
||||
.info = {
|
||||
.name = "VITA gxm",
|
||||
.flags = SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE,
|
||||
.num_texture_formats = 6,
|
||||
.num_texture_formats = 4,
|
||||
.texture_formats = {
|
||||
[0] = SDL_PIXELFORMAT_ABGR8888,
|
||||
[1] = SDL_PIXELFORMAT_ARGB8888,
|
||||
[2] = SDL_PIXELFORMAT_RGB888,
|
||||
[3] = SDL_PIXELFORMAT_BGR888,
|
||||
[4] = SDL_PIXELFORMAT_RGB565,
|
||||
[5] = SDL_PIXELFORMAT_BGR565
|
||||
[2] = SDL_PIXELFORMAT_RGB565,
|
||||
[3] = SDL_PIXELFORMAT_BGR565
|
||||
},
|
||||
.max_texture_width = 4096,
|
||||
.max_texture_height = 4096,
|
||||
@@ -157,6 +161,7 @@ StartDrawing(SDL_Renderer *renderer)
|
||||
data->drawstate.fragment_program = NULL;
|
||||
data->drawstate.last_command = -1;
|
||||
data->drawstate.texture_color = 0xFFFFFFFF;
|
||||
data->drawstate.viewport_dirty = SDL_TRUE;
|
||||
|
||||
// reset blend mode
|
||||
// data->currentBlendMode = SDL_BLENDMODE_BLEND;
|
||||
@@ -252,6 +257,11 @@ VITA_GXM_CreateRenderer(SDL_Window *window, Uint32 flags)
|
||||
data->displayData.wait_vblank = SDL_FALSE;
|
||||
}
|
||||
|
||||
#if DEBUG_RAZOR
|
||||
sceSysmoduleLoadModule( SCE_SYSMODULE_RAZOR_HUD );
|
||||
sceSysmoduleLoadModule( SCE_SYSMODULE_RAZOR_CAPTURE );
|
||||
#endif
|
||||
|
||||
if (gxm_init(renderer) != 0)
|
||||
{
|
||||
return NULL;
|
||||
@@ -379,7 +389,7 @@ VITA_GXM_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture, SDL
|
||||
static int
|
||||
VITA_GXM_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
{
|
||||
return 0; // nothing to do here
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -417,7 +427,7 @@ VITA_GXM_SetBlendMode(VITA_GXM_RenderData *data, int blendMode)
|
||||
static int
|
||||
VITA_GXM_QueueSetViewport(SDL_Renderer * renderer, SDL_RenderCommand *cmd)
|
||||
{
|
||||
return 0; // TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -457,6 +467,7 @@ VITA_GXM_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const
|
||||
vertex[i].z = +0.5f;
|
||||
vertex[i].color = color;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -536,22 +547,12 @@ VITA_GXM_QueueFillRects(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const S
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#define PI 3.14159265358979f
|
||||
|
||||
#define degToRad(x) ((x)*PI/180.f)
|
||||
#define degToRad(x) ((x)*M_PI/180.f)
|
||||
|
||||
void MathSincos(float r, float *s, float *c)
|
||||
{
|
||||
*s = sinf(r);
|
||||
*c = cosf(r);
|
||||
}
|
||||
|
||||
void Swap(float *a, float *b)
|
||||
{
|
||||
float n=*a;
|
||||
*a = *b;
|
||||
*b = n;
|
||||
*s = SDL_sin(r);
|
||||
*c = SDL_cos(r);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -609,19 +610,14 @@ VITA_GXM_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Textur
|
||||
const SDL_Rect * srcrect, const SDL_FRect * dstrect,
|
||||
const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
|
||||
{
|
||||
texture_vertex *vertices;
|
||||
float u0, v0, u1, v1;
|
||||
float s, c;
|
||||
float cw, sw, ch, sh;
|
||||
|
||||
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *) renderer->driverdata;
|
||||
|
||||
const float centerx = center->x;
|
||||
const float centery = center->y;
|
||||
const float x = dstrect->x + centerx;
|
||||
const float y = dstrect->y + centery;
|
||||
const float width = dstrect->w - centerx;
|
||||
const float height = dstrect->h - centery;
|
||||
texture_vertex *vertices;
|
||||
float u0, v0, u1, v1;
|
||||
float x0, y0, x1, y1;
|
||||
float s, c;
|
||||
const float centerx = center->x + dstrect->x;
|
||||
const float centery = center->y + dstrect->y;
|
||||
|
||||
cmd->data.draw.count = 1;
|
||||
|
||||
@@ -633,52 +629,62 @@ VITA_GXM_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Textur
|
||||
cmd->data.draw.first = (size_t)vertices;
|
||||
cmd->data.draw.texture = texture;
|
||||
|
||||
if (flip & SDL_FLIP_HORIZONTAL) {
|
||||
x0 = dstrect->x + dstrect->w;
|
||||
x1 = dstrect->x;
|
||||
} else {
|
||||
x0 = dstrect->x;
|
||||
x1 = dstrect->x + dstrect->w;
|
||||
}
|
||||
|
||||
if (flip & SDL_FLIP_VERTICAL) {
|
||||
y0 = dstrect->y + dstrect->h;
|
||||
y1 = dstrect->y;
|
||||
} else {
|
||||
y0 = dstrect->y;
|
||||
y1 = dstrect->y + dstrect->h;
|
||||
}
|
||||
|
||||
u0 = (float)srcrect->x / (float)texture->w;
|
||||
v0 = (float)srcrect->y / (float)texture->h;
|
||||
u1 = (float)(srcrect->x + srcrect->w) / (float)texture->w;
|
||||
v1 = (float)(srcrect->y + srcrect->h) / (float)texture->h;
|
||||
|
||||
if (flip & SDL_FLIP_VERTICAL) {
|
||||
Swap(&v0, &v1);
|
||||
}
|
||||
|
||||
if (flip & SDL_FLIP_HORIZONTAL) {
|
||||
Swap(&u0, &u1);
|
||||
}
|
||||
|
||||
|
||||
MathSincos(degToRad(angle), &s, &c);
|
||||
|
||||
cw = c * width;
|
||||
sw = s * width;
|
||||
ch = c * height;
|
||||
sh = s * height;
|
||||
|
||||
vertices[0].x = x - cw + sh;
|
||||
vertices[0].y = y - sw - ch;
|
||||
vertices[0].x = x0 - centerx;
|
||||
vertices[0].y = y0 - centery;
|
||||
vertices[0].z = +0.5f;
|
||||
vertices[0].u = u0;
|
||||
vertices[0].v = v0;
|
||||
|
||||
vertices[1].x = x + cw + sh;
|
||||
vertices[1].y = y + sw - ch;
|
||||
vertices[1].x = x1 - centerx;
|
||||
vertices[1].y = y0 - centery;
|
||||
vertices[1].z = +0.5f;
|
||||
vertices[1].u = u1;
|
||||
vertices[1].v = v0;
|
||||
|
||||
|
||||
vertices[2].x = x - cw - sh;
|
||||
vertices[2].y = y - sw + ch;
|
||||
vertices[2].x = x0 - centerx;
|
||||
vertices[2].y = y1 - centery;
|
||||
vertices[2].z = +0.5f;
|
||||
vertices[2].u = u0;
|
||||
vertices[2].v = v1;
|
||||
|
||||
vertices[3].x = x + cw - sh;
|
||||
vertices[3].y = y + sw + ch;
|
||||
vertices[3].x = x1 - centerx;
|
||||
vertices[3].y = y1 - centery;
|
||||
vertices[3].z = +0.5f;
|
||||
vertices[3].u = u1;
|
||||
vertices[3].v = v1;
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
float _x = vertices[i].x;
|
||||
float _y = vertices[i].y;
|
||||
vertices[i].x = _x * c - _y * s + centerx;
|
||||
vertices[i].y = _x * s + _y * c + centery;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -690,6 +696,7 @@ VITA_GXM_RenderClear(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
|
||||
float clear_color[4];
|
||||
|
||||
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *) renderer->driverdata;
|
||||
unset_clip_rectangle(data);
|
||||
|
||||
clear_color[0] = (cmd->data.color.r)/255.0f;
|
||||
clear_color[1] = (cmd->data.color.g)/255.0f;
|
||||
@@ -710,6 +717,7 @@ VITA_GXM_RenderClear(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
|
||||
sceGxmSetVertexStream(data->gxm_context, 0, data->clearVertices);
|
||||
sceGxmDraw(data->gxm_context, SCE_GXM_PRIMITIVE_TRIANGLES, SCE_GXM_INDEX_FORMAT_U16, data->linearIndices, 3);
|
||||
|
||||
data->drawstate.cliprect_dirty = SDL_TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -779,7 +787,7 @@ SetDrawState(VITA_GXM_RenderData *data, const SDL_RenderCommand *cmd, SDL_bool s
|
||||
float y_scale = -(sh);
|
||||
float y_off = viewport->y + sh;
|
||||
|
||||
sceGxmSetViewport(data->gxm_context, x_off, x_scale, y_off, y_scale, -0.5f, 0.5f);
|
||||
sceGxmSetViewport(data->gxm_context, x_off, x_scale, y_off, y_scale, 0.5f, 0.5f);
|
||||
|
||||
if (viewport->w && viewport->h) {
|
||||
init_orthographic_matrix(data->ortho_matrix,
|
||||
@@ -802,11 +810,8 @@ SetDrawState(VITA_GXM_RenderData *data, const SDL_RenderCommand *cmd, SDL_bool s
|
||||
}
|
||||
|
||||
if (data->drawstate.cliprect_enabled && data->drawstate.cliprect_dirty) {
|
||||
const SDL_Rect *viewport = &data->drawstate.viewport;
|
||||
const SDL_Rect *rect = &data->drawstate.cliprect;
|
||||
set_clip_rectangle(data, viewport->x + rect->x,
|
||||
data->drawstate.target ? viewport->y + rect->y : data->drawstate.drawableh - viewport->y - rect->y - rect->h,
|
||||
rect->w, rect->h);
|
||||
set_clip_rectangle(data, rect->x, rect->y, rect->x + rect->w, rect->y + rect->h);
|
||||
data->drawstate.cliprect_dirty = SDL_FALSE;
|
||||
}
|
||||
|
||||
@@ -1110,6 +1115,12 @@ VITA_GXM_RenderPresent(SDL_Renderer *renderer)
|
||||
|
||||
sceCommonDialogUpdate(&updateParam);
|
||||
|
||||
#if DEBUG_RAZOR
|
||||
sceGxmPadHeartbeat(
|
||||
(const SceGxmColorSurface *)&data->displaySurface[data->backBufferIndex],
|
||||
(SceGxmSyncObject *)data->displayBufferSync[data->backBufferIndex]
|
||||
);
|
||||
#endif
|
||||
|
||||
sceGxmDisplayQueueAddEntry(
|
||||
data->displayBufferSync[data->frontBufferIndex], // OLD fb
|
||||
@@ -1144,20 +1155,8 @@ VITA_GXM_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
|
||||
sceGxmFinish(data->gxm_context);
|
||||
|
||||
if (vita_texture->tex->gxm_rendertarget) {
|
||||
sceGxmDestroyRenderTarget(vita_texture->tex->gxm_rendertarget);
|
||||
}
|
||||
free_gxm_texture(vita_texture->tex);
|
||||
|
||||
if (vita_texture->tex->depth_UID) {
|
||||
mem_gpu_free(vita_texture->tex->depth_UID);
|
||||
}
|
||||
|
||||
if (vita_texture->tex->palette_UID) {
|
||||
mem_gpu_free(vita_texture->tex->palette_UID);
|
||||
}
|
||||
|
||||
mem_gpu_free(vita_texture->tex->data_UID);
|
||||
SDL_free(vita_texture->tex);
|
||||
SDL_free(vita_texture);
|
||||
|
||||
texture->driverdata = NULL;
|
||||
|
@@ -124,30 +124,30 @@ static const unsigned char gxm_shader_color_f[gxm_shader_color_f_size] = {
|
||||
0x7e, 0x0d, 0x80, 0x40,
|
||||
};
|
||||
|
||||
#define gxm_shader_color_v_size 344
|
||||
#define gxm_shader_color_v_size 352
|
||||
static const unsigned char gxm_shader_color_v[gxm_shader_color_v_size] = {
|
||||
0x47, 0x58, 0x50, 0x00, 0x01, 0x05, 0x50, 0x03,
|
||||
0x55, 0x01, 0x00, 0x00, 0x2e, 0x35, 0x0f, 0x26,
|
||||
0x23, 0x46, 0x37, 0xbb, 0x00, 0x00, 0x19, 0x00,
|
||||
0x5d, 0x01, 0x00, 0x00, 0x4a, 0xb6, 0x4f, 0x7b,
|
||||
0x51, 0x19, 0x1a, 0xae, 0x00, 0x00, 0x19, 0x00,
|
||||
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
|
||||
0xe8, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00,
|
||||
0xf0, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00,
|
||||
0x08, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x00, 0x00,
|
||||
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x74, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
|
||||
0xa0, 0x00, 0x00, 0x00, 0xc0, 0x3d, 0x03, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00,
|
||||
0xa8, 0x00, 0x00, 0x00, 0xc0, 0x3d, 0x03, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x08,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x44, 0xfa,
|
||||
@@ -158,6 +158,7 @@ static const unsigned char gxm_shader_color_v[gxm_shader_color_v_size] = {
|
||||
0x02, 0x11, 0x45, 0xcf, 0x80, 0x8f, 0xb1, 0x18,
|
||||
0x00, 0x11, 0x01, 0xc0, 0x81, 0x81, 0xb1, 0x18,
|
||||
0x01, 0xd1, 0x42, 0xc0, 0x81, 0x81, 0xb1, 0x18,
|
||||
0x40, 0x00, 0x10, 0x41, 0x09, 0x05, 0x82, 0x38,
|
||||
0x00, 0x00, 0x20, 0xa0, 0x00, 0x50, 0x27, 0xfb,
|
||||
0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
|
||||
0x30, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
|
||||
|
@@ -1001,9 +1001,6 @@ free_gxm_texture(gxm_texture *texture)
|
||||
if (texture->depth_UID) {
|
||||
mem_gpu_free(texture->depth_UID);
|
||||
}
|
||||
if (texture->palette_UID) {
|
||||
mem_gpu_free(texture->palette_UID);
|
||||
}
|
||||
mem_gpu_free(texture->data_UID);
|
||||
SDL_free(texture);
|
||||
}
|
||||
@@ -1070,29 +1067,6 @@ create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsigned int h, Sc
|
||||
/* Create the gxm texture */
|
||||
sceGxmTextureInitLinear( &texture->gxm_tex, texture_data, format, w, h, 0);
|
||||
|
||||
if ((format & 0x9f000000U) == SCE_GXM_TEXTURE_BASE_FORMAT_P8) {
|
||||
const int pal_size = 256 * sizeof(uint32_t);
|
||||
|
||||
void *texture_palette = mem_gpu_alloc(
|
||||
SCE_KERNEL_MEMBLOCK_TYPE_USER_CDRAM_RW,
|
||||
pal_size,
|
||||
SCE_GXM_PALETTE_ALIGNMENT,
|
||||
SCE_GXM_MEMORY_ATTRIB_READ,
|
||||
&texture->palette_UID);
|
||||
|
||||
if (!texture_palette) {
|
||||
texture->palette_UID = 0;
|
||||
free_gxm_texture(texture);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SDL_memset(texture_palette, 0, pal_size);
|
||||
|
||||
sceGxmTextureSetPalette(&texture->gxm_tex, texture_palette);
|
||||
} else {
|
||||
texture->palette_UID = 0;
|
||||
}
|
||||
|
||||
if (isRenderTarget) {
|
||||
void *depthBufferData;
|
||||
const uint32_t alignedWidth = ALIGN(w, SCE_GXM_TILE_SIZEX);
|
||||
|
@@ -76,7 +76,6 @@ typedef struct texture_vertex {
|
||||
typedef struct gxm_texture {
|
||||
SceGxmTexture gxm_tex;
|
||||
SceUID data_UID;
|
||||
SceUID palette_UID;
|
||||
SceGxmRenderTarget *gxm_rendertarget;
|
||||
SceGxmColorSurface gxm_colorsurface;
|
||||
SceGxmDepthStencilSurface gxm_depthstencil;
|
||||
|
@@ -2,10 +2,12 @@ void main(
|
||||
float3 aPosition,
|
||||
float4 aColor,
|
||||
uniform float4x4 wvp,
|
||||
float4 out vPosition : POSITION,
|
||||
float4 out vColor : COLOR
|
||||
out float4 vPosition : POSITION,
|
||||
out float4 vColor : COLOR,
|
||||
out float pSize : PSIZE
|
||||
)
|
||||
{
|
||||
vPosition = mul(float4(aPosition, 1.f), wvp);
|
||||
vColor = aColor;
|
||||
pSize = 1.f;
|
||||
}
|
||||
|
@@ -2,8 +2,8 @@ void main(
|
||||
float3 aPosition,
|
||||
float2 aTexcoord,
|
||||
uniform float4x4 wvp,
|
||||
float4 out vPosition : POSITION,
|
||||
float2 out vTexcoord : TEXCOORD0
|
||||
out float4 vPosition : POSITION,
|
||||
out float2 vTexcoord : TEXCOORD0
|
||||
)
|
||||
{
|
||||
vPosition = mul(float4(aPosition, 1.f), wvp);
|
||||
|
Reference in New Issue
Block a user