diff --git a/misc/n64/rsp_gpu.S b/misc/n64/rsp_gpu.S index 569918b80..1f9f2e1b0 100644 --- a/misc/n64/rsp_gpu.S +++ b/misc/n64/rsp_gpu.S @@ -294,14 +294,17 @@ GL_TnL: ssv vcspos_i.W, SCREEN_VTX_W+0, vtx2 ssv vcspos_f.W, SCREEN_VTX_W+2, vtx2 + // Perspective division vmudl v___, vcspos_f, vinvw_f.wwwwWWWW vmadm v___, vcspos_i, vinvw_f.wwwwWWWW vmadn vscreenpos_f, vcspos_f, vinvw_i.wwwwWWWW vmadh vscreenpos_i, vcspos_i, vinvw_i.wwwwWWWW + // Clip against guard planes vch v___, vguard_i, vguard_i.wwwwWWWW vcl v___, vguard_f, vguard_f.wwwwWWWW + // Viewport transform vmudn v___, vscreenpos_f, vviewscale vmadh v___, vscreenpos_i, vviewscale vmadh vscreenpos_i, vviewoff, K1 diff --git a/src/Certs.c b/src/Certs.c index 561dc6858..a9ab018f0 100644 --- a/src/Certs.c +++ b/src/Certs.c @@ -89,7 +89,7 @@ static int (*_X509_STORE_CTX_init)(X509_STORE_CTX* ctx, X509_STORE* store, #if defined CC_BUILD_WIN static const cc_string cryptoLib = String_FromConst("libcrypto.dll"); -#elif defined CC_BUILD_HAIKU +#elif defined CC_BUILD_HAIKU || defined CC_BUILD_LINUX static const cc_string cryptoLib = String_FromConst("libcrypto.so.3"); static const cc_string cryptoAlt = String_FromConst("libcrypto.so"); #else diff --git a/src/ps2/Graphics_PS2.c b/src/ps2/Graphics_PS2.c index aeb5ef898..2a6e8df33 100644 --- a/src/ps2/Graphics_PS2.c +++ b/src/ps2/Graphics_PS2.c @@ -434,15 +434,14 @@ static void ConvertTexture_Palette(cc_uint8* dst, struct Bitmap* bmp, int rowWid static int Log2Dimension(int len) { return Math_ilog2(Math_NextPowOf2(len)); } -GfxResourceID Gfx_AllocTexture(struct Bitmap* bmp, int rowWidth, cc_uint8 flags, cc_bool mipmaps) { - int size = bmp->width * bmp->height * 4; - struct GPUTexture* tex = (struct GPUTexture*)memalign(16, 32 + size); - +static void GPUTexture_Init(struct GPUTexture* tex, struct Bitmap* bmp) { tex->width = bmp->width; tex->height = bmp->height; tex->log2_w = Log2Dimension(bmp->width); tex->log2_h = Log2Dimension(bmp->height); +} +GfxResourceID Gfx_AllocTexture(struct Bitmap* bmp, int rowWidth, cc_uint8 flags, cc_bool mipmaps) { BitmapCol palette[MAX_PAL_4BPP_ENTRIES] QWORD_ALIGNED; int pal_count = 0; int pal_index = -1; @@ -460,6 +459,10 @@ GfxResourceID Gfx_AllocTexture(struct Bitmap* bmp, int rowWidth, cc_uint8 flags, //Platform_Log4("%i, c%i (%i x %i)", &pal_index, &pal_count, &bmp->width, &bmp->height); if (pal_index >= 0) { + struct GPUTexture* tex = memalign(16, 32 + bmp->width * bmp->height); + if (!tex) return 0; + GPUTexture_Init(tex, bmp); + tex->format = GS_PSM_4; tex->pal_index = pal_index; ConvertTexture_Palette((cc_uint8*)tex->pixels, bmp, rowWidth, palette, pal_count); @@ -490,7 +493,12 @@ GfxResourceID Gfx_AllocTexture(struct Bitmap* bmp, int rowWidth, cc_uint8 flags, UploadToVRAM(tex, TEXMEM_4BPP_TO_VRAM(base)); return realloc(tex, sizeof(struct GPUTexture)); } + return tex; } else { + struct GPUTexture* tex = memalign(16, 32 + bmp->width * bmp->height * 4); + if (!tex) return 0; + GPUTexture_Init(tex, bmp); + tex->format = GS_PSM_32; CopyPixels(tex->pixels, bmp->width * BITMAPCOLOR_SIZE, bmp->scan0, rowWidth * BITMAPCOLOR_SIZE, @@ -500,8 +508,8 @@ GfxResourceID Gfx_AllocTexture(struct Bitmap* bmp, int rowWidth, cc_uint8 flags, // TODO fix properly. alignup instead //int blocks = SIZE_TO_BLOCKS(size, TEXMEM_BLOCK_SIZE); size = blocks / (2048 / 64); //Platform_Log4("32BPP: b %i / p %i (%i X %i)", &size, &blocks, &bmp->width, &bmp->height); + return tex; } - return tex; } static void UpdateTextureBuffer(int context, struct GPUTexture* tex, unsigned buf_addr) {