From 7167ccb5b94f15aec1758afe3c239c26be1747f0 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 17 Nov 2013 04:57:19 +0100 Subject: [PATCH] (RGL PS3) Replace more GCM_FUNC entries --- ps3/rgl/src/ps3/include/rgl-inline.h | 32 ++++++++++++++++++++++++++++ ps3/rgl/src/ps3/rgl_ps3.cpp | 10 ++++----- ps3/rgl/src/ps3/rgl_ps3_raster.cpp | 8 +++---- 3 files changed, 40 insertions(+), 10 deletions(-) diff --git a/ps3/rgl/src/ps3/include/rgl-inline.h b/ps3/rgl/src/ps3/include/rgl-inline.h index 091396977a..4edaaae5ff 100644 --- a/ps3/rgl/src/ps3/include/rgl-inline.h +++ b/ps3/rgl/src/ps3/include/rgl-inline.h @@ -150,6 +150,38 @@ static inline GLuint rglPlatformGetBitsPerPixel (GLenum internalFormat) (thisContext->current)[1] = (control1); \ (thisContext->current) += 2; +#define rglGcmSetBlendEnable(thisContext, enable) \ +{ \ + bool continue_func = true; \ + if(thisContext->current + (2) > thisContext->end) \ + { \ + if((*thisContext->callback)(thisContext, (2)) != 0) \ + continue_func = false; \ + } \ + if (continue_func) \ + { \ + (thisContext->current)[0] = (((1) << (18)) | ((0x00000310))); \ + (thisContext->current)[1] = (enable); \ + (thisContext->current) += 2; \ + } \ +} + +#define rglGcmSetBlendEnableMrt(thisContext, mrt1, mrt2, mrt3) \ + (thisContext->current)[0] = (((1) << (18)) | ((0x0000036c))); \ + (thisContext->current)[1] = (((mrt1) << 1)|((mrt2) << 2)|((mrt3) << 3)); \ + (thisContext->current) += 2 + +#define rglGcmSetBlendEquation(thisContext, color, alpha) \ + (thisContext->current)[0] = (((1) << (18)) | ((0x00000320))); \ + (thisContext->current)[1] = (((color)) | (((alpha)) << 16)); \ + (thisContext->current) += 2 + +#define rglGcmSetBlendFunc(thisContext, sfcolor, dfcolor, sfalpha, dfalpha) \ + (thisContext->current)[0] = (((2) << (18)) | ((0x00000314))); \ + (thisContext->current)[1] = (((sfcolor)) | (((sfalpha)) << 16)); \ + (thisContext->current)[2] = (((dfcolor)) | (((dfalpha)) << 16)); \ + (thisContext->current) += 3 + #define rglGcmSetUserClipPlaneControl(thisContext, plane0, plane1, plane2, plane3, plane4, plane5) \ (thisContext->current)[0] = (((1) << (18)) | CELL_GCM_NV4097_SET_USER_CLIP_PLANE_CONTROL); \ (thisContext->current)[1] = ((plane0) | ((plane1) << 4) | ((plane2) << 8) | ((plane3) << 12) | ((plane4) << 16) | ((plane5) << 20)); \ diff --git a/ps3/rgl/src/ps3/rgl_ps3.cpp b/ps3/rgl/src/ps3/rgl_ps3.cpp index 07229a1343..ed55d3624a 100644 --- a/ps3/rgl/src/ps3/rgl_ps3.cpp +++ b/ps3/rgl/src/ps3/rgl_ps3.cpp @@ -1587,15 +1587,13 @@ GLboolean rglGcmInitFromRM( rglGcmResource *rmResource ) rglGcmFifoFinish(ref, offset_bytes); // Set the GPU to a known state - // initialize the default OpenGL state rglGcmSetBlendColor(gCellGcmCurrentContext, 0, 0); - GCM_FUNC( cellGcmSetBlendEquation, RGLGCM_FUNC_ADD, RGLGCM_FUNC_ADD ); - GCM_FUNC( cellGcmSetBlendFunc, RGLGCM_ONE, RGLGCM_ZERO, RGLGCM_ONE, RGLGCM_ZERO ); + rglGcmSetBlendEquation(gCellGcmCurrentContext, RGLGCM_FUNC_ADD, RGLGCM_FUNC_ADD ); + rglGcmSetBlendFunc(gCellGcmCurrentContext, RGLGCM_ONE, RGLGCM_ZERO, RGLGCM_ONE, RGLGCM_ZERO ); rglGcmSetClearColor(thisContext, 0 ); - GCM_FUNC( cellGcmSetBlendEnable, RGLGCM_FALSE ); - GCM_FUNC( cellGcmSetBlendEnableMrt, RGLGCM_FALSE, RGLGCM_FALSE, RGLGCM_FALSE ); - GCM_FUNC( cellGcmSetFragmentProgramGammaEnable, RGLGCM_FALSE ); + rglGcmSetBlendEnable(gCellGcmCurrentContext, RGLGCM_FALSE ); + rglGcmSetBlendEnableMrt(gCellGcmCurrentContext, RGLGCM_FALSE, RGLGCM_FALSE, RGLGCM_FALSE ); for ( i = 0; i < RGLGCM_ATTRIB_COUNT; i++ ) { diff --git a/ps3/rgl/src/ps3/rgl_ps3_raster.cpp b/ps3/rgl/src/ps3/rgl_ps3_raster.cpp index 53f1f21248..cd845a17e1 100644 --- a/ps3/rgl/src/ps3/rgl_ps3_raster.cpp +++ b/ps3/rgl/src/ps3/rgl_ps3_raster.cpp @@ -1667,7 +1667,7 @@ GLAPI void APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count) { if ((LContext->Blending)) { - GCM_FUNC( cellGcmSetBlendEnable, LContext->Blending ); + rglGcmSetBlendEnable(gCellGcmCurrentContext, LContext->Blending ); rglGcmBlendState *blend = &rglGcmState_i.state.blend; GLuint hwColor; @@ -1683,9 +1683,9 @@ GLAPI void APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count) rglGcmSetBlendColor(gCellGcmCurrentContext, hwColor, hwColor); } - GCM_FUNC( cellGcmSetBlendEquation, (rglGcmEnum)LContext->BlendEquationRGB, - (rglGcmEnum)LContext->BlendEquationAlpha ); - GCM_FUNC( cellGcmSetBlendFunc, (rglGcmEnum)LContext->BlendFactorSrcRGB,(rglGcmEnum)LContext->BlendFactorDestRGB,(rglGcmEnum)LContext->BlendFactorSrcAlpha,(rglGcmEnum)LContext->BlendFactorDestAlpha); + rglGcmSetBlendEquation(gCellGcmCurrentContext, LContext->BlendEquationRGB, LContext->BlendEquationAlpha); + rglGcmSetBlendFunc(gCellGcmCurrentContext, LContext->BlendFactorSrcRGB, LContext->BlendFactorDestRGB, + LContext->BlendFactorSrcAlpha, LContext->BlendFactorDestAlpha); } }