OSDN Git Service

Adding support for more format/internalformat combinations
authorAlexis Hetu <sugoi@google.com>
Mon, 2 Oct 2017 19:27:03 +0000 (15:27 -0400)
committerAlexis Hétu <sugoi@google.com>
Tue, 3 Oct 2017 13:43:56 +0000 (13:43 +0000)
OpenGLES 3.0 allows for more combinations of format/internalformat
for floating point types. These types were already supported, just
not using the combinations added here.

Bug chromium:763384

Change-Id: I146548c2920799c7ea0d5d537d556ba562708147
Reviewed-on: https://swiftshader-review.googlesource.com/12928
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
src/OpenGL/common/Image.cpp

index f75f92f..79b186e 100644 (file)
@@ -663,10 +663,19 @@ namespace egl
                                return sw::FORMAT_G32R32F;
                        case GL_RGB:
                        case GL_RGB32F:
+                       case GL_R11F_G11F_B10F:
+                       case GL_RGB9_E5:
                                return sw::FORMAT_X32B32G32R32F;
                        case GL_RGBA:
                        case GL_RGBA32F:
                                return sw::FORMAT_A32B32G32R32F;
+                       case GL_R16F:
+                               return sw::FORMAT_R16F;
+                       case GL_RG16F:
+                               return sw::FORMAT_G16R16F;
+                       case GL_RGB16F:
+                       case GL_RGBA16F:
+                               return sw::FORMAT_A16B16G16R16F;
                        case GL_DEPTH_COMPONENT:
                        case GL_DEPTH_COMPONENT32F:
                                return sw::FORMAT_D32F;
@@ -697,6 +706,9 @@ namespace egl
                        case GL_RGBA:
                        case GL_RGBA16F:
                                return sw::FORMAT_A16B16G16R16F;
+                       case GL_R11F_G11F_B10F:
+                       case GL_RGB9_E5:
+                               return sw::FORMAT_X32B32G32R32F;
                        default:
                                UNREACHABLE(format);
                        }
@@ -1062,6 +1074,8 @@ namespace egl
                        case GL_RGB32F:          return sizeof(float) * 3;
                        case GL_RGBA:            return sizeof(float) * 4;
                        case GL_RGBA32F:         return sizeof(float) * 4;
+                       case GL_R11F_G11F_B10F:  return sizeof(int);
+                       case GL_RGB9_E5:         return sizeof(int);
                        default: UNREACHABLE(format);
                        }
                        break;
@@ -1083,6 +1097,8 @@ namespace egl
                        case GL_RGB16F:          return sizeof(unsigned short) * 3;
                        case GL_RGBA:            return sizeof(unsigned short) * 4;
                        case GL_RGBA16F:         return sizeof(unsigned short) * 4;
+                       case GL_R11F_G11F_B10F:  return sizeof(int);
+                       case GL_RGB9_E5:         return sizeof(int);
                        default: UNREACHABLE(format);
                        }
                        break;
@@ -1494,6 +1510,12 @@ namespace egl
                                        case GL_RGBA32F:
                                                LoadImageData<Bytes_16>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer);
                                                break;
+                                       case GL_R11F_G11F_B10F:
+                                               LoadImageData<R11G11B10F>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer);
+                                               break;
+                                       case GL_RGB9_E5:
+                                               LoadImageData<RGB9E5>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer);
+                                               break;
                                        case GL_DEPTH_COMPONENT:
                                        case GL_DEPTH_COMPONENT32F:
                                                LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer);
@@ -1533,6 +1555,12 @@ namespace egl
                                        case GL_RGBA16F:
                                                LoadImageData<Bytes_8>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer);
                                                break;
+                                       case GL_R11F_G11F_B10F:
+                                               LoadImageData<R11G11B10F>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer);
+                                               break;
+                                       case GL_RGB9_E5:
+                                               LoadImageData<RGB9E5>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer);
+                                               break;
                                        default: UNREACHABLE(format);
                                        }
                                        break;