Commit 314531aa by Alexis Hetu Committed by Alexis Hétu

Fixed internal format queries

A few things were missing in internal format queries - GL_RGB and GL_RGBA are renderable formats - Integer types have no multisampling - If bufSize is 0, we should not write to the params output Change-Id: If6ba2f28b368e780eca8e89ef033deacf9cc523b Reviewed-on: https://swiftshader-review.googlesource.com/4752Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent b0c465cb
...@@ -3972,6 +3972,11 @@ GL_APICALL void GL_APIENTRY glGetInternalformativ(GLenum target, GLenum internal ...@@ -3972,6 +3972,11 @@ GL_APICALL void GL_APIENTRY glGetInternalformativ(GLenum target, GLenum internal
return error(GL_INVALID_VALUE); return error(GL_INVALID_VALUE);
} }
if(bufSize == 0)
{
return;
}
if(!IsColorRenderable(internalformat, egl::getClientVersion()) && !IsDepthRenderable(internalformat) && !IsStencilRenderable(internalformat)) if(!IsColorRenderable(internalformat, egl::getClientVersion()) && !IsDepthRenderable(internalformat) && !IsStencilRenderable(internalformat))
{ {
return error(GL_INVALID_ENUM); return error(GL_INVALID_ENUM);
...@@ -3985,13 +3990,48 @@ GL_APICALL void GL_APIENTRY glGetInternalformativ(GLenum target, GLenum internal ...@@ -3985,13 +3990,48 @@ GL_APICALL void GL_APIENTRY glGetInternalformativ(GLenum target, GLenum internal
return error(GL_INVALID_ENUM); return error(GL_INVALID_ENUM);
} }
// Integer types have no multisampling
GLint numMultisampleCounts = NUM_MULTISAMPLE_COUNTS;
switch(internalformat)
{
case GL_R8UI:
case GL_R8I:
case GL_R16UI:
case GL_R16I:
case GL_R32UI:
case GL_R32I:
case GL_RG8UI:
case GL_RG8I:
case GL_RG16UI:
case GL_RG16I:
case GL_RG32UI:
case GL_RG32I:
case GL_RGB8UI:
case GL_RGB8I:
case GL_RGB16UI:
case GL_RGB16I:
case GL_RGB32UI:
case GL_RGB32I:
case GL_RGBA8UI:
case GL_RGBA8I:
case GL_RGB10_A2UI:
case GL_RGBA16UI:
case GL_RGBA16I:
case GL_RGBA32UI:
case GL_RGBA32I:
numMultisampleCounts = 0;
break;
default:
break;
}
switch(pname) switch(pname)
{ {
case GL_NUM_SAMPLE_COUNTS: case GL_NUM_SAMPLE_COUNTS:
*params = NUM_MULTISAMPLE_COUNTS; *params = numMultisampleCounts;
break; break;
case GL_SAMPLES: case GL_SAMPLES:
for(int i = 0; i < NUM_MULTISAMPLE_COUNTS && i < bufSize; i++) for(int i = 0; i < numMultisampleCounts && i < bufSize; i++)
{ {
params[i] = multisampleCount[i]; params[i] = multisampleCount[i];
} }
......
...@@ -855,6 +855,8 @@ namespace es2 ...@@ -855,6 +855,8 @@ namespace es2
case GL_RGB565: case GL_RGB565:
case GL_RGB8_OES: case GL_RGB8_OES:
case GL_RGBA8_OES: case GL_RGBA8_OES:
case GL_RGB:
case GL_RGBA:
return true; return true;
case GL_R16F: case GL_R16F:
case GL_RG16F: case GL_RG16F:
...@@ -921,6 +923,8 @@ namespace es2 ...@@ -921,6 +923,8 @@ namespace es2
case GL_RGB565: case GL_RGB565:
case GL_RGB8_OES: case GL_RGB8_OES:
case GL_RGBA8_OES: case GL_RGBA8_OES:
case GL_RGB:
case GL_RGBA:
case GL_R16F: case GL_R16F:
case GL_RG16F: case GL_RG16F:
case GL_R11F_G11F_B10F: case GL_R11F_G11F_B10F:
...@@ -974,6 +978,8 @@ namespace es2 ...@@ -974,6 +978,8 @@ namespace es2
case GL_RGB565: case GL_RGB565:
case GL_RGB8_OES: case GL_RGB8_OES:
case GL_RGBA8_OES: case GL_RGBA8_OES:
case GL_RGB:
case GL_RGBA:
case GL_R16F: case GL_R16F:
case GL_RG16F: case GL_RG16F:
case GL_R11F_G11F_B10F: case GL_R11F_G11F_B10F:
......
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