Commit 0300e3c7 by Alexis Hetu Committed by Alexis Hétu

Implement simple OpenGL ES 3.0 parameter checks

Added some "low hanging fruit" implementations and quick validation checks for a portion of the GLES 3.0 API functions. Change-Id: I003031091bc2c2c32919896e86e38b5f1f43c555 Reviewed-on: https://swiftshader-review.googlesource.com/2610Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 52e18431
...@@ -1585,7 +1585,7 @@ bool Context::getIntegerv(GLenum pname, GLint *params) ...@@ -1585,7 +1585,7 @@ bool Context::getIntegerv(GLenum pname, GLint *params)
break; break;
case GL_MAX_COLOR_ATTACHMENTS: // integer, at least 8 case GL_MAX_COLOR_ATTACHMENTS: // integer, at least 8
UNIMPLEMENTED(); UNIMPLEMENTED();
*params = 8; *params = IMPLEMENTATION_MAX_COLOR_ATTACHMENTS;
break; break;
case GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS: // integer, at least 1 case GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS: // integer, at least 1
UNIMPLEMENTED(); UNIMPLEMENTED();
......
...@@ -43,7 +43,8 @@ enum ...@@ -43,7 +43,8 @@ enum
IMPLEMENTATION_MAX_TEXTURE_SIZE = 1 << (MIPMAP_LEVELS - 1), IMPLEMENTATION_MAX_TEXTURE_SIZE = 1 << (MIPMAP_LEVELS - 1),
IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE = 1 << (MIPMAP_LEVELS - 1), IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE = 1 << (MIPMAP_LEVELS - 1),
IMPLEMENTATION_MAX_RENDERBUFFER_SIZE = OUTLINE_RESOLUTION, IMPLEMENTATION_MAX_RENDERBUFFER_SIZE = OUTLINE_RESOLUTION,
IMPLEMENTATION_MAX_SAMPLES = 4 IMPLEMENTATION_MAX_SAMPLES = 4,
IMPLEMENTATION_MAX_COLOR_ATTACHMENTS = 8,
}; };
class Texture : public egl::Texture class Texture : public egl::Texture
......
...@@ -211,7 +211,8 @@ static FormatMap BuildFormatMap3D() ...@@ -211,7 +211,8 @@ static FormatMap BuildFormatMap3D()
InsertFormatMapping(map, GL_SRGB8_NV, GL_RGB, GL_UNSIGNED_BYTE); InsertFormatMapping(map, GL_SRGB8_NV, GL_RGB, GL_UNSIGNED_BYTE);
InsertFormatMapping(map, GL_RGB565, GL_RGB, GL_UNSIGNED_BYTE); InsertFormatMapping(map, GL_RGB565, GL_RGB, GL_UNSIGNED_BYTE);
InsertFormatMapping(map, GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5); InsertFormatMapping(map, GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5);
InsertFormatMapping(map, GL_RGB16F_EXT, GL_HALF_FLOAT_OES, GL_FLOAT); InsertFormatMapping(map, GL_RGB16F_EXT, GL_RGB, GL_HALF_FLOAT_OES);
InsertFormatMapping(map, GL_RGB16F_EXT, GL_RGB, GL_FLOAT);
InsertFormatMapping(map, GL_RGB32F_EXT, GL_RGB, GL_FLOAT); InsertFormatMapping(map, GL_RGB32F_EXT, GL_RGB, GL_FLOAT);
InsertFormatMapping(map, GL_RGBA8_OES, GL_RGBA, GL_UNSIGNED_BYTE); InsertFormatMapping(map, GL_RGBA8_OES, GL_RGBA, GL_UNSIGNED_BYTE);
InsertFormatMapping(map, GL_SRGB8_ALPHA8_EXT, GL_RGBA, GL_UNSIGNED_BYTE); InsertFormatMapping(map, GL_SRGB8_ALPHA8_EXT, GL_RGBA, GL_UNSIGNED_BYTE);
......
...@@ -211,9 +211,19 @@ namespace es2 ...@@ -211,9 +211,19 @@ namespace es2
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
case GL_ETC1_RGB8_OES: case GL_ETC1_RGB8_OES:
case GL_COMPRESSED_R11_EAC:
case GL_COMPRESSED_SIGNED_R11_EAC:
case GL_COMPRESSED_RGB8_ETC2:
case GL_COMPRESSED_SRGB8_ETC2:
case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
return 8 * (GLsizei)ceil((float)width / 4.0f) * (GLsizei)ceil((float)height / 4.0f); return 8 * (GLsizei)ceil((float)width / 4.0f) * (GLsizei)ceil((float)height / 4.0f);
case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE: case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE: case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
case GL_COMPRESSED_RG11_EAC:
case GL_COMPRESSED_SIGNED_RG11_EAC:
case GL_COMPRESSED_RGBA8_ETC2_EAC:
case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
return 16 * (GLsizei)ceil((float)width / 4.0f) * (GLsizei)ceil((float)height / 4.0f); return 16 * (GLsizei)ceil((float)width / 4.0f) * (GLsizei)ceil((float)height / 4.0f);
default: default:
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment