Skip to content

Commit

Permalink
Bugfixes, improvements
Browse files Browse the repository at this point in the history
- Increased named object limit to 439
- Enabled build without context hyberination support
- Enabled mutex support
- Improved heap operation methods
  • Loading branch information
GrapheneCt committed Jan 2, 2022
1 parent 729bf86 commit fe7aa59
Show file tree
Hide file tree
Showing 14 changed files with 99 additions and 810 deletions.
4 changes: 4 additions & 0 deletions eurasiacon/imgegl/imgegl/srv_sgx.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,10 @@ IMG_INTERNAL IMG_BOOL KEGL_SGXCreateRenderSurface(SrvSysContext *psSysContext,
psSurface->bInFrame = IMG_FALSE;
psSurface->bInExternalFrame = IMG_FALSE;
psSurface->bPrimitivesSinceLastTA = IMG_FALSE;
#if defined(__psp2__)
psSurface->ui32initWidth = psParams->ui32Width;
psSurface->ui32initHeight = psParams->ui32Height;
#endif

psSurface->bNeedZSLoadAfterOverflowRender = IMG_FALSE;

Expand Down Expand Up @@ -1142,8 +1144,10 @@ IMG_INTERNAL IMG_BOOL KEGL_SGXResizeRenderSurface(SrvSysContext *psSysContext,
sAddRenderTarget.hRenderContext = psSysContext->hRenderContext;
sAddRenderTarget.ui32NumPixelsX = psParams->ui32Width;
sAddRenderTarget.ui32NumPixelsY = psParams->ui32Height;
#if defined(__psp2__)
psSurface->ui32initWidth = psParams->ui32Width;
psSurface->ui32initHeight = psParams->ui32Height;
#endif

if (ui32MultiSample == 2)
{
Expand Down
7 changes: 4 additions & 3 deletions eurasiacon/opengles2/fbo.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ IMG_INTERNAL IMG_BOOL FlushAllUnflushedFBO(GLES2Context *gc,
{
ui32Flags |= GLES2_SCHEDULE_HW_WAIT_FOR_3D;
}

PVRSRVLockMutex(gc->psSharedState->hFlushListLock);

ppsFlushList = &gc->psSharedState->psFlushList;
Expand Down Expand Up @@ -3242,6 +3242,7 @@ GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer(GLuint framebuffer)
return GL_TRUE;
}


/***********************************************************************************
Function Name : glBindFramebuffer
Inputs : target, framebuffer
Expand Down Expand Up @@ -3326,7 +3327,7 @@ GL_APICALL void GL_APIENTRY glBindFramebuffer(GLenum target, GLuint framebuffer)
}
else
{
psFrameBuffer = &gc->sFrameBuffer.sDefaultFrameBuffer;
psFrameBuffer = &gc->sFrameBuffer.sDefaultFrameBuffer;
}

psBoundFrameBuffer = gc->sFrameBuffer.psActiveFrameBuffer;
Expand Down Expand Up @@ -3496,13 +3497,13 @@ GL_APICALL void GL_APIENTRY glDeleteFramebuffers(GLsizei n, const GLuint *frameb

/* Setup various draw/read params state now the framebuffer has changed */
gc->sFrameBuffer.psActiveFrameBuffer = psDefaultFrameBuffer;

ChangeDrawableParams(gc, psDefaultFrameBuffer, &psDefaultFrameBuffer->sReadParams, &psDefaultFrameBuffer->sDrawParams);
}
}

NamedItemDelRefByName(gc, psNamesArray, (IMG_UINT32)n, (const IMG_UINT32*)framebuffers);


GLES2_TIME_STOP(GLES2_TIMES_glDeleteFramebuffers);
}

Expand Down
3 changes: 2 additions & 1 deletion eurasiacon/opengles2/names.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ typedef enum GLES2NameTypeTAG
} GLES2NameType;

/* It must be a prime number. Some alternatives are: 71, 83, 101, 127, 163, 199, 251, 307, 359, 439 */
#define GLES2_DEFAULT_NAMES_ARRAY_SIZE 127
//#define GLES2_DEFAULT_NAMES_ARRAY_SIZE 127
#define GLES2_DEFAULT_NAMES_ARRAY_SIZE 439


/* This structure must be the first variable of all objects we put in a names array */
Expand Down
2 changes: 1 addition & 1 deletion eurasiacon/opengles2/sgxif.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ static IMG_BOOL StartFrame(GLES2Context *gc, IMG_UINT32 *pui32ClearFlags, PVRSRV
{
return IMG_FALSE;
}

/*
Snap Terminate clip rect to nearest 16 pixel units outside drawable rectangle.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,15 @@
#include "eurasia/services4/include/servicesint.h"
#include "eurasia/services4/include/pvr_bridge.h"

static ScePVoid s_userModeHeap = SCE_NULL;
static SceClibMspace s_userModeMspace = SCE_NULL;

int _PVRSRVCreateUserModeHeap()
int _PVRSRVCreateUserModeHeap(SceClibMspace mspace)
{
s_userModeHeap = sceHeapCreateHeap("PVRSRVUserModeHeap", 1 * 1024 * 1024, 0, SCE_NULL);

if (!s_userModeHeap)
{
PVR_DPF((PVR_DBG_ERROR, "_PVRSRVCreateUserModeHeap, failed to create user mode heap"));
return SCE_ERROR_ERRNO_ENOMEM;
}
s_userModeMspace = mspace;

return SCE_OK;
}

/******************************************************************************
Function Name : PVRSRVAllocUserModeMem
Inputs :
Outputs :
Returns :
Description :
******************************************************************************/
IMG_EXPORT IMG_PVOID IMG_CALLCONV PVRSRVAllocUserModeMem(IMG_UINT32 ui32Size)
{
return (IMG_PVOID)sceHeapAllocHeapMemory(s_userModeHeap, ui32Size);
}


/******************************************************************************
Function Name : PVRSRVCallocUserModeMem
Inputs :
Expand All @@ -48,7 +28,7 @@ IMG_EXPORT IMG_PVOID IMG_CALLCONV PVRSRVAllocUserModeMem(IMG_UINT32 ui32Size)
******************************************************************************/
IMG_EXPORT IMG_PVOID IMG_CALLCONV PVRSRVCallocUserModeMem(IMG_UINT32 ui32Size)
{
IMG_PVOID ret = (IMG_PVOID)sceHeapAllocHeapMemory(s_userModeHeap, ui32Size);
IMG_PVOID ret = PVRSRVAllocUserModeMem(ui32Size);

if (!ret)
{
Expand All @@ -71,21 +51,7 @@ IMG_EXPORT IMG_PVOID IMG_CALLCONV PVRSRVCallocUserModeMem(IMG_UINT32 ui32Size)
******************************************************************************/
IMG_EXPORT IMG_PVOID IMG_CALLCONV PVRSRVReallocUserModeMem(IMG_PVOID pvBase, IMG_SIZE_T uNewSize)
{
return (IMG_PVOID)sceHeapReallocHeapMemory(s_userModeHeap, pvBase, uNewSize);
}


/******************************************************************************
Function Name : PVRSRVFreeUserModeMem
Inputs :
Outputs :
Returns :
Description :
******************************************************************************/
IMG_EXPORT IMG_VOID IMG_CALLCONV PVRSRVFreeUserModeMem(IMG_PVOID pvMem)
{
sceHeapFreeHeapMemory(s_userModeHeap, pvMem);
return (IMG_PVOID)sceClibMspaceRealloc(s_userModeMspace, pvBase, uNewSize);
}

/******************************************************************************
Expand Down Expand Up @@ -371,7 +337,7 @@ IMG_EXPORT PVRSRV_ERROR IMG_CALLCONV PVRSRVCreateMutex(PVRSRV_MUTEX_HANDLE *phMu
SceKernelLwMutexWork *psPVRMutex;
IMG_INT iError;

psPVRMutex = PVRSRVAllocUserModeMem(sizeof(SceKernelLwMutexWork));
psPVRMutex = PVRSRVCallocUserModeMem(sizeof(SceKernelLwMutexWork));

if (psPVRMutex == NULL)
{
Expand Down Expand Up @@ -439,7 +405,7 @@ IMG_EXPORT IMG_VOID IMG_CALLCONV PVRSRVLockMutex(PVRSRV_MUTEX_HANDLE hMutex)
SceKernelLwMutexWork *psPVRMutex = (SceKernelLwMutexWork *)hMutex;
IMG_INT iError;

if (psPVRMutex == NULL)
if (psPVRMutex == NULL || psPVRMutex == 1)
return;

sceKernelLockLwMutex(psPVRMutex, 1, NULL);
Expand All @@ -460,8 +426,9 @@ IMG_EXPORT IMG_VOID IMG_CALLCONV PVRSRVUnlockMutex(PVRSRV_MUTEX_HANDLE hMutex)
SceKernelLwMutexWork *psPVRMutex = (SceKernelLwMutexWork *)hMutex;
IMG_INT iError;

if (psPVRMutex == NULL)
if (psPVRMutex == NULL || psPVRMutex == 1)
return;

sceKernelUnlockLwMutex(psPVRMutex, 1);
#endif
}
7 changes: 3 additions & 4 deletions gpu_es4_ext/gpu_es4_ext.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
<ClCompile Include="eurasia\services4\srvclient\env\playstation\common\pvr_apphint.c" />
<ClCompile Include="eurasia\services4\srvclient\env\playstation\common\pvr_debug.c" />
<ClCompile Include="eurasia\services4\srvclient\env\playstation\common\pvr_metrics.c" />
<ClCompile Include="psp2\heap.c" />
<ClCompile Include="psp2\module.c" />
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -110,7 +109,7 @@
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|PSVita'">
<ClCompile>
<PreprocessorDefinitions>_DEBUG;DEBUG;SUPPORT_SGX543;PVRSRV_NEED_PVR_DPF;IMG_PSP2_PRX_EXPORT_INTERNAL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;DEBUG;SUPPORT_SGX543;PVRSRV_NEED_PVR_DPF;IMG_PSP2_PRX_EXPORT_INTERNAL;THREAD_SAFE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<GenerateDebugInformation>true</GenerateDebugInformation>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<AdditionalIncludeDirectories>$(SCE_PSP2_SDK_DIR)\target\include\vdsuite\user;$(SCE_PSP2_SDK_DIR)\target\include\vdsuite\common;$(SolutionDir)include\gpu_es4;$(SolutionDir)include\gpu_es4\eurasia\include4;$(SolutionDir)include\gpu_es4\eurasia\hwdefs;$(SolutionDir)include\gpu_es4\eurasia\services4\include;$(SolutionDir)include\gpu_es4\eurasia\services4\system\psp2;$(SolutionDir)codegen\pds;$(SolutionDir)codegen\pixevent;$(SolutionDir)codegen\usegen;$(SolutionDir)codegen\pixfmts;$(SolutionDir)include\gpu_es4\eurasia\services4\srvclient\devices\sgx;$(SolutionDir)codegen\ffgen;$(SolutionDir)tools\intern\useasm;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
Expand All @@ -128,13 +127,13 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|PSVita'">
<ClCompile>
<PreprocessorDefinitions>NDEBUG;SUPPORT_SGX543;IMG_PSP2_PRX_EXPORT_INTERNAL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;SUPPORT_SGX543;IMG_PSP2_PRX_EXPORT_INTERNAL;THREAD_SAFE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<OptimizationLevel>Level3</OptimizationLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<AdditionalIncludeDirectories>$(SCE_PSP2_SDK_DIR)\target\include\vdsuite\user;$(SCE_PSP2_SDK_DIR)\target\include\vdsuite\common;$(SolutionDir)include\gpu_es4;$(SolutionDir)include\gpu_es4\eurasia\include4;$(SolutionDir)include\gpu_es4\eurasia\hwdefs;$(SolutionDir)include\gpu_es4\eurasia\services4\include;$(SolutionDir)include\gpu_es4\eurasia\services4\system\psp2;$(SolutionDir)codegen\pds;$(SolutionDir)codegen\pixevent;$(SolutionDir)codegen\usegen;$(SolutionDir)codegen\pixfmts;$(SolutionDir)include\gpu_es4\eurasia\services4\srvclient\devices\sgx;$(SolutionDir)codegen\ffgen;$(SolutionDir)tools\intern\useasm;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalDependencies>-lSceGxm_stub;-lSceDisplayUser_stub;-lSceDisplay_stub;-lSceGpuEs4ForUser_stub;-lSceAppMgrUser_stub;-lScePower_stub;$(ProjectDir)libSceGpuEs4User_stub.a;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>-lSceGxm_stub;-lSceDisplayUser_stub;-lSceDisplay_stub;-lSceGpuEs4ForUser_stub;-lSceAppMgrUser_stub;-lScePower_stub;$(ProjectDir)libSceGpuEs4User_stub.a;-ltaihen_stub;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SCE_PSP2_SDK_DIR)\target\lib\vdsuite;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalOptions>--no-required-files</AdditionalOptions>
<InfoStripping>StripSymsAndDebug</InfoStripping>
Expand Down
3 changes: 0 additions & 3 deletions gpu_es4_ext/gpu_es4_ext.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,6 @@
<ClCompile Include="eurasia\services4\srvclient\devices\sgx\sgxtransfer_2d.c">
<Filter>Source Files\eurasia\services4\srvclient\devices\sgx</Filter>
</ClCompile>
<ClCompile Include="psp2\heap.c">
<Filter>Source Files\psp2</Filter>
</ClCompile>
<ClCompile Include="eurasia\services4\srvclient\devices\sgx\sgxtransfer_queue.c">
<Filter>Source Files\eurasia\services4\srvclient\devices\sgx</Filter>
</ClCompile>
Expand Down
Binary file modified gpu_es4_ext/libSceGpuEs4UserForVsh_stub.a
Binary file not shown.
Binary file modified gpu_es4_ext/libSceGpuEs4User_stub.a
Binary file not shown.
Loading

0 comments on commit fe7aa59

Please sign in to comment.