Commit 5bb36cc0 by Amy Liu Committed by Commit Bot

Passing covgl/covgl

Fix the following gles1-API implementation codes and some validation functions: glClearColorx glClearDepthx glDepthRangex glGetFixedv glGetTexParameterxv glLineWidthx glPolygonOffsetx glSampleCoveragex glTexParameterx glTexParameterxv ValidateMaterialCommon ValidateFogx ValidateFogxv ValidatePointSizex ValidateRotatex ValidateTexEnvx ValidateTexEnvxv Bug: angleproject:4281 Change-Id: Ia1d9e53c3ffde2bc77b7ca7eaa0d790e8ca43f10 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2075341 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 175227ba
...@@ -171,6 +171,7 @@ Arm Ltd. ...@@ -171,6 +171,7 @@ Arm Ltd.
Sunny Sun Sunny Sun
Xiaoxuan Liu Xiaoxuan Liu
Ancheng Qiao Ancheng Qiao
Amy Liu
Broadcom Inc. Broadcom Inc.
Gary Sweet Gary Sweet
...@@ -179,4 +180,4 @@ Facebook, Inc. ...@@ -179,4 +180,4 @@ Facebook, Inc.
Artem Bolgar Artem Bolgar
The Khronos Group, Inc. The Khronos Group, Inc.
Alexey Knyazev Alexey Knyazev
\ No newline at end of file
...@@ -48,12 +48,13 @@ void Context::alphaFuncx(AlphaTestFunc func, GLfixed ref) ...@@ -48,12 +48,13 @@ void Context::alphaFuncx(AlphaTestFunc func, GLfixed ref)
void Context::clearColorx(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) void Context::clearColorx(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
{ {
UNIMPLEMENTED(); mState.setColorClearValue(ConvertFixedToFloat(red), ConvertFixedToFloat(green),
ConvertFixedToFloat(blue), ConvertFixedToFloat(alpha));
} }
void Context::clearDepthx(GLfixed depth) void Context::clearDepthx(GLfixed depth)
{ {
UNIMPLEMENTED(); mState.setDepthClearValue(clamp01(ConvertFixedToFloat(depth)));
} }
void Context::clientActiveTexture(GLenum texture) void Context::clientActiveTexture(GLenum texture)
...@@ -105,7 +106,7 @@ void Context::colorPointer(GLint size, VertexAttribType type, GLsizei stride, co ...@@ -105,7 +106,7 @@ void Context::colorPointer(GLint size, VertexAttribType type, GLsizei stride, co
void Context::depthRangex(GLfixed n, GLfixed f) void Context::depthRangex(GLfixed n, GLfixed f)
{ {
UNIMPLEMENTED(); mState.setDepthRange(clamp01(ConvertFixedToFloat(n)), clamp01(ConvertFixedToFloat(f)));
} }
void Context::disableClientState(ClientVertexArrayType clientState) void Context::disableClientState(ClientVertexArrayType clientState)
...@@ -196,7 +197,18 @@ void Context::getClipPlanex(GLenum plane, GLfixed *equation) ...@@ -196,7 +197,18 @@ void Context::getClipPlanex(GLenum plane, GLfixed *equation)
void Context::getFixedv(GLenum pname, GLfixed *params) void Context::getFixedv(GLenum pname, GLfixed *params)
{ {
UNIMPLEMENTED(); GLenum nativeType;
unsigned int numParams = 0;
getQueryParameterInfo(pname, &nativeType, &numParams);
std::vector<GLfloat> paramsf(numParams, 0);
CastStateValues(this, nativeType, pname, numParams, paramsf.data());
for (unsigned int i = 0; i < numParams; i++)
{
params[i] = ConvertFloatToFixed(paramsf[i]);
}
} }
void Context::getLightfv(GLenum light, LightParameter pname, GLfloat *params) void Context::getLightfv(GLenum light, LightParameter pname, GLfloat *params)
...@@ -252,7 +264,8 @@ void Context::getTexEnvxv(TextureEnvTarget target, TextureEnvParameter pname, GL ...@@ -252,7 +264,8 @@ void Context::getTexEnvxv(TextureEnvTarget target, TextureEnvParameter pname, GL
void Context::getTexParameterxv(TextureType target, GLenum pname, GLfixed *params) void Context::getTexParameterxv(TextureType target, GLenum pname, GLfixed *params)
{ {
UNIMPLEMENTED(); const Texture *const texture = getTextureByType(target);
QueryTexParameterxv(this, texture, pname, params);
} }
void Context::lightModelf(GLenum pname, GLfloat param) void Context::lightModelf(GLenum pname, GLfloat param)
...@@ -311,7 +324,7 @@ void Context::lightxv(GLenum light, LightParameter pname, const GLfixed *params) ...@@ -311,7 +324,7 @@ void Context::lightxv(GLenum light, LightParameter pname, const GLfixed *params)
void Context::lineWidthx(GLfixed width) void Context::lineWidthx(GLfixed width)
{ {
UNIMPLEMENTED(); mState.setLineWidth(ConvertFixedToFloat(width));
} }
void Context::loadIdentity() void Context::loadIdentity()
...@@ -463,7 +476,7 @@ void Context::pointSizex(GLfixed size) ...@@ -463,7 +476,7 @@ void Context::pointSizex(GLfixed size)
void Context::polygonOffsetx(GLfixed factor, GLfixed units) void Context::polygonOffsetx(GLfixed factor, GLfixed units)
{ {
UNIMPLEMENTED(); mState.setPolygonOffsetParams(ConvertFixedToFloat(factor), ConvertFixedToFloat(units));
} }
void Context::popMatrix() void Context::popMatrix()
...@@ -490,7 +503,8 @@ void Context::rotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) ...@@ -490,7 +503,8 @@ void Context::rotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
void Context::sampleCoveragex(GLclampx value, GLboolean invert) void Context::sampleCoveragex(GLclampx value, GLboolean invert)
{ {
UNIMPLEMENTED(); GLclampf valuef = ConvertFixedToFloat(value);
mState.setSampleCoverageParams(clamp01(valuef), ConvertToBool(invert));
} }
void Context::scalef(float x, float y, float z) void Context::scalef(float x, float y, float z)
......
...@@ -217,7 +217,22 @@ void QueryTexLevelParameterBase(const Texture *texture, ...@@ -217,7 +217,22 @@ void QueryTexLevelParameterBase(const Texture *texture,
} }
} }
template <bool isPureInteger, typename ParamType> // This function is needed to handle fixed_point data.
// It can be used when some pname need special conversion from int/float/bool to fixed_point.
template <bool isGLfixed, typename QueryT, typename ParamType>
QueryT CastFromSpecialValue(GLenum pname, const ParamType param)
{
if (isGLfixed)
{
return static_cast<QueryT>(ConvertFloatToFixed(CastFromStateValue<GLfloat>(pname, param)));
}
else
{
return CastFromStateValue<QueryT>(pname, param);
}
}
template <bool isPureInteger, bool isGLfixed, typename ParamType>
void QueryTexParameterBase(const Context *context, void QueryTexParameterBase(const Context *context,
const Texture *texture, const Texture *texture,
GLenum pname, GLenum pname,
...@@ -252,7 +267,8 @@ void QueryTexParameterBase(const Context *context, ...@@ -252,7 +267,8 @@ void QueryTexParameterBase(const Context *context,
*params = CastFromGLintStateValue<ParamType>(pname, texture->getUsage()); *params = CastFromGLintStateValue<ParamType>(pname, texture->getUsage());
break; break;
case GL_TEXTURE_MAX_ANISOTROPY_EXT: case GL_TEXTURE_MAX_ANISOTROPY_EXT:
*params = CastFromStateValue<ParamType>(pname, texture->getMaxAnisotropy()); *params =
CastFromSpecialValue<isGLfixed, ParamType>(pname, texture->getMaxAnisotropy());
break; break;
case GL_TEXTURE_SWIZZLE_R: case GL_TEXTURE_SWIZZLE_R:
*params = CastFromGLintStateValue<ParamType>(pname, texture->getSwizzleRed()); *params = CastFromGLintStateValue<ParamType>(pname, texture->getSwizzleRed());
...@@ -273,10 +289,10 @@ void QueryTexParameterBase(const Context *context, ...@@ -273,10 +289,10 @@ void QueryTexParameterBase(const Context *context,
*params = CastFromGLintStateValue<ParamType>(pname, texture->getMaxLevel()); *params = CastFromGLintStateValue<ParamType>(pname, texture->getMaxLevel());
break; break;
case GL_TEXTURE_MIN_LOD: case GL_TEXTURE_MIN_LOD:
*params = CastFromStateValue<ParamType>(pname, texture->getMinLod()); *params = CastFromSpecialValue<isGLfixed, ParamType>(pname, texture->getMinLod());
break; break;
case GL_TEXTURE_MAX_LOD: case GL_TEXTURE_MAX_LOD:
*params = CastFromStateValue<ParamType>(pname, texture->getMaxLod()); *params = CastFromSpecialValue<isGLfixed, ParamType>(pname, texture->getMaxLod());
break; break;
case GL_TEXTURE_COMPARE_MODE: case GL_TEXTURE_COMPARE_MODE:
*params = CastFromGLintStateValue<ParamType>(pname, texture->getCompareMode()); *params = CastFromGLintStateValue<ParamType>(pname, texture->getCompareMode());
...@@ -294,23 +310,23 @@ void QueryTexParameterBase(const Context *context, ...@@ -294,23 +310,23 @@ void QueryTexParameterBase(const Context *context,
case GL_TEXTURE_CROP_RECT_OES: case GL_TEXTURE_CROP_RECT_OES:
{ {
const gl::Rectangle &crop = texture->getCrop(); const gl::Rectangle &crop = texture->getCrop();
params[0] = CastFromGLintStateValue<ParamType>(pname, crop.x); params[0] = CastFromSpecialValue<isGLfixed, ParamType>(pname, crop.x);
params[1] = CastFromGLintStateValue<ParamType>(pname, crop.y); params[1] = CastFromSpecialValue<isGLfixed, ParamType>(pname, crop.y);
params[2] = CastFromGLintStateValue<ParamType>(pname, crop.width); params[2] = CastFromSpecialValue<isGLfixed, ParamType>(pname, crop.width);
params[3] = CastFromGLintStateValue<ParamType>(pname, crop.height); params[3] = CastFromSpecialValue<isGLfixed, ParamType>(pname, crop.height);
break; break;
} }
case GL_GENERATE_MIPMAP: case GL_GENERATE_MIPMAP:
*params = CastFromGLintStateValue<ParamType>(pname, texture->getGenerateMipmapHint()); *params = CastFromGLintStateValue<ParamType>(pname, texture->getGenerateMipmapHint());
break; break;
case GL_MEMORY_SIZE_ANGLE: case GL_MEMORY_SIZE_ANGLE:
*params = CastFromStateValue<ParamType>(pname, texture->getMemorySize()); *params = CastFromSpecialValue<isGLfixed, ParamType>(pname, texture->getMemorySize());
break; break;
case GL_TEXTURE_BORDER_COLOR: case GL_TEXTURE_BORDER_COLOR:
ConvertFromColor<isPureInteger>(texture->getBorderColor(), params); ConvertFromColor<isPureInteger>(texture->getBorderColor(), params);
break; break;
case GL_TEXTURE_NATIVE_ID_ANGLE: case GL_TEXTURE_NATIVE_ID_ANGLE:
*params = CastFromStateValue<ParamType>(pname, texture->getNativeID()); *params = CastFromSpecialValue<isGLfixed, ParamType>(pname, texture->getNativeID());
break; break;
case GL_IMPLEMENTATION_COLOR_READ_FORMAT: case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
*params = CastFromGLintStateValue<ParamType>( *params = CastFromGLintStateValue<ParamType>(
...@@ -321,7 +337,8 @@ void QueryTexParameterBase(const Context *context, ...@@ -321,7 +337,8 @@ void QueryTexParameterBase(const Context *context,
pname, texture->getImplementationColorReadType(context)); pname, texture->getImplementationColorReadType(context));
break; break;
case GL_IMAGE_FORMAT_COMPATIBILITY_TYPE: case GL_IMAGE_FORMAT_COMPATIBILITY_TYPE:
*params = GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE; *params =
CastFromGLintStateValue<ParamType>(pname, GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE);
break; break;
default: default:
UNREACHABLE(); UNREACHABLE();
...@@ -1409,7 +1426,15 @@ void QueryTexParameterfv(const Context *context, ...@@ -1409,7 +1426,15 @@ void QueryTexParameterfv(const Context *context,
GLenum pname, GLenum pname,
GLfloat *params) GLfloat *params)
{ {
QueryTexParameterBase<false>(context, texture, pname, params); QueryTexParameterBase<false, false>(context, texture, pname, params);
}
void QueryTexParameterxv(const Context *context,
const Texture *texture,
GLenum pname,
GLfixed *params)
{
QueryTexParameterBase<false, true>(context, texture, pname, params);
} }
void QueryTexParameteriv(const Context *context, void QueryTexParameteriv(const Context *context,
...@@ -1417,7 +1442,7 @@ void QueryTexParameteriv(const Context *context, ...@@ -1417,7 +1442,7 @@ void QueryTexParameteriv(const Context *context,
GLenum pname, GLenum pname,
GLint *params) GLint *params)
{ {
QueryTexParameterBase<false>(context, texture, pname, params); QueryTexParameterBase<false, false>(context, texture, pname, params);
} }
void QueryTexParameterIiv(const Context *context, void QueryTexParameterIiv(const Context *context,
...@@ -1425,7 +1450,7 @@ void QueryTexParameterIiv(const Context *context, ...@@ -1425,7 +1450,7 @@ void QueryTexParameterIiv(const Context *context,
GLenum pname, GLenum pname,
GLint *params) GLint *params)
{ {
QueryTexParameterBase<true>(context, texture, pname, params); QueryTexParameterBase<true, false>(context, texture, pname, params);
} }
void QueryTexParameterIuiv(const Context *context, void QueryTexParameterIuiv(const Context *context,
...@@ -1433,7 +1458,7 @@ void QueryTexParameterIuiv(const Context *context, ...@@ -1433,7 +1458,7 @@ void QueryTexParameterIuiv(const Context *context,
GLenum pname, GLenum pname,
GLuint *params) GLuint *params)
{ {
QueryTexParameterBase<true>(context, texture, pname, params); QueryTexParameterBase<true, false>(context, texture, pname, params);
} }
void QuerySamplerParameterfv(const Sampler *sampler, GLenum pname, GLfloat *params) void QuerySamplerParameterfv(const Sampler *sampler, GLenum pname, GLfloat *params)
......
...@@ -63,6 +63,10 @@ void QueryTexParameterfv(const Context *context, ...@@ -63,6 +63,10 @@ void QueryTexParameterfv(const Context *context,
const Texture *texture, const Texture *texture,
GLenum pname, GLenum pname,
GLfloat *params); GLfloat *params);
void QueryTexParameterxv(const Context *context,
const Texture *texture,
GLenum pname,
GLfixed *params);
void QueryTexParameteriv(const Context *context, void QueryTexParameteriv(const Context *context,
const Texture *texture, const Texture *texture,
GLenum pname, GLenum pname,
......
...@@ -246,6 +246,7 @@ bool ValidateMaterialCommon(const Context *context, ...@@ -246,6 +246,7 @@ bool ValidateMaterialCommon(const Context *context,
switch (pname) switch (pname)
{ {
case MaterialParameter::Ambient: case MaterialParameter::Ambient:
case MaterialParameter::AmbientAndDiffuse:
case MaterialParameter::Diffuse: case MaterialParameter::Diffuse:
case MaterialParameter::Specular: case MaterialParameter::Specular:
case MaterialParameter::Emission: case MaterialParameter::Emission:
...@@ -660,13 +661,13 @@ bool ValidateClearColorx(const Context *context, ...@@ -660,13 +661,13 @@ bool ValidateClearColorx(const Context *context,
GLfixed blue, GLfixed blue,
GLfixed alpha) GLfixed alpha)
{ {
UNIMPLEMENTED(); ANGLE_VALIDATE_IS_GLES1(context);
return true; return true;
} }
bool ValidateClearDepthx(const Context *context, GLfixed depth) bool ValidateClearDepthx(const Context *context, GLfixed depth)
{ {
UNIMPLEMENTED(); ANGLE_VALIDATE_IS_GLES1(context);
return true; return true;
} }
...@@ -734,7 +735,13 @@ bool ValidateCullFace(const Context *context, GLenum mode) ...@@ -734,7 +735,13 @@ bool ValidateCullFace(const Context *context, GLenum mode)
bool ValidateDepthRangex(const Context *context, GLfixed n, GLfixed f) bool ValidateDepthRangex(const Context *context, GLfixed n, GLfixed f)
{ {
UNIMPLEMENTED(); ANGLE_VALIDATE_IS_GLES1(context);
if (context->getExtensions().webglCompatibility && n > f)
{
context->validationError(GL_INVALID_OPERATION, kInvalidDepthRange);
return false;
}
return true; return true;
} }
...@@ -760,18 +767,28 @@ bool ValidateFogfv(const Context *context, GLenum pname, const GLfloat *params) ...@@ -760,18 +767,28 @@ bool ValidateFogfv(const Context *context, GLenum pname, const GLfloat *params)
bool ValidateFogx(const Context *context, GLenum pname, GLfixed param) bool ValidateFogx(const Context *context, GLenum pname, GLfixed param)
{ {
GLfloat asFloat = ConvertFixedToFloat(param); ANGLE_VALIDATE_IS_GLES1(context);
GLfloat asFloat =
pname == GL_FOG_MODE ? static_cast<GLfloat>(param) : ConvertFixedToFloat(param);
return ValidateFogCommon(context, pname, &asFloat); return ValidateFogCommon(context, pname, &asFloat);
} }
bool ValidateFogxv(const Context *context, GLenum pname, const GLfixed *params) bool ValidateFogxv(const Context *context, GLenum pname, const GLfixed *params)
{ {
ANGLE_VALIDATE_IS_GLES1(context);
unsigned int paramCount = GetFogParameterCount(pname); unsigned int paramCount = GetFogParameterCount(pname);
GLfloat paramsf[4] = {}; GLfloat paramsf[4] = {};
for (unsigned int i = 0; i < paramCount; i++) if (pname == GL_FOG_MODE)
{ {
paramsf[i] = ConvertFixedToFloat(params[i]); paramsf[0] = static_cast<GLfloat>(params[0]);
}
else
{
for (unsigned int i = 0; i < paramCount; i++)
{
paramsf[i] = ConvertFixedToFloat(params[i]);
}
} }
return ValidateFogCommon(context, pname, paramsf); return ValidateFogCommon(context, pname, paramsf);
...@@ -830,8 +847,10 @@ bool ValidateGetClipPlanex(const Context *context, GLenum plane, const GLfixed * ...@@ -830,8 +847,10 @@ bool ValidateGetClipPlanex(const Context *context, GLenum plane, const GLfixed *
bool ValidateGetFixedv(const Context *context, GLenum pname, const GLfixed *params) bool ValidateGetFixedv(const Context *context, GLenum pname, const GLfixed *params)
{ {
UNIMPLEMENTED(); ANGLE_VALIDATE_IS_GLES1(context);
return true; GLenum nativeType;
unsigned int numParams = 0;
return ValidateStateQuery(context, pname, &nativeType, &numParams);
} }
bool ValidateGetLightfv(const Context *context, bool ValidateGetLightfv(const Context *context,
...@@ -961,7 +980,13 @@ bool ValidateLightxv(const Context *context, ...@@ -961,7 +980,13 @@ bool ValidateLightxv(const Context *context,
bool ValidateLineWidthx(const Context *context, GLfixed width) bool ValidateLineWidthx(const Context *context, GLfixed width)
{ {
UNIMPLEMENTED(); ANGLE_VALIDATE_IS_GLES1(context);
if (width <= 0)
{
context->validationError(GL_INVALID_VALUE, kInvalidWidth);
return false;
}
return true; return true;
} }
...@@ -1201,7 +1226,7 @@ bool ValidatePointSizex(const Context *context, GLfixed size) ...@@ -1201,7 +1226,7 @@ bool ValidatePointSizex(const Context *context, GLfixed size)
bool ValidatePolygonOffsetx(const Context *context, GLfixed factor, GLfixed units) bool ValidatePolygonOffsetx(const Context *context, GLfixed factor, GLfixed units)
{ {
UNIMPLEMENTED(); ANGLE_VALIDATE_IS_GLES1(context);
return true; return true;
} }
...@@ -1243,7 +1268,7 @@ bool ValidateRotatex(const Context *context, GLfixed angle, GLfixed x, GLfixed y ...@@ -1243,7 +1268,7 @@ bool ValidateRotatex(const Context *context, GLfixed angle, GLfixed x, GLfixed y
bool ValidateSampleCoveragex(const Context *context, GLclampx value, GLboolean invert) bool ValidateSampleCoveragex(const Context *context, GLclampx value, GLboolean invert)
{ {
UNIMPLEMENTED(); ANGLE_VALIDATE_IS_GLES1(context);
return true; return true;
} }
...@@ -1326,8 +1351,10 @@ bool ValidateTexEnvx(const Context *context, ...@@ -1326,8 +1351,10 @@ bool ValidateTexEnvx(const Context *context,
TextureEnvParameter pname, TextureEnvParameter pname,
GLfixed param) GLfixed param)
{ {
GLfloat paramf = static_cast<GLfloat>(param); ANGLE_VALIDATE_IS_GLES1(context);
return ValidateTexEnvCommon(context, target, pname, &paramf); GLfloat paramsf[4] = {};
ConvertTextureEnvFromFixed(pname, &param, paramsf);
return ValidateTexEnvCommon(context, target, pname, paramsf);
} }
bool ValidateTexEnvxv(const Context *context, bool ValidateTexEnvxv(const Context *context,
...@@ -1335,11 +1362,9 @@ bool ValidateTexEnvxv(const Context *context, ...@@ -1335,11 +1362,9 @@ bool ValidateTexEnvxv(const Context *context,
TextureEnvParameter pname, TextureEnvParameter pname,
const GLfixed *params) const GLfixed *params)
{ {
GLfloat paramsf[4]; ANGLE_VALIDATE_IS_GLES1(context);
for (unsigned int i = 0; i < GetTextureEnvParameterCount(pname); i++) GLfloat paramsf[4] = {};
{ ConvertTextureEnvFromFixed(pname, params, paramsf);
paramsf[i] = static_cast<GLfloat>(params[i]);
}
return ValidateTexEnvCommon(context, target, pname, paramsf); return ValidateTexEnvCommon(context, target, pname, paramsf);
} }
......
...@@ -80,4 +80,79 @@ TEST_P(BasicDrawTest, EnableDisableTexture) ...@@ -80,4 +80,79 @@ TEST_P(BasicDrawTest, EnableDisableTexture)
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::green); EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::green);
} }
// Check that glClearColorx, glClearDepthx, glLineWidthx, glPolygonOffsetx can work.
TEST_P(BasicDrawTest, DepthTest)
{
glClearColorx(0x4000, 0x8000, 0x8000, 0x8000);
EXPECT_GL_NO_ERROR();
glClearDepthx(0x8000);
EXPECT_GL_NO_ERROR();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
EXPECT_PIXEL_NEAR(0, 0, 64, 128, 128, 128, 1.0);
// Fail Depth Test and can't draw the red triangle
std::vector<float> Positions = {-1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 1.0f, 1.0f};
glEnable(GL_DEPTH_TEST);
glLineWidthx(0x10000);
EXPECT_GL_NO_ERROR();
glPolygonOffsetx(0, 0);
EXPECT_GL_NO_ERROR();
glColor4f(1.0f, 0.0f, 0.0f, 1.0f);
glEnableClientState(GL_VERTEX_ARRAY);
EXPECT_GL_NO_ERROR();
glVertexPointer(3, GL_FLOAT, 0, Positions.data());
EXPECT_GL_NO_ERROR();
glDrawArrays(GL_TRIANGLES, 0, 3);
EXPECT_GL_NO_ERROR();
EXPECT_PIXEL_NEAR(0, 0, 64, 128, 128, 128, 1.0);
glDisable(GL_DEPTH_TEST);
EXPECT_GL_NO_ERROR();
glDrawArrays(GL_TRIANGLES, 0, 3);
EXPECT_GL_NO_ERROR();
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::red);
}
// Check that depth range can be set by glDepthRangex.
TEST_P(BasicDrawTest, SetDepthRangex)
{
glDepthRangex(0x8000, 0x10000);
EXPECT_GL_NO_ERROR();
GLfixed depth_range[2];
glGetFixedv(GL_DEPTH_RANGE, depth_range);
EXPECT_GL_NO_ERROR();
EXPECT_EQ(0x8000, depth_range[0]);
EXPECT_EQ(0x10000, depth_range[1]);
}
// Check that sample coverage parameters can be set by glSampleCoveragex.
TEST_P(BasicDrawTest, SetSampleCoveragex)
{
GLfixed isSampleCoverage;
GLfixed samplecoveragevalue;
GLfixed samplecoverageinvert;
glEnable(GL_SAMPLE_COVERAGE);
EXPECT_GL_NO_ERROR();
glGetFixedv(GL_SAMPLE_COVERAGE, &isSampleCoverage);
EXPECT_GL_NO_ERROR();
EXPECT_EQ(0x10000, isSampleCoverage);
glSampleCoveragex(0x8000, true);
EXPECT_GL_NO_ERROR();
glGetFixedv(GL_SAMPLE_COVERAGE_VALUE, &samplecoveragevalue);
EXPECT_GL_NO_ERROR();
EXPECT_EQ(0x8000, samplecoveragevalue);
glGetFixedv(GL_SAMPLE_COVERAGE_INVERT, &samplecoverageinvert);
EXPECT_GL_NO_ERROR();
EXPECT_EQ(0x10000, samplecoverageinvert);
}
ANGLE_INSTANTIATE_TEST_ES1(BasicDrawTest); ANGLE_INSTANTIATE_TEST_ES1(BasicDrawTest);
...@@ -126,4 +126,41 @@ TEST_P(TextureParameterTest, IntConversionsAndIntBounds) ...@@ -126,4 +126,41 @@ TEST_P(TextureParameterTest, IntConversionsAndIntBounds)
ASSERT_EQ(crop, cropStored); ASSERT_EQ(crop, cropStored);
} }
// Check that texture parameters can be set by glTexParameterx, glTexParameterxv
// and get by glGetTexParameterxv.
TEST_P(TextureParameterTest, SetFixedPoint)
{
std::array<GLfixed, 4> params = {};
glTexParameterx(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
EXPECT_GL_NO_ERROR();
glGetTexParameterxv(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, params.data());
EXPECT_GL_NO_ERROR();
EXPECT_GL_TRUE(params[0]);
std::array<GLfixed, 4> cropRect = {0x10000, 0x10000, 0x20000, 0x20000};
glTexParameterxv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, cropRect.data());
EXPECT_GL_NO_ERROR();
glGetTexParameterxv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, params.data());
EXPECT_GL_NO_ERROR();
EXPECT_EQ(cropRect, params);
glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
EXPECT_GL_NO_ERROR();
glGetTexParameterxv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, params.data());
EXPECT_GL_NO_ERROR();
EXPECT_EQ(GL_REPEAT, params[0]);
glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
EXPECT_GL_NO_ERROR();
glGetTexParameterxv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, params.data());
EXPECT_GL_NO_ERROR();
EXPECT_EQ(GL_LINEAR, params[0]);
}
ANGLE_INSTANTIATE_TEST_ES1(TextureParameterTest); ANGLE_INSTANTIATE_TEST_ES1(TextureParameterTest);
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