From ca7c4e119e43935f659569dc8e2fb2445702ae70 Mon Sep 17 00:00:00 2001 From: raven02 Date: Sat, 17 May 2014 01:27:55 +0800 Subject: [PATCH 1/2] Fix CELL_GCM_TEXTURE_B8 opengl error 0x0500 --- rpcs3/Emu/GS/GL/GLGSRender.h | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/rpcs3/Emu/GS/GL/GLGSRender.h b/rpcs3/Emu/GS/GL/GLGSRender.h index 4d437f518a..a925633c04 100644 --- a/rpcs3/Emu/GS/GL/GLGSRender.h +++ b/rpcs3/Emu/GS/GL/GLGSRender.h @@ -84,11 +84,14 @@ public: switch(format) { case CELL_GCM_TEXTURE_B8: // One 8-bit fixed-point number + { glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex.GetWidth(), tex.GetHeight(), 0, GL_BLUE, GL_UNSIGNED_BYTE, pixels); checkForGlError("GLTexture::Init() -> glTexImage2D"); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, GL_BLUE); - checkForGlError("GLTexture::Init() -> glTexParameteri"); + + GLint swizzleMask[] = { GL_BLUE, GL_BLUE, GL_BLUE, GL_BLUE }; + glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask); + checkForGlError("GLTexture::Init() -> glTexParameteriv"); + } break; case CELL_GCM_TEXTURE_A8R8G8B8: @@ -157,12 +160,14 @@ public: break; case CELL_GCM_TEXTURE_X16: // A 16-bit fixed-point number + { glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex.GetWidth(), tex.GetHeight(), 0, GL_RED, GL_SHORT, pixels); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_ONE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, GL_ONE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_ONE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, GL_RED); checkForGlError("GLTexture::Init() -> glTexImage2D"); + + GLint swizzleMask[] = { GL_ONE, GL_ONE, GL_ONE, GL_RED }; + glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, swizzleMask); + checkForGlError("GLTexture::Init() -> glTexParameteriv"); + } break; case CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT: // Four fp16 values @@ -176,12 +181,14 @@ public: break; case CELL_GCM_TEXTURE_X32_FLOAT: // One 32-bit floating-point number + { glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex.GetWidth(), tex.GetHeight(), 0, GL_RED, GL_FLOAT, pixels); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_ONE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, GL_ONE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_ONE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, GL_RED); checkForGlError("GLTexture::Init() -> glTexImage2D"); + + GLint swizzleMask[] = { GL_ONE, GL_ONE, GL_ONE, GL_RED }; + glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask); + checkForGlError("GLTexture::Init() -> glTexParameteriv"); + } break; case CELL_GCM_TEXTURE_DEPTH24_D8: // 24-bit unsigned fixed-point number and 8 bits of garbage @@ -208,7 +215,9 @@ public: { glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex.GetWidth(), tex.GetHeight(), 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, pixels); checkForGlError("GLTexture::Init() -> glTexImage2D"); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, GL_ONE); + checkForGlError("GLTexture::Init() -> glTexParameteri"); } break; From e7a4eac6766b9790c7040776900b09c97198fc3a Mon Sep 17 00:00:00 2001 From: raven02 Date: Sat, 17 May 2014 01:44:13 +0800 Subject: [PATCH 2/2] Typo fix --- rpcs3/Emu/GS/GL/GLGSRender.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpcs3/Emu/GS/GL/GLGSRender.h b/rpcs3/Emu/GS/GL/GLGSRender.h index a925633c04..3e15598a8d 100644 --- a/rpcs3/Emu/GS/GL/GLGSRender.h +++ b/rpcs3/Emu/GS/GL/GLGSRender.h @@ -165,7 +165,7 @@ public: checkForGlError("GLTexture::Init() -> glTexImage2D"); GLint swizzleMask[] = { GL_ONE, GL_ONE, GL_ONE, GL_RED }; - glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, swizzleMask); + glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask); checkForGlError("GLTexture::Init() -> glTexParameteriv"); } break;