(RGL PS3) Cleanups

This commit is contained in:
twinaphex 2013-11-19 04:30:43 +01:00
parent d464d7ae4a
commit 81f437ee74
12 changed files with 45 additions and 119 deletions

View File

@ -21,8 +21,8 @@ INCDIRS = -I. -Ips3/rgl/include
RGL_DIR = ps3/rgl/src
PPU_SRCS = $(RGL_DIR)/libelf/readelf.c \
$(RGL_DIR)/ps3/rgl_ps3_raster.cpp \
$(RGL_DIR)/ps3/rgl_ps3.cpp
$(RGL_DIR)/rgl_ps3_raster.cpp \
$(RGL_DIR)/rgl_ps3.cpp
ifeq ($(CELL_BUILD_TOOLS), SNC)

View File

@ -1,9 +1,7 @@
#ifndef CGC_CGBIO_NVBIIMPL_HPP
#define CGC_CGBIO_NVBIIMPL_HPP
#include <string>
#include <vector>
#include <cstddef>
#include <Cg/cg.h>
#include <Cg/cgBinary.h>

View File

@ -327,13 +327,7 @@ enum {
enum {
RGLGCM_SURFACE_POOL_NONE,
RGLGCM_SURFACE_POOL_TILED_COLOR,
RGLGCM_SURFACE_POOL_TILED_DEPTH,
RGLGCM_SURFACE_POOL_LINEAR,
RGLGCM_SURFACE_POOL_SYSTEM, // GPU accessible host memory
RGLGCM_SURFACE_POOL_PPU, // generic EA
RGLGCM_SURFACE_POOL_SYSTEM_TILED_COLOR, // tiled color GPU accessible XDR
RGLGCM_SURFACE_POOL_SYSTEM_TILED_DEPTH, // tiled depth GPU accessible XDR
};

View File

@ -1,7 +1,5 @@
#include "../../../include/export/RGL/rgl.h"
#include "../../../include/RGL/Types.h"
using namespace cell::Gcm;
#include "../include/export/RGL/rgl.h"
#include "../include/RGL/Types.h"
typedef struct _tagMODESTRUC
{
@ -283,8 +281,6 @@ struct rglGcmResource
GLuint MemoryClock;
GLuint GraphicsClock;
unsigned long long ioifMappings[32];
char * linearMemory;
unsigned int persistentMemorySize;
@ -304,20 +300,7 @@ struct rglGcmResource
typedef struct
{
GLuint fence;
}
rglGcmFenceObject;
typedef struct
{
GLint sema; // NV semaphore index
}
rglGcmEventObject;
typedef struct
{
GLenum pool; // LINEAR, SYSTEM, or NONE
GLenum pool; // LINEAR, or NONE
unsigned int bufferId; // allocated Id
unsigned int bufferSize;
unsigned int pitch;
@ -348,20 +331,6 @@ struct rglGcmRenderTarget
CellGcmSurface gcmRenderTarget;
};
// cached state: texture
typedef struct rglGcmTextureState rglGcmTextureState;
struct rglGcmTextureState
{
// unforunately to many pieces of state have been put into single
// 32bit registers -- so we need to cache some of them...
GLuint hwTexAddress;
GLuint hwTexFilter;
GLuint hwTexControl0;
//GLuint hwTexCoordCtrl;
};
// cached state: viewport
typedef struct rglGcmViewportState rglGcmViewportState;
struct rglGcmViewportState
@ -398,10 +367,6 @@ struct rglGcmInterpolantState
typedef struct rglGcmCachedState rglGcmCachedState;
struct rglGcmCachedState
{
// our hw<->ogl mapping is ...let's say strange...
//rglGcmTextureState tex[RGLGCM_MAX_TEXIMAGE_COUNT];
//[RSTENSON] Removing this above. Texturing is all GCM now.
// we need to track blending color, too
rglGcmBlendState blend;

View File

@ -22,9 +22,6 @@
#include <string.h>
#include <stdlib.h>
#include <algorithm>
#include <iostream>
#include <Cg/cg.h>
#include <Cg/cgGL.h>
#include <Cg/CgCommon.h>

View File

@ -17,8 +17,8 @@
#include <stdint.h>
#include <stddef.h>
#include "../rgl.h"
#include "../rglp.h"
#include "rgl.h"
#include "rglp.h"
#include <sdk_version.h>
@ -1954,11 +1954,7 @@ static int rglGcmInitRM( rglGcmResource *gcmResource, int inSysMem, unsigned int
gcmResource->semaphores = ( rglGcmSemaphoreMemory * )cellGcmGetLabelAddress( 0 );
gcmResource->dmaControl = ( char* ) cellGcmGetControlRegister() - (( char * ) & (( rglGcmControlDma* )0 )->Put - ( char * )0 );
// the IOIF mapping don't work. work-around here.
for (GLuint i = 0; i < 32; ++i)
gcmResource->ioifMappings[i] = ( unsigned long long )( unsigned long )( gcmResource->localAddress + ( 64 << 20 ) * ( i / 4 ) );
cellGcmFinish(gCellGcmCurrentContext, 1); // added just a constant value for now to adjust to the inline libgcm interface change
cellGcmFinish(gCellGcmCurrentContext, 1);
gcmResource->hostMemorySize -= dmaPushBufferSize + RGLGCM_DMA_PUSH_BUFFER_PREFETCH_PADDING;
gcmResource->dmaPushBuffer = gcmResource->hostMemoryBase + gcmResource->hostMemorySize;

View File

@ -15,7 +15,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "../rgl_cg.h"
#include "rgl_cg.h"
static CGbool rglpSupportsVertexProgram( CGprofile p )
{

View File

@ -15,8 +15,8 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "../rgl.h"
#include "../rglp.h"
#include "rgl.h"
#include "rglp.h"
#include <sdk_version.h>
@ -1990,21 +1990,9 @@ void rglPlatformFreeGcmTexture (void *data)
{
rglTexture *texture = (rglTexture*)data;
rglGcmTexture *gcmTexture = ( rglGcmTexture * )texture->platformTexture;
switch ( gcmTexture->pool )
{
case RGLGCM_SURFACE_POOL_LINEAR:
gmmFree( gcmTexture->gpuAddressId );
break;
case RGLGCM_SURFACE_POOL_SYSTEM:
gmmFree( gcmTexture->gpuAddressId );
break;
case RGLGCM_SURFACE_POOL_TILED_COLOR:
rglGcmFreeTiledSurface( gcmTexture->gpuAddressId );
break;
case RGLGCM_SURFACE_POOL_NONE:
break;
}
if ( gcmTexture->pool == RGLGCM_SURFACE_POOL_LINEAR)
gmmFree( gcmTexture->gpuAddressId );
gcmTexture->gpuAddressId = GMM_ERROR;
gcmTexture->gpuAddressIdOffset = 0;
@ -2036,48 +2024,41 @@ static void rglPlatformValidateTextureResources (void *data)
GLuint size = 0;
GLuint id = GMM_ERROR;
if (texture->usage == GL_TEXTURE_LINEAR_SYSTEM_SCE ||
texture->usage == GL_TEXTURE_SWIZZLED_SYSTEM_SCE)
done = GL_TRUE;
const rglGcmTextureLayout currentLayout = gcmTexture->gpuLayout;
const GLuint currentSize = gcmTexture->gpuSize;
if (!done)
rglGcmTextureLayout newLayout;
// get layout and size compatible with this pool
rglImage *image = texture->image;
newLayout.levels = 1;
newLayout.faces = 1;
newLayout.baseWidth = image->width;
newLayout.baseHeight = image->height;
newLayout.baseDepth = image->depth;
newLayout.internalFormat = ( rglGcmEnum )image->internalFormat;
newLayout.pixelBits = rglPlatformGetBitsPerPixel( newLayout.internalFormat );
newLayout.pitch = GET_TEXTURE_PITCH(texture);
size = rglGetGcmTextureSize( &newLayout );
if ( currentSize >= size && newLayout.pitch == currentLayout.pitch )
gcmTexture->gpuLayout = newLayout;
else
{
rglGcmTextureLayout newLayout;
rglPlatformDropTexture( texture );
// get layout and size compatible with this pool
rglImage *image = texture->image;
// allocate in the specified pool
id = gmmAlloc(size);
newLayout.levels = 1;
newLayout.faces = 1;
newLayout.baseWidth = image->width;
newLayout.baseHeight = image->height;
newLayout.baseDepth = image->depth;
newLayout.internalFormat = ( rglGcmEnum )image->internalFormat;
newLayout.pixelBits = rglPlatformGetBitsPerPixel( newLayout.internalFormat );
newLayout.pitch = GET_TEXTURE_PITCH(texture);
// set new
gcmTexture->pool = RGLGCM_SURFACE_POOL_LINEAR;
gcmTexture->gpuAddressId = id;
gcmTexture->gpuAddressIdOffset = 0;
gcmTexture->gpuSize = size;
gcmTexture->gpuLayout = newLayout;
size = rglGetGcmTextureSize( &newLayout );
if ( currentSize >= size && newLayout.pitch == currentLayout.pitch )
gcmTexture->gpuLayout = newLayout;
else
{
rglPlatformDropTexture( texture );
// allocate in the specified pool
id = gmmAlloc(size);
// set new
gcmTexture->pool = RGLGCM_SURFACE_POOL_LINEAR;
gcmTexture->gpuAddressId = id;
gcmTexture->gpuAddressIdOffset = 0;
gcmTexture->gpuSize = size;
gcmTexture->gpuLayout = newLayout;
}
}
rglTextureTouchFBOs( texture );
@ -2116,9 +2097,6 @@ source: RGLGCM_SURFACE_SOURCE_TEXTURE,
// use a bounce buffer to transfer to GPU
GLuint bounceBufferId = GMM_ERROR;
// check if upload is needed for this image
rglImage *image = texture->image;
if ( image->dataState == RGL_IMAGE_DATASTATE_HOST )
{
// lazy allocation of bounce buffer
@ -2211,9 +2189,9 @@ source: RGLGCM_SURFACE_SOURCE_TEXTURE,
// set the SET_TEXTURE_CONTROL0 params
platformTexture->gcmMethods.control0.maxAniso = CELL_GCM_TEXTURE_MAX_ANISO_1;
const GLfloat minLOD = MAX( texture->minLod, 0);
const GLfloat maxLOD = MIN( texture->maxLod, texture->maxLevel );
const GLfloat maxLOD = MIN( texture->maxLod, 0 );
platformTexture->gcmMethods.control0.minLOD = ( GLuint )( MAX( minLOD, 0 ) * 256.0f );
platformTexture->gcmMethods.control0.maxLOD = ( GLuint )( MIN( maxLOD, layout->levels ) * 256.0f );
platformTexture->gcmMethods.control0.maxLOD = ( GLuint )( MIN( maxLOD, 1 ) * 256.0f );
// -----------------------------------------------------------------------
// set the SET_TEXTURE_ADDRESS method params.
@ -2467,7 +2445,7 @@ source: RGLGCM_SURFACE_SOURCE_TEXTURE,
platformTexture->gcmTexture.height = layout->baseHeight;
platformTexture->gcmTexture.depth = layout->baseDepth;
platformTexture->gcmTexture.pitch = layout->pitch;
platformTexture->gcmTexture.mipmap = layout->levels;
platformTexture->gcmTexture.mipmap = 1;
platformTexture->gcmTexture.cubemap = CELL_GCM_FALSE;
platformTexture->gcmTexture.dimension = CELL_GCM_TEXTURE_DIMENSION_2;
platformTexture->gcmTexture.location = CELL_GCM_LOCATION_LOCAL;

View File

@ -18,9 +18,7 @@
#ifndef _RGLP_H_
#define _RGLP_H_
#if defined(__CELLOS_LV2__)
#include "ps3/include/rgl-constants.h"
#endif
#include "include/rgl-constants.h"
extern GLboolean rglpCreateBufferObject (void *data);