GLES1: GL_OES_draw_texture
BUG=angleproject:2306
This implements GL_OES_draw_texture using a few bits of new state
in the renderer and adding a code path for it in the shader, using
gl_VertexID to draw the quad backing the texture draw. This allows us
to avoid allocating a separate vertex array for the texture draw and
reuses the current shader as much as possible, plugging in to the
existing multitexturing pipeline.
- Add unit test and sample
- No new test expectations, but advertising GL_OES_draw_texture makes
the DrawTex GLES1 conformance test non-trivial and actually test
glDrawTex*.
Change-Id: I1485098249fe44d46a01cab4bb7b2c39d0492923
Reviewed-on: https://chromium-review.googlesource.com/1135930
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Lingfeng Yang <lfy@google.com>
diff --git a/src/libANGLE/validationES1.cpp b/src/libANGLE/validationES1.cpp
index 8f8c619..e2e158c 100644
--- a/src/libANGLE/validationES1.cpp
+++ b/src/libANGLE/validationES1.cpp
@@ -595,6 +595,19 @@
return true;
}
+bool ValidateDrawTexCommon(Context *context, float width, float height)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+
+ if (width <= 0.0f || height <= 0.0f)
+ {
+ ANGLE_VALIDATION_ERR(context, InvalidValue(), NonPositiveDrawTextureDimension);
+ return false;
+ }
+
+ return true;
+}
+
} // namespace gl
namespace gl
@@ -1302,26 +1315,24 @@
GLfloat width,
GLfloat height)
{
- UNIMPLEMENTED();
- return true;
+ return ValidateDrawTexCommon(context, width, height);
}
bool ValidateDrawTexfvOES(Context *context, const GLfloat *coords)
{
- UNIMPLEMENTED();
- return true;
+ return ValidateDrawTexCommon(context, coords[3], coords[4]);
}
bool ValidateDrawTexiOES(Context *context, GLint x, GLint y, GLint z, GLint width, GLint height)
{
- UNIMPLEMENTED();
- return true;
+ return ValidateDrawTexCommon(context, static_cast<GLfloat>(width),
+ static_cast<GLfloat>(height));
}
bool ValidateDrawTexivOES(Context *context, const GLint *coords)
{
- UNIMPLEMENTED();
- return true;
+ return ValidateDrawTexCommon(context, static_cast<GLfloat>(coords[3]),
+ static_cast<GLfloat>(coords[4]));
}
bool ValidateDrawTexsOES(Context *context,
@@ -1331,14 +1342,14 @@
GLshort width,
GLshort height)
{
- UNIMPLEMENTED();
- return true;
+ return ValidateDrawTexCommon(context, static_cast<GLfloat>(width),
+ static_cast<GLfloat>(height));
}
bool ValidateDrawTexsvOES(Context *context, const GLshort *coords)
{
- UNIMPLEMENTED();
- return true;
+ return ValidateDrawTexCommon(context, static_cast<GLfloat>(coords[3]),
+ static_cast<GLfloat>(coords[4]));
}
bool ValidateDrawTexxOES(Context *context,
@@ -1348,14 +1359,12 @@
GLfixed width,
GLfixed height)
{
- UNIMPLEMENTED();
- return true;
+ return ValidateDrawTexCommon(context, FixedToFloat(width), FixedToFloat(height));
}
bool ValidateDrawTexxvOES(Context *context, const GLfixed *coords)
{
- UNIMPLEMENTED();
- return true;
+ return ValidateDrawTexCommon(context, FixedToFloat(coords[3]), FixedToFloat(coords[4]));
}
bool ValidateCurrentPaletteMatrixOES(Context *context, GLuint matrixpaletteindex)