Commit 11b038be by He Yunchao Committed by Commit Bot

ES31: Implement glGetTexLevelParameter{i|f}v entry point

BUG=angleproject:1679 TEST=dEQP-GLES31.functional.state_query.texture_level.* Change-Id: I36cc7406199fc0c3c1585ad48f010d7dba5fe9e4 Reviewed-on: https://chromium-review.googlesource.com/414250 Commit-Queue: Yunchao He <yunchao.he@intel.com> Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent 7cc14ee8
...@@ -42,16 +42,17 @@ bool IsMipmapFiltered(const gl::SamplerState &samplerState) ...@@ -42,16 +42,17 @@ bool IsMipmapFiltered(const gl::SamplerState &samplerState)
{ {
switch (samplerState.minFilter) switch (samplerState.minFilter)
{ {
case GL_NEAREST: case GL_NEAREST:
case GL_LINEAR: case GL_LINEAR:
return false; return false;
case GL_NEAREST_MIPMAP_NEAREST: case GL_NEAREST_MIPMAP_NEAREST:
case GL_LINEAR_MIPMAP_NEAREST: case GL_LINEAR_MIPMAP_NEAREST:
case GL_NEAREST_MIPMAP_LINEAR: case GL_NEAREST_MIPMAP_LINEAR:
case GL_LINEAR_MIPMAP_LINEAR: case GL_LINEAR_MIPMAP_LINEAR:
return true; return true;
default: UNREACHABLE(); default:
return false; UNREACHABLE();
return false;
} }
} }
...@@ -135,7 +136,7 @@ GLuint TextureState::getEffectiveMaxLevel() const ...@@ -135,7 +136,7 @@ GLuint TextureState::getEffectiveMaxLevel() const
GLuint TextureState::getMipmapMaxLevel() const GLuint TextureState::getMipmapMaxLevel() const
{ {
const ImageDesc &baseImageDesc = getImageDesc(getBaseImageTarget(), getEffectiveBaseLevel()); const ImageDesc &baseImageDesc = getImageDesc(getBaseImageTarget(), getEffectiveBaseLevel());
GLuint expectedMipLevels = 0; GLuint expectedMipLevels = 0;
if (mTarget == GL_TEXTURE_3D) if (mTarget == GL_TEXTURE_3D)
{ {
const int maxDim = std::max(std::max(baseImageDesc.size.width, baseImageDesc.size.height), const int maxDim = std::max(std::max(baseImageDesc.size.width, baseImageDesc.size.height),
...@@ -413,11 +414,20 @@ GLenum TextureState::getBaseImageTarget() const ...@@ -413,11 +414,20 @@ GLenum TextureState::getBaseImageTarget() const
return mTarget == GL_TEXTURE_CUBE_MAP ? FirstCubeMapTextureTarget : mTarget; return mTarget == GL_TEXTURE_CUBE_MAP ? FirstCubeMapTextureTarget : mTarget;
} }
ImageDesc::ImageDesc() : ImageDesc(Extents(0, 0, 0), Format::Invalid()) ImageDesc::ImageDesc() : ImageDesc(Extents(0, 0, 0), Format::Invalid(), 0, GL_TRUE)
{ {
} }
ImageDesc::ImageDesc(const Extents &size, const Format &format) : size(size), format(format) ImageDesc::ImageDesc(const Extents &size, const Format &format)
: size(size), format(format), samples(0), fixedSampleLocations(GL_TRUE)
{
}
ImageDesc::ImageDesc(const Extents &size,
const Format &format,
const GLsizei samples,
GLboolean fixedSampleLocations)
: size(size), format(format), samples(samples), fixedSampleLocations(fixedSampleLocations)
{ {
} }
...@@ -763,6 +773,20 @@ GLenum Texture::getUsage() const ...@@ -763,6 +773,20 @@ GLenum Texture::getUsage() const
return mState.mUsage; return mState.mUsage;
} }
GLsizei Texture::getSamples(GLenum target, size_t level) const
{
ASSERT(target == mState.mTarget ||
(mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target)));
return mState.getImageDesc(target, level).samples;
}
GLboolean Texture::getFixedSampleLocations(GLenum target, size_t level) const
{
ASSERT(target == mState.mTarget ||
(mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target)));
return mState.getImageDesc(target, level).fixedSampleLocations;
}
const TextureState &Texture::getTextureState() const const TextureState &Texture::getTextureState() const
{ {
return mState; return mState;
...@@ -888,7 +912,10 @@ Error Texture::setCompressedSubImage(const PixelUnpackState &unpackState, ...@@ -888,7 +912,10 @@ Error Texture::setCompressedSubImage(const PixelUnpackState &unpackState,
pixels); pixels);
} }
Error Texture::copyImage(GLenum target, size_t level, const Rectangle &sourceArea, GLenum internalFormat, Error Texture::copyImage(GLenum target,
size_t level,
const Rectangle &sourceArea,
GLenum internalFormat,
const Framebuffer *source) const Framebuffer *source)
{ {
ASSERT(target == mState.mTarget || ASSERT(target == mState.mTarget ||
...@@ -908,7 +935,10 @@ Error Texture::copyImage(GLenum target, size_t level, const Rectangle &sourceAre ...@@ -908,7 +935,10 @@ Error Texture::copyImage(GLenum target, size_t level, const Rectangle &sourceAre
return NoError(); return NoError();
} }
Error Texture::copySubImage(GLenum target, size_t level, const Offset &destOffset, const Rectangle &sourceArea, Error Texture::copySubImage(GLenum target,
size_t level,
const Offset &destOffset,
const Rectangle &sourceArea,
const Framebuffer *source) const Framebuffer *source)
{ {
ASSERT(target == mState.mTarget || ASSERT(target == mState.mTarget ||
...@@ -1137,7 +1167,7 @@ const Format &Texture::getAttachmentFormat(const gl::FramebufferAttachment::Targ ...@@ -1137,7 +1167,7 @@ const Format &Texture::getAttachmentFormat(const gl::FramebufferAttachment::Targ
return getFormat(target.textureIndex().type, target.textureIndex().mipIndex); return getFormat(target.textureIndex().type, target.textureIndex().mipIndex);
} }
GLsizei Texture::getAttachmentSamples(const gl::FramebufferAttachment::Target &/*target*/) const GLsizei Texture::getAttachmentSamples(const gl::FramebufferAttachment::Target & /*target*/) const
{ {
// Multisample textures not currently supported // Multisample textures not currently supported
return 0; return 0;
......
...@@ -49,12 +49,18 @@ struct ImageDesc final ...@@ -49,12 +49,18 @@ struct ImageDesc final
{ {
ImageDesc(); ImageDesc();
ImageDesc(const Extents &size, const Format &format); ImageDesc(const Extents &size, const Format &format);
ImageDesc(const Extents &size,
const Format &format,
const GLsizei samples,
GLboolean fixedSampleLocations);
ImageDesc(const ImageDesc &other) = default; ImageDesc(const ImageDesc &other) = default;
ImageDesc &operator=(const ImageDesc &other) = default; ImageDesc &operator=(const ImageDesc &other) = default;
Extents size; Extents size;
Format format; Format format;
GLsizei samples;
GLboolean fixedSampleLocations;
}; };
struct SwizzleState final struct SwizzleState final
...@@ -240,6 +246,10 @@ class Texture final : public egl::ImageSibling, ...@@ -240,6 +246,10 @@ class Texture final : public egl::ImageSibling,
void setUsage(GLenum usage); void setUsage(GLenum usage);
GLenum getUsage() const; GLenum getUsage() const;
GLsizei getSamples(GLenum target, size_t level) const;
GLboolean getFixedSampleLocations(GLenum target, size_t level) const;
const TextureState &getTextureState() const; const TextureState &getTextureState() const;
size_t getWidth(GLenum target, size_t level) const; size_t getWidth(GLenum target, size_t level) const;
...@@ -400,4 +410,4 @@ inline bool operator!=(const TextureState &a, const TextureState &b) ...@@ -400,4 +410,4 @@ inline bool operator!=(const TextureState &a, const TextureState &b)
} }
} }
#endif // LIBANGLE_TEXTURE_H_ #endif // LIBANGLE_TEXTURE_H_
...@@ -26,6 +26,86 @@ namespace gl ...@@ -26,6 +26,86 @@ namespace gl
namespace namespace
{ {
template <typename ParamType> template <typename ParamType>
void QueryTexLevelParameterBase(const Texture *texture,
GLenum target,
GLint level,
GLenum pname,
ParamType *params)
{
ASSERT(texture != nullptr);
const InternalFormat *info = texture->getTextureState().getImageDesc(target, level).format.info;
switch (pname)
{
case GL_TEXTURE_RED_TYPE:
*params = ConvertFromGLenum<ParamType>(info->redBits ? info->componentType : GL_NONE);
break;
case GL_TEXTURE_GREEN_TYPE:
*params = ConvertFromGLenum<ParamType>(info->greenBits ? info->componentType : GL_NONE);
break;
case GL_TEXTURE_BLUE_TYPE:
*params = ConvertFromGLenum<ParamType>(info->blueBits ? info->componentType : GL_NONE);
break;
case GL_TEXTURE_ALPHA_TYPE:
*params = ConvertFromGLenum<ParamType>(info->alphaBits ? info->componentType : GL_NONE);
break;
case GL_TEXTURE_DEPTH_TYPE:
*params = ConvertFromGLenum<ParamType>(info->depthBits ? info->componentType : GL_NONE);
break;
case GL_TEXTURE_RED_SIZE:
*params = ConvertFromGLuint<ParamType>(info->redBits);
break;
case GL_TEXTURE_GREEN_SIZE:
*params = ConvertFromGLuint<ParamType>(info->greenBits);
break;
case GL_TEXTURE_BLUE_SIZE:
*params = ConvertFromGLuint<ParamType>(info->blueBits);
break;
case GL_TEXTURE_ALPHA_SIZE:
*params = ConvertFromGLuint<ParamType>(info->alphaBits);
break;
case GL_TEXTURE_DEPTH_SIZE:
*params = ConvertFromGLuint<ParamType>(info->depthBits);
break;
case GL_TEXTURE_STENCIL_SIZE:
*params = ConvertFromGLuint<ParamType>(info->stencilBits);
break;
case GL_TEXTURE_SHARED_SIZE:
*params = ConvertFromGLuint<ParamType>(info->sharedBits);
break;
case GL_TEXTURE_INTERNAL_FORMAT:
*params =
ConvertFromGLenum<ParamType>(info->internalFormat ? info->internalFormat : GL_RGBA);
break;
case GL_TEXTURE_WIDTH:
*params =
ConvertFromGLint<ParamType>(static_cast<GLint>(texture->getWidth(target, level)));
break;
case GL_TEXTURE_HEIGHT:
*params =
ConvertFromGLint<ParamType>(static_cast<GLint>(texture->getHeight(target, level)));
break;
case GL_TEXTURE_DEPTH:
*params =
ConvertFromGLint<ParamType>(static_cast<GLint>(texture->getDepth(target, level)));
break;
case GL_TEXTURE_SAMPLES:
*params = ConvertFromGLint<ParamType>(texture->getSamples(target, level));
break;
case GL_TEXTURE_FIXED_SAMPLE_LOCATIONS:
*params =
ConvertFromGLboolean<ParamType>(texture->getFixedSampleLocations(target, level));
break;
case GL_TEXTURE_COMPRESSED:
*params = ConvertFromGLboolean<ParamType>(info->compressed);
break;
default:
UNREACHABLE();
break;
}
}
template <typename ParamType>
void QueryTexParameterBase(const Texture *texture, GLenum pname, ParamType *params) void QueryTexParameterBase(const Texture *texture, GLenum pname, ParamType *params)
{ {
ASSERT(texture != nullptr); ASSERT(texture != nullptr);
...@@ -599,6 +679,24 @@ void QueryShaderiv(const Shader *shader, GLenum pname, GLint *params) ...@@ -599,6 +679,24 @@ void QueryShaderiv(const Shader *shader, GLenum pname, GLint *params)
} }
} }
void QueryTexLevelParameterfv(const Texture *texture,
GLenum target,
GLint level,
GLenum pname,
GLfloat *params)
{
QueryTexLevelParameterBase(texture, target, level, pname, params);
}
void QueryTexLevelParameteriv(const Texture *texture,
GLenum target,
GLint level,
GLenum pname,
GLint *params)
{
QueryTexLevelParameterBase(texture, target, level, pname, params);
}
void QueryTexParameterfv(const Texture *texture, GLenum pname, GLfloat *params) void QueryTexParameterfv(const Texture *texture, GLenum pname, GLfloat *params)
{ {
QueryTexParameterBase(texture, pname, params); QueryTexParameterBase(texture, pname, params);
......
...@@ -36,6 +36,16 @@ void QueryBufferPointerv(const Buffer *buffer, GLenum pname, void **params); ...@@ -36,6 +36,16 @@ void QueryBufferPointerv(const Buffer *buffer, GLenum pname, void **params);
void QueryProgramiv(const Program *program, GLenum pname, GLint *params); void QueryProgramiv(const Program *program, GLenum pname, GLint *params);
void QueryRenderbufferiv(const Renderbuffer *renderbuffer, GLenum pname, GLint *params); void QueryRenderbufferiv(const Renderbuffer *renderbuffer, GLenum pname, GLint *params);
void QueryShaderiv(const Shader *shader, GLenum pname, GLint *params); void QueryShaderiv(const Shader *shader, GLenum pname, GLint *params);
void QueryTexLevelParameterfv(const Texture *texture,
GLenum target,
GLint level,
GLenum pname,
GLfloat *params);
void QueryTexLevelParameteriv(const Texture *texture,
GLenum target,
GLint level,
GLenum pname,
GLint *params);
void QueryTexParameterfv(const Texture *texture, GLenum pname, GLfloat *params); void QueryTexParameterfv(const Texture *texture, GLenum pname, GLfloat *params);
void QueryTexParameteriv(const Texture *texture, GLenum pname, GLint *params); void QueryTexParameteriv(const Texture *texture, GLenum pname, GLint *params);
void QuerySamplerParameterfv(const Sampler *sampler, GLenum pname, GLfloat *params); void QuerySamplerParameterfv(const Sampler *sampler, GLenum pname, GLfloat *params);
......
...@@ -1439,6 +1439,26 @@ bool ValidTexture3DDestinationTarget(const ValidationContext *context, GLenum ta ...@@ -1439,6 +1439,26 @@ bool ValidTexture3DDestinationTarget(const ValidationContext *context, GLenum ta
} }
} }
bool ValidTexLevelDestinationTarget(const ValidationContext *context, GLenum target)
{
switch (target)
{
case GL_TEXTURE_2D:
case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
case GL_TEXTURE_3D:
case GL_TEXTURE_2D_ARRAY:
case GL_TEXTURE_2D_MULTISAMPLE:
return true;
default:
return false;
}
}
bool ValidFramebufferTarget(GLenum target) bool ValidFramebufferTarget(GLenum target)
{ {
static_assert(GL_DRAW_FRAMEBUFFER_ANGLE == GL_DRAW_FRAMEBUFFER && static_assert(GL_DRAW_FRAMEBUFFER_ANGLE == GL_DRAW_FRAMEBUFFER &&
...@@ -1512,6 +1532,9 @@ bool ValidMipLevel(const ValidationContext *context, GLenum target, GLint level) ...@@ -1512,6 +1532,9 @@ bool ValidMipLevel(const ValidationContext *context, GLenum target, GLint level)
case GL_TEXTURE_2D_ARRAY: case GL_TEXTURE_2D_ARRAY:
maxDimension = caps.max2DTextureSize; maxDimension = caps.max2DTextureSize;
break; break;
case GL_TEXTURE_2D_MULTISAMPLE:
maxDimension = caps.max2DTextureSize;
break;
default: default:
UNREACHABLE(); UNREACHABLE();
} }
......
...@@ -35,6 +35,7 @@ bool ValidTexture3DTarget(const ValidationContext *context, GLenum target); ...@@ -35,6 +35,7 @@ bool ValidTexture3DTarget(const ValidationContext *context, GLenum target);
bool ValidTextureExternalTarget(const ValidationContext *context, GLenum target); bool ValidTextureExternalTarget(const ValidationContext *context, GLenum target);
bool ValidTexture2DDestinationTarget(const ValidationContext *context, GLenum target); bool ValidTexture2DDestinationTarget(const ValidationContext *context, GLenum target);
bool ValidTexture3DDestinationTarget(const ValidationContext *context, GLenum target); bool ValidTexture3DDestinationTarget(const ValidationContext *context, GLenum target);
bool ValidTexLevelDestinationTarget(const ValidationContext *context, GLenum target);
bool ValidFramebufferTarget(GLenum target); bool ValidFramebufferTarget(GLenum target);
bool ValidBufferTarget(const ValidationContext *context, GLenum target); bool ValidBufferTarget(const ValidationContext *context, GLenum target);
bool ValidBufferParameter(const ValidationContext *context, GLenum pname, GLsizei *numParams); bool ValidBufferParameter(const ValidationContext *context, GLenum pname, GLsizei *numParams);
...@@ -73,13 +74,24 @@ Program *GetValidProgram(ValidationContext *context, GLuint id); ...@@ -73,13 +74,24 @@ Program *GetValidProgram(ValidationContext *context, GLuint id);
Shader *GetValidShader(ValidationContext *context, GLuint id); Shader *GetValidShader(ValidationContext *context, GLuint id);
bool ValidateAttachmentTarget(Context *context, GLenum attachment); bool ValidateAttachmentTarget(Context *context, GLenum attachment);
bool ValidateRenderbufferStorageParametersBase(Context *context, GLenum target, GLsizei samples, bool ValidateRenderbufferStorageParametersBase(Context *context,
GLenum internalformat, GLsizei width, GLsizei height); GLenum target,
bool ValidateRenderbufferStorageParametersANGLE(Context *context, GLenum target, GLsizei samples, GLsizei samples,
GLenum internalformat, GLsizei width, GLsizei height); GLenum internalformat,
GLsizei width,
bool ValidateFramebufferRenderbufferParameters(Context *context, GLenum target, GLenum attachment, GLsizei height);
GLenum renderbuffertarget, GLuint renderbuffer); bool ValidateRenderbufferStorageParametersANGLE(Context *context,
GLenum target,
GLsizei samples,
GLenum internalformat,
GLsizei width,
GLsizei height);
bool ValidateFramebufferRenderbufferParameters(Context *context,
GLenum target,
GLenum attachment,
GLenum renderbuffertarget,
GLuint renderbuffer);
bool ValidateBlitFramebufferParameters(ValidationContext *context, bool ValidateBlitFramebufferParameters(ValidationContext *context,
GLint srcX0, GLint srcX0,
...@@ -192,7 +204,10 @@ bool ValidateProgramUniformMatrix(Context *context, ...@@ -192,7 +204,10 @@ bool ValidateProgramUniformMatrix(Context *context,
GLboolean transpose); GLboolean transpose);
bool ValidateUniform(Context *context, GLenum uniformType, GLint location, GLsizei count); bool ValidateUniform(Context *context, GLenum uniformType, GLint location, GLsizei count);
bool ValidateUniformMatrix(Context *context, GLenum matrixType, GLint location, GLsizei count, bool ValidateUniformMatrix(Context *context,
GLenum matrixType,
GLint location,
GLsizei count,
GLboolean transpose); GLboolean transpose);
bool ValidateStateQuery(ValidationContext *context, bool ValidateStateQuery(ValidationContext *context,
...@@ -227,8 +242,16 @@ bool ValidateDrawArrays(ValidationContext *context, ...@@ -227,8 +242,16 @@ bool ValidateDrawArrays(ValidationContext *context,
GLint first, GLint first,
GLsizei count, GLsizei count,
GLsizei primcount); GLsizei primcount);
bool ValidateDrawArraysInstanced(Context *context, GLenum mode, GLint first, GLsizei count, GLsizei primcount); bool ValidateDrawArraysInstanced(Context *context,
bool ValidateDrawArraysInstancedANGLE(Context *context, GLenum mode, GLint first, GLsizei count, GLsizei primcount); GLenum mode,
GLint first,
GLsizei count,
GLsizei primcount);
bool ValidateDrawArraysInstancedANGLE(Context *context,
GLenum mode,
GLint first,
GLsizei count,
GLsizei primcount);
bool ValidateDrawElementsBase(ValidationContext *context, GLenum type); bool ValidateDrawElementsBase(ValidationContext *context, GLenum type);
bool ValidateDrawElements(ValidationContext *context, bool ValidateDrawElements(ValidationContext *context,
...@@ -254,10 +277,17 @@ bool ValidateDrawElementsInstancedANGLE(Context *context, ...@@ -254,10 +277,17 @@ bool ValidateDrawElementsInstancedANGLE(Context *context,
GLsizei primcount, GLsizei primcount,
IndexRange *indexRangeOut); IndexRange *indexRangeOut);
bool ValidateFramebufferTextureBase(Context *context, GLenum target, GLenum attachment, bool ValidateFramebufferTextureBase(Context *context,
GLuint texture, GLint level); GLenum target,
bool ValidateFramebufferTexture2D(Context *context, GLenum target, GLenum attachment, GLenum attachment,
GLenum textarget, GLuint texture, GLint level); GLuint texture,
GLint level);
bool ValidateFramebufferTexture2D(Context *context,
GLenum target,
GLenum attachment,
GLenum textarget,
GLuint texture,
GLint level);
bool ValidateFramebufferRenderbuffer(Context *context, bool ValidateFramebufferRenderbuffer(Context *context,
GLenum target, GLenum target,
GLenum attachment, GLenum attachment,
...@@ -265,10 +295,18 @@ bool ValidateFramebufferRenderbuffer(Context *context, ...@@ -265,10 +295,18 @@ bool ValidateFramebufferRenderbuffer(Context *context,
GLuint renderbuffer); GLuint renderbuffer);
bool ValidateGetUniformBase(Context *context, GLuint program, GLint location); bool ValidateGetUniformBase(Context *context, GLuint program, GLint location);
bool ValidateGetUniformfv(Context *context, GLuint program, GLint location, GLfloat* params); bool ValidateGetUniformfv(Context *context, GLuint program, GLint location, GLfloat *params);
bool ValidateGetUniformiv(Context *context, GLuint program, GLint location, GLint* params); bool ValidateGetUniformiv(Context *context, GLuint program, GLint location, GLint *params);
bool ValidateGetnUniformfvEXT(Context *context, GLuint program, GLint location, GLsizei bufSize, GLfloat* params); bool ValidateGetnUniformfvEXT(Context *context,
bool ValidateGetnUniformivEXT(Context *context, GLuint program, GLint location, GLsizei bufSize, GLint* params); GLuint program,
GLint location,
GLsizei bufSize,
GLfloat *params);
bool ValidateGetnUniformivEXT(Context *context,
GLuint program,
GLint location,
GLsizei bufSize,
GLint *params);
bool ValidateGetUniformfvRobustANGLE(Context *context, bool ValidateGetUniformfvRobustANGLE(Context *context,
GLuint program, GLuint program,
GLint location, GLint location,
...@@ -288,8 +326,11 @@ bool ValidateGetUniformuivRobustANGLE(Context *context, ...@@ -288,8 +326,11 @@ bool ValidateGetUniformuivRobustANGLE(Context *context,
GLsizei *length, GLsizei *length,
GLuint *params); GLuint *params);
bool ValidateDiscardFramebufferBase(Context *context, GLenum target, GLsizei numAttachments, bool ValidateDiscardFramebufferBase(Context *context,
const GLenum *attachments, bool defaultFramebuffer); GLenum target,
GLsizei numAttachments,
const GLenum *attachments,
bool defaultFramebuffer);
bool ValidateInsertEventMarkerEXT(Context *context, GLsizei length, const char *marker); bool ValidateInsertEventMarkerEXT(Context *context, GLsizei length, const char *marker);
bool ValidatePushGroupMarkerEXT(Context *context, GLsizei length, const char *marker); bool ValidatePushGroupMarkerEXT(Context *context, GLsizei length, const char *marker);
...@@ -572,4 +613,4 @@ bool ValidateGetInternalFormativRobustANGLE(Context *context, ...@@ -572,4 +613,4 @@ bool ValidateGetInternalFormativRobustANGLE(Context *context,
extern const char *g_ExceedsMaxElementErrorMessage; extern const char *g_ExceedsMaxElementErrorMessage;
} // namespace gl } // namespace gl
#endif // LIBANGLE_VALIDATION_ES_H_ #endif // LIBANGLE_VALIDATION_ES_H_
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#include "libANGLE/validationES3.h" #include "libANGLE/validationES3.h"
#include "libANGLE/VertexArray.h" #include "libANGLE/VertexArray.h"
#include "common/utilities.h"
using namespace angle; using namespace angle;
namespace gl namespace gl
...@@ -180,4 +182,96 @@ bool ValidateDrawElementsIndirect(Context *context, ...@@ -180,4 +182,96 @@ bool ValidateDrawElementsIndirect(Context *context,
return true; return true;
} }
bool ValidateGetTexLevelParameterBase(Context *context,
GLenum target,
GLint level,
GLenum pname,
GLsizei *length)
{
if (context->getClientVersion() < ES_3_1)
{
context->handleError(Error(GL_INVALID_OPERATION, "Context does not support GLES3.1"));
return false;
}
if (length)
{
*length = 0;
}
if (!ValidTexLevelDestinationTarget(context, target))
{
context->handleError(Error(GL_INVALID_ENUM, "Invalid texture target"));
return false;
}
if (context->getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target) ==
nullptr)
{
context->handleError(Error(GL_INVALID_ENUM, "No texture bound."));
return false;
}
if (!ValidMipLevel(context, target, level))
{
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
switch (pname)
{
case GL_TEXTURE_RED_TYPE:
case GL_TEXTURE_GREEN_TYPE:
case GL_TEXTURE_BLUE_TYPE:
case GL_TEXTURE_ALPHA_TYPE:
case GL_TEXTURE_DEPTH_TYPE:
break;
case GL_TEXTURE_RED_SIZE:
case GL_TEXTURE_GREEN_SIZE:
case GL_TEXTURE_BLUE_SIZE:
case GL_TEXTURE_ALPHA_SIZE:
case GL_TEXTURE_DEPTH_SIZE:
case GL_TEXTURE_STENCIL_SIZE:
case GL_TEXTURE_SHARED_SIZE:
break;
case GL_TEXTURE_INTERNAL_FORMAT:
case GL_TEXTURE_WIDTH:
case GL_TEXTURE_HEIGHT:
case GL_TEXTURE_DEPTH:
break;
case GL_TEXTURE_SAMPLES:
case GL_TEXTURE_FIXED_SAMPLE_LOCATIONS:
break;
case GL_TEXTURE_COMPRESSED:
break;
default:
context->handleError(Error(GL_INVALID_ENUM, "Unknown pname."));
return false;
}
if (length)
{
*length = 1;
}
return true;
}
bool ValidateGetTexLevelParameterfv(Context *context,
GLenum target,
GLint level,
GLenum pname,
GLfloat *params)
{
return ValidateGetTexLevelParameterBase(context, target, level, pname, nullptr);
}
bool ValidateGetTexLevelParameteriv(Context *context,
GLenum target,
GLint level,
GLenum pname,
GLint *params)
{
return ValidateGetTexLevelParameterBase(context, target, level, pname, nullptr);
}
} // namespace gl } // namespace gl
...@@ -22,6 +22,16 @@ bool ValidateGetBooleani_vRobustANGLE(Context *context, ...@@ -22,6 +22,16 @@ bool ValidateGetBooleani_vRobustANGLE(Context *context,
GLsizei bufSize, GLsizei bufSize,
GLsizei *length, GLsizei *length,
GLboolean *data); GLboolean *data);
bool ValidateGetTexLevelParameterfv(Context *context,
GLenum target,
GLint level,
GLenum pname,
GLfloat *params);
bool ValidateGetTexLevelParameteriv(Context *context,
GLenum target,
GLint level,
GLenum pname,
GLint *param);
bool ValidateDrawIndirectBase(Context *context, GLenum mode, const GLvoid *indirect); bool ValidateDrawIndirectBase(Context *context, GLenum mode, const GLvoid *indirect);
bool ValidateDrawArraysIndirect(Context *context, GLenum mode, const GLvoid *indirect); bool ValidateDrawArraysIndirect(Context *context, GLenum mode, const GLvoid *indirect);
......
...@@ -14,8 +14,11 @@ ...@@ -14,8 +14,11 @@
#include "libANGLE/validationES.h" #include "libANGLE/validationES.h"
#include "libANGLE/validationES31.h" #include "libANGLE/validationES31.h"
#include "libANGLE/queryconversions.h"
#include "libANGLE/queryutils.h"
#include "common/debug.h" #include "common/debug.h"
#include "common/utilities.h"
namespace gl namespace gl
{ {
...@@ -1050,7 +1053,20 @@ void GL_APIENTRY GetTexLevelParameteriv(GLenum target, GLint level, GLenum pname ...@@ -1050,7 +1053,20 @@ void GL_APIENTRY GetTexLevelParameteriv(GLenum target, GLint level, GLenum pname
{ {
EVENT("(GLenum target = 0x%X, GLint level = %d, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", EVENT("(GLenum target = 0x%X, GLint level = %d, GLenum pname = 0x%X, GLint* params = 0x%0.8p)",
target, level, pname, params); target, level, pname, params);
UNIMPLEMENTED();
Context *context = GetValidGlobalContext();
if (context)
{
if (!context->skipValidation() &&
!ValidateGetTexLevelParameteriv(context, target, level, pname, params))
{
return;
}
Texture *texture = context->getTargetTexture(
IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
QueryTexLevelParameteriv(texture, target, level, pname, params);
}
} }
void GL_APIENTRY GetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params) void GL_APIENTRY GetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
...@@ -1058,14 +1074,19 @@ void GL_APIENTRY GetTexLevelParameterfv(GLenum target, GLint level, GLenum pname ...@@ -1058,14 +1074,19 @@ void GL_APIENTRY GetTexLevelParameterfv(GLenum target, GLint level, GLenum pname
EVENT( EVENT(
"(GLenum target = 0x%X, GLint level = %d, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", "(GLenum target = 0x%X, GLint level = %d, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)",
target, level, pname, params); target, level, pname, params);
Context *context = GetValidGlobalContext(); Context *context = GetValidGlobalContext();
if (context) if (context)
{ {
if (!context->skipValidation()) if (!context->skipValidation() &&
!ValidateGetTexLevelParameterfv(context, target, level, pname, params))
{ {
context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); return;
} }
UNIMPLEMENTED();
Texture *texture = context->getTargetTexture(
IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
QueryTexLevelParameterfv(texture, target, level, pname, params);
} }
} }
......
...@@ -1179,7 +1179,6 @@ ...@@ -1179,7 +1179,6 @@
1442 OPENGL D3D11 : dEQP-GLES31.functional.state_query.texture.texture_2d_array.depth_stencil_mode_* = FAIL 1442 OPENGL D3D11 : dEQP-GLES31.functional.state_query.texture.texture_2d_array.depth_stencil_mode_* = FAIL
1442 OPENGL D3D11 : dEQP-GLES31.functional.state_query.texture.texture_3d.depth_stencil_mode_* = FAIL 1442 OPENGL D3D11 : dEQP-GLES31.functional.state_query.texture.texture_3d.depth_stencil_mode_* = FAIL
1442 OPENGL D3D11 : dEQP-GLES31.functional.state_query.texture.texture_2d_multisample.* = FAIL 1442 OPENGL D3D11 : dEQP-GLES31.functional.state_query.texture.texture_2d_multisample.* = FAIL
1442 OPENGL D3D11 : dEQP-GLES31.functional.state_query.texture_level.* = FAIL
1442 OPENGL D3D11 : dEQP-GLES31.functional.state_query.texture_level.texture_2d_multisample.* = FAIL 1442 OPENGL D3D11 : dEQP-GLES31.functional.state_query.texture_level.texture_2d_multisample.* = FAIL
1442 OPENGL D3D11 : dEQP-GLES31.functional.state_query.internal_format.renderbuffer.rgb10_a2ui_samples = FAIL 1442 OPENGL D3D11 : dEQP-GLES31.functional.state_query.internal_format.renderbuffer.rgb10_a2ui_samples = FAIL
1442 OPENGL D3D11 : dEQP-GLES31.functional.state_query.internal_format.renderbuffer.r8i_samples = FAIL 1442 OPENGL D3D11 : dEQP-GLES31.functional.state_query.internal_format.renderbuffer.r8i_samples = FAIL
......
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