mirror of
https://gitlab.com/shinovon/re3-symbian.git
synced 2026-05-23 01:57:21 +03:00
Fix textures on VC4
This commit is contained in:
parent
3eb71f2cc5
commit
d5a130fc29
5 changed files with 78 additions and 31 deletions
|
|
@ -17,6 +17,7 @@ LIBRARY eikcore.lib
|
||||||
LIBRARY avkon.lib
|
LIBRARY avkon.lib
|
||||||
LIBRARY ws32.lib
|
LIBRARY ws32.lib
|
||||||
LIBRARY hal.lib
|
LIBRARY hal.lib
|
||||||
|
LIBRARY platformver.lib
|
||||||
|
|
||||||
EPOCSTACKSIZE 0x14000
|
EPOCSTACKSIZE 0x14000
|
||||||
EPOCHEAPSIZE 0x80000 0x4000000
|
EPOCHEAPSIZE 0x80000 0x4000000
|
||||||
|
|
|
||||||
|
|
@ -220,12 +220,15 @@ CStreaming::Init2(void)
|
||||||
// PC only, figure out how much memory we got
|
// PC only, figure out how much memory we got
|
||||||
#ifdef GTA_PC
|
#ifdef GTA_PC
|
||||||
#define MB (1024*1024)
|
#define MB (1024*1024)
|
||||||
|
#ifdef __SYMBIAN32__
|
||||||
// extern size_t _dwMemAvailPhys;
|
extern bool moreVram;
|
||||||
// ms_memoryAvailable = (_dwMemAvailPhys - 10*MB)/2;
|
if (moreVram) {
|
||||||
// if(ms_memoryAvailable < 50*MB)
|
extern size_t _dwMemAvailPhys;
|
||||||
// ms_memoryAvailable = 50*MB;
|
ms_memoryAvailable = (_dwMemAvailPhys - 10*MB)/2;
|
||||||
// desiredNumVehiclesLoaded = (int32)((ms_memoryAvailable / MB - 50) / 3 + 12);
|
if(ms_memoryAvailable < 10*MB)
|
||||||
|
ms_memoryAvailable = 10*MB;
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
ms_memoryAvailable = STREAMING_MEM_SIZE;
|
ms_memoryAvailable = STREAMING_MEM_SIZE;
|
||||||
desiredNumVehiclesLoaded = 12;
|
desiredNumVehiclesLoaded = 12;
|
||||||
if(desiredNumVehiclesLoaded > MAXVEHICLESLOADED)
|
if(desiredNumVehiclesLoaded > MAXVEHICLESLOADED)
|
||||||
|
|
@ -2691,9 +2694,14 @@ CStreaming::MakeSpaceFor(int32 size)
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
#define MB (1024 * 1024)
|
#define MB (1024 * 1024)
|
||||||
if(ms_memoryAvailable == 0) {
|
if(ms_memoryAvailable == 0) {
|
||||||
// extern size_t _dwMemAvailPhys;
|
#ifdef __SYMBIAN32__
|
||||||
// ms_memoryAvailable = (_dwMemAvailPhys - 10 * MB) / 2;
|
extern bool moreVram;
|
||||||
// if(ms_memoryAvailable < 50 * MB) ms_memoryAvailable = 50 * MB;
|
if (moreVram) {
|
||||||
|
extern size_t _dwMemAvailPhys;
|
||||||
|
ms_memoryAvailable = (_dwMemAvailPhys - 10 * MB) / 2;
|
||||||
|
if(ms_memoryAvailable < 10 * MB) ms_memoryAvailable = 10 * MB;
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
ms_memoryAvailable = STREAMING_MEM_SIZE;
|
ms_memoryAvailable = STREAMING_MEM_SIZE;
|
||||||
}
|
}
|
||||||
#undef MB
|
#undef MB
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
float texLoadTime;
|
float texLoadTime;
|
||||||
int32 texNumLoaded;
|
int32 texNumLoaded;
|
||||||
|
|
||||||
|
#ifdef __SYMBIAN32__
|
||||||
static RwImage* resizeImage(RwImage *image, int newWidth, int newHeight)
|
static RwImage* resizeImage(RwImage *image, int newWidth, int newHeight)
|
||||||
{
|
{
|
||||||
image->convertTo32();
|
image->convertTo32();
|
||||||
|
|
@ -84,9 +85,9 @@ static RwImage* resizeImage(RwImage *image, int newWidth, int newHeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int clamp(int32 size)
|
static int clamp(int size, int targetSize)
|
||||||
{
|
{
|
||||||
while (size > 32 && size > 1) {
|
while (size > targetSize && size > 1) {
|
||||||
size = (size + 1) / 2;
|
size = (size + 1) / 2;
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
|
|
@ -98,12 +99,15 @@ static void downscaleTexture(RwTexture *texture)
|
||||||
if (oldRaster == nil)
|
if (oldRaster == nil)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
extern bool moreVram;
|
||||||
|
int targetSize = moreVram ? 64 : 32;
|
||||||
|
|
||||||
int oldWidth = RwRasterGetWidth(oldRaster);
|
int oldWidth = RwRasterGetWidth(oldRaster);
|
||||||
int oldHeight = RwRasterGetHeight(oldRaster);
|
int oldHeight = RwRasterGetHeight(oldRaster);
|
||||||
if (oldWidth <= 32 && oldHeight <= 32) return;
|
if (oldWidth <= targetSize && oldHeight <= targetSize) return;
|
||||||
|
|
||||||
int newWidth = clamp(oldWidth);
|
int newWidth = clamp(oldWidth, targetSize);
|
||||||
int newHeight = clamp(oldHeight);
|
int newHeight = clamp(oldHeight, targetSize);
|
||||||
if (newWidth == oldWidth && newHeight == oldHeight) return;
|
if (newWidth == oldWidth && newHeight == oldHeight) return;
|
||||||
|
|
||||||
RwImage *image = oldRaster->toImage();
|
RwImage *image = oldRaster->toImage();
|
||||||
|
|
@ -120,6 +124,7 @@ static void downscaleTexture(RwTexture *texture)
|
||||||
RwTextureSetRaster(texture, newRaster);
|
RwTextureSetRaster(texture, newRaster);
|
||||||
RwRasterDestroy(oldRaster);
|
RwRasterDestroy(oldRaster);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef LIBRW
|
#ifdef LIBRW
|
||||||
#define READNATIVE(stream, tex, size) rwNativeTextureHackRead(stream, tex, size)
|
#define READNATIVE(stream, tex, size) rwNativeTextureHackRead(stream, tex, size)
|
||||||
|
|
@ -490,11 +495,13 @@ CreateTxdImageForVideoCard()
|
||||||
sprintf(filename, "%s.txd", CTxdStore::GetTxdName(i));
|
sprintf(filename, "%s.txd", CTxdStore::GetTxdName(i));
|
||||||
|
|
||||||
if (CTxdStore::GetSlot(i)->texDict) {
|
if (CTxdStore::GetSlot(i)->texDict) {
|
||||||
|
#ifdef __SYMBIAN32__
|
||||||
RwTexDictionary *texDict = CTxdStore::GetSlot(i)->texDict;
|
RwTexDictionary *texDict = CTxdStore::GetSlot(i)->texDict;
|
||||||
FORLIST(lnk, texDict->textures){
|
FORLIST(lnk, texDict->textures){
|
||||||
rw::Texture *texture = rw::Texture::fromDict(lnk);
|
rw::Texture *texture = rw::Texture::fromDict(lnk);
|
||||||
downscaleTexture(texture);
|
downscaleTexture(texture);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
int32 pos = STREAMTELL(img);
|
int32 pos = STREAMTELL(img);
|
||||||
|
|
||||||
if (RwTexDictionaryStreamWrite(CTxdStore::GetSlot(i)->texDict, img) == nil) {
|
if (RwTexDictionaryStreamWrite(CTxdStore::GetSlot(i)->texDict, img) == nil) {
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
#include <gles2/gl2.h>
|
#include <gles2/gl2.h>
|
||||||
#include <EGL/egl.h>
|
#include <EGL/egl.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
#include <versioninfo.h>
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "rwcore.h"
|
#include "rwcore.h"
|
||||||
|
|
@ -74,6 +75,10 @@ static psGlobalType PsGlobal;
|
||||||
|
|
||||||
static TBool foreground;
|
static TBool foreground;
|
||||||
|
|
||||||
|
bool moreVram;
|
||||||
|
|
||||||
|
static bool spinning;
|
||||||
|
|
||||||
void _InputTranslateShiftKeyUpDown(RsKeyCodes *rs) {
|
void _InputTranslateShiftKeyUpDown(RsKeyCodes *rs) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -82,6 +87,18 @@ const char* _psGetUserFilesFolder() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleExit() {
|
void HandleExit() {
|
||||||
|
if (IsForegroundApp()) {
|
||||||
|
User::ResetInactivityTime();
|
||||||
|
}
|
||||||
|
RThread thread;
|
||||||
|
TInt error = KErrNone;
|
||||||
|
spinning = true;
|
||||||
|
while (thread.RequestCount()) {
|
||||||
|
if (!CActiveScheduler::RunIfReady(error, CActive::EPriorityIdle))
|
||||||
|
continue;
|
||||||
|
User::WaitForAnyRequest();
|
||||||
|
}
|
||||||
|
spinning = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RwInt32 _psGetNumVideModes() {
|
RwInt32 _psGetNumVideModes() {
|
||||||
|
|
@ -178,16 +195,13 @@ void psTerminate(void) {
|
||||||
RwBool psInitialize(void) {
|
RwBool psInitialize(void) {
|
||||||
CFileMgr::Initialise();
|
CFileMgr::Initialise();
|
||||||
TInt memFree = 0;
|
TInt memFree = 0;
|
||||||
if (HAL::Get(HALData::EMemoryRAMFree, memFree) == KErrNone) {
|
HAL::Get(HALData::EMemoryRAMFree, memFree);
|
||||||
if (memFree > 40 * 1024 * 1024) {
|
if (memFree <= 0) {
|
||||||
_dwMemAvailPhys = 40 * 1024 * 1024;
|
_dwMemAvailPhys = 10 * 1024 * 1024;
|
||||||
} else if (memFree <= 0) {
|
} else if (memFree > 60 * 1024 * 1024) {
|
||||||
_dwMemAvailPhys = 10 * 1024 * 1024;
|
_dwMemAvailPhys = 60 * 1024 * 1024;
|
||||||
} else {
|
|
||||||
_dwMemAvailPhys = memFree;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
_dwMemAvailPhys = 40 * 1024 * 1024;
|
_dwMemAvailPhys = memFree;
|
||||||
}
|
}
|
||||||
|
|
||||||
C_PcSave::SetSaveDirectory(_psGetUserFilesFolder());
|
C_PcSave::SetSaveDirectory(_psGetUserFilesFolder());
|
||||||
|
|
@ -240,6 +254,8 @@ public:
|
||||||
return EFalse;
|
return EFalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (spinning) return ETrue;
|
||||||
|
|
||||||
switch (container->gGameState) {
|
switch (container->gGameState) {
|
||||||
case GS_START_UP:
|
case GS_START_UP:
|
||||||
foreground = true;
|
foreground = true;
|
||||||
|
|
@ -311,18 +327,24 @@ public:
|
||||||
|
|
||||||
void RestartTimerL(TInt aInterval) {
|
void RestartTimerL(TInt aInterval) {
|
||||||
if (iPeriodic) iPeriodic->Cancel();
|
if (iPeriodic) iPeriodic->Cancel();
|
||||||
else iPeriodic = CPeriodic::NewL(CActive::EPriorityStandard);
|
else iPeriodic = CPeriodic::NewL(CActive::EPriorityLow);
|
||||||
iPeriodic->Start(aInterval, aInterval, TCallBack(CCContainer::LoopCallBack, this));
|
iPeriodic->Start(aInterval, aInterval, TCallBack(CCContainer::LoopCallBack, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConstructL(const TRect& aRect, CAknAppUi* aAppUi) {
|
void ConstructL(const TRect& aRect, CAknAppUi* aAppUi) {
|
||||||
iAppUi = aAppUi;
|
iAppUi = aAppUi;
|
||||||
CreateWindowL();
|
CreateWindowL();
|
||||||
|
iAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape);
|
||||||
SetExtentToWholeScreen();
|
SetExtentToWholeScreen();
|
||||||
Window().EnableAdvancedPointers();
|
Window().EnableAdvancedPointers();
|
||||||
EnableDragEvents();
|
EnableDragEvents();
|
||||||
ActivateL();
|
ActivateL();
|
||||||
|
|
||||||
|
// VC4 check
|
||||||
|
VersionInfo::TPlatformVersion platformVersion;
|
||||||
|
VersionInfo::GetVersion(platformVersion);
|
||||||
|
moreVram = platformVersion.iMajorVersion == 5 && platformVersion.iMinorVersion >= 4;
|
||||||
|
|
||||||
TSize size = Size();
|
TSize size = Size();
|
||||||
RsGlobal.width = size.iWidth;
|
RsGlobal.width = size.iWidth;
|
||||||
RsGlobal.height = size.iHeight;
|
RsGlobal.height = size.iHeight;
|
||||||
|
|
@ -524,6 +546,7 @@ public:
|
||||||
void HandleCommandL(TInt aCommand) {
|
void HandleCommandL(TInt aCommand) {
|
||||||
if (aCommand == EAknSoftkeyBack || aCommand == EEikCmdExit) {
|
if (aCommand == EAknSoftkeyBack || aCommand == EEikCmdExit) {
|
||||||
RsGlobal.quit = 1;
|
RsGlobal.quit = 1;
|
||||||
|
// Exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
20
vendor/librw/src/gl/gl3raster.cpp
vendored
20
vendor/librw/src/gl/gl3raster.cpp
vendored
|
|
@ -16,6 +16,10 @@
|
||||||
|
|
||||||
#define PLUGIN_ID ID_DRIVER
|
#define PLUGIN_ID ID_DRIVER
|
||||||
|
|
||||||
|
#ifdef __SYMBIAN32__
|
||||||
|
extern bool moreVram;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace rw {
|
namespace rw {
|
||||||
namespace gl3 {
|
namespace gl3 {
|
||||||
|
|
||||||
|
|
@ -202,7 +206,6 @@ rasterCreateCameraTexture(Raster *raster)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// i don't remember why this was once here...
|
|
||||||
if(gl3Caps.gles){
|
if(gl3Caps.gles){
|
||||||
natras->internalFormat = natras->format;
|
natras->internalFormat = natras->format;
|
||||||
}
|
}
|
||||||
|
|
@ -609,8 +612,11 @@ rasterUnlock(Raster *raster, int32 level)
|
||||||
natras->backingStore->levels[level].size);
|
natras->backingStore->levels[level].size);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
// glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
if (raster->pixels != nil && natras->format == GL_RGBA && natras->type == GL_UNSIGNED_BYTE
|
||||||
if (raster->pixels != nil && natras->format == GL_RGBA && natras->type == GL_UNSIGNED_BYTE) {
|
#ifdef __SYMBIAN32__
|
||||||
|
&& !moreVram
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
// convert to 16-bit
|
// convert to 16-bit
|
||||||
uint16_t* pixels16 = (uint16_t*)malloc(raster->width * raster->height * sizeof(uint16_t));
|
uint16_t* pixels16 = (uint16_t*)malloc(raster->width * raster->height * sizeof(uint16_t));
|
||||||
uint8_t* pixels8 = (uint8_t*)raster->pixels;
|
uint8_t* pixels8 = (uint8_t*)raster->pixels;
|
||||||
|
|
@ -625,14 +631,16 @@ rasterUnlock(Raster *raster, int32 level)
|
||||||
}
|
}
|
||||||
glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA, raster->width, raster->height, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, pixels16);
|
glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA, raster->width, raster->height, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, pixels16);
|
||||||
free(pixels16);
|
free(pixels16);
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
|
// glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
glTexImage2D(GL_TEXTURE_2D, level, natras->internalFormat,
|
glTexImage2D(GL_TEXTURE_2D, level, natras->internalFormat,
|
||||||
raster->width, raster->height,
|
raster->width, raster->height,
|
||||||
0, natras->format, natras->type, raster->pixels);
|
0, natras->format, natras->type, raster->pixels);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(level == 0 && natras->autogenMipmap)
|
// if(level == 0 && natras->autogenMipmap)
|
||||||
glGenerateMipmap(GL_TEXTURE_2D);
|
// glGenerateMipmap(GL_TEXTURE_2D);
|
||||||
bindTexture(prev);
|
bindTexture(prev);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue