Index: gpu/command_buffer/tests/gl_chromium_path_rendering_unittest.cc |
diff --git a/gpu/command_buffer/tests/gl_chromium_path_rendering_unittest.cc b/gpu/command_buffer/tests/gl_chromium_path_rendering_unittest.cc |
index 6aab2e5399ea142e18625a7cc93c16cbe060eb1c..1759c894f7e853aceef75a23291b45c9ee9274a9 100644 |
--- a/gpu/command_buffer/tests/gl_chromium_path_rendering_unittest.cc |
+++ b/gpu/command_buffer/tests/gl_chromium_path_rendering_unittest.cc |
@@ -7,11 +7,13 @@ |
#include <GLES2/gl2extchromium.h> |
#include <cmath> |
+#include "base/strings/stringprintf.h" |
#include "gpu/command_buffer/tests/gl_manager.h" |
#include "gpu/command_buffer/tests/gl_test_utils.h" |
#include "testing/gmock/include/gmock/gmock.h" |
#include "testing/gtest/include/gtest/gtest.h" |
+#define SHADER(Src) #Src |
namespace gpu { |
@@ -38,7 +40,125 @@ class CHROMIUMPathRenderingTest : public testing::Test { |
EXPECT_EQ(static_cast<GLint>(round(expected[i])), actual[i]); |
} |
} |
+ |
+ void SetupStateForTestPattern() { |
+ glViewport(0, 0, kResolution, kResolution); |
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f); |
+ glStencilMask(0xffffffff); |
+ glClearStencil(0); |
+ glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); |
+ |
+ static const char* v_shader_src = |
+ SHADER(void main() { gl_Position = vec4(1); }); |
+ static const char* f_shader_src = |
+ "#extension GL_CHROMIUM_path_rendering: require\n" SHADER( |
+ precision mediump float; |
+ void main() { gl_FragColor = gl_TexCoord[0] + gl_TexCoord[1]; }); |
+ |
+ GLuint program = GLTestHelper::LoadProgram(v_shader_src, f_shader_src); |
+ glUseProgram(program); |
+ glDeleteProgram(program); |
+ |
+ // Set up orthogonal projection with near/far plane distance of 2. |
+ static GLfloat matrix[16] = { |
+ 2.0f / (kResolution - 1), 0.0f, 0.0f, 0.0f, |
+ 0.0f, 2.0f / (kResolution - 1), 0.0f, 0.0f, |
+ 0.0f, 0.0f, -1.0f, 0.0f, |
+ -1.0f, -1.0f, 0.0f, 1.0f}; |
+ glMatrixLoadfCHROMIUM(GL_PROJECTION_CHROMIUM, matrix); |
+ glMatrixLoadIdentityCHROMIUM(GL_MODELVIEW_CHROMIUM); |
+ |
+ glEnable(GL_STENCIL_TEST); |
+ |
+ GLTestHelper::CheckGLError("no errors at state setup", __LINE__); |
+ } |
+ |
+ void SetupPathStateForTestPattern(GLuint path) { |
+ GLubyte commands[] = {GL_MOVE_TO_CHROMIUM, GL_LINE_TO_CHROMIUM, |
+ GL_QUADRATIC_CURVE_TO_CHROMIUM, |
+ GL_CUBIC_CURVE_TO_CHROMIUM, GL_CLOSE_PATH_CHROMIUM}; |
+ |
+ GLfloat coords[] = {50.0f, 50.0f, 75.0f, 75.0f, 100.0f, 62.5f, 50.0f, |
+ 25.5f, 0.0f, 62.5f, 50.0f, 50.0f, 25.0f, 75.0f}; |
+ |
+ glPathCommandsCHROMIUM(path, |
+ arraysize(commands), |
+ commands, |
+ arraysize(coords), |
+ GL_FLOAT, |
+ coords); |
+ |
+ glPathParameterfCHROMIUM(path, GL_PATH_STROKE_WIDTH_CHROMIUM, 5.0f); |
+ glPathParameterfCHROMIUM(path, GL_PATH_MITER_LIMIT_CHROMIUM, 1.0f); |
+ glPathParameteriCHROMIUM( |
+ path, GL_PATH_JOIN_STYLE_CHROMIUM, GL_ROUND_CHROMIUM); |
+ glPathParameteriCHROMIUM( |
+ path, GL_PATH_INITIAL_END_CAP_CHROMIUM, GL_SQUARE_CHROMIUM); |
+ glPathParameteriCHROMIUM( |
+ path, GL_PATH_TERMINAL_END_CAP_CHROMIUM, GL_FLAT_CHROMIUM); |
+ } |
+ |
+ void VerifyTestPatternFill(float x, float y) { |
+ // Inside the fill we should have color formed by the texture coordinate set |
+ // coefficients. |
+ const float fill_coords[] = {55.0f, 55.0f, 50.0f, 28.0f, 66.0f, 63.0f}; |
+ |
+ for (size_t i = 0; i < arraysize(fill_coords); i += 2) { |
+ float fx = fill_coords[i]; |
+ float fy = fill_coords[i + 1]; |
+ uint8 expected_color[] = { |
+ 255 * (fx * 1.0f / kResolution - fx * 0.2f / kResolution), |
+ 255 * (fy * 1.0f / kResolution - fy * 0.2f / kResolution), |
+ 0, // The calculations cancel each other. |
+ 255}; |
+ // Note: we compare with a bit of tolerance, since CPU float computation |
+ // will not always match the shader computation. |
+ EXPECT_TRUE( |
+ GLTestHelper::CheckPixels(x + fx, y + fy, 1, 1, 2, expected_color)); |
+ } |
+ } |
+ |
+ void VerifyTestPatternBg(float x, float y) { |
+ const float bg_coords[] = {80.0f, 80.0f, 20.0f, 20.0f, 90.0f, 1.0f}; |
+ uint8 expected_color[] = {0, 0, 0, 0}; |
+ |
+ for (size_t i = 0; i < arraysize(bg_coords); i += 2) { |
+ float bx = bg_coords[i]; |
+ float by = bg_coords[i + 1]; |
+ |
+ EXPECT_TRUE( |
+ GLTestHelper::CheckPixels(x + bx, y + by, 1, 1, 0, expected_color)); |
+ } |
+ } |
+ |
+ void VerifyTestPatternStroke(float x, float y) { |
+ // Inside the stroke we should have green. |
+ const uint8 green[] = {0, 255, 0, 255}; |
+ EXPECT_TRUE(GLTestHelper::CheckPixels(x + 50, y + 53, 1, 1, 0, green)); |
+ EXPECT_TRUE(GLTestHelper::CheckPixels(x + 26, y + 76, 1, 1, 0, green)); |
+ |
+ // Outside the path we should have black. |
+ const uint8 black[] = {0, 0, 0, 0}; |
+ EXPECT_TRUE(GLTestHelper::CheckPixels(x + 10, y + 10, 1, 1, 0, black)); |
+ EXPECT_TRUE(GLTestHelper::CheckPixels(x + 80, y + 80, 1, 1, 0, black)); |
+ } |
+ |
GLManager gl_; |
+ static GLfloat fill_coefficients_[3 * 3 * 2]; |
+ static GLfloat stroke_coefficients_[3 * 3]; |
+}; |
+ |
+GLfloat CHROMIUMPathRenderingTest::fill_coefficients_[] = { |
+ 1.0f / kResolution, 0.0f, 0.0f, |
+ 0.0f, 1.0f / kResolution, 0.0f, |
+ 1.0f / kResolution, 1.0f / kResolution, 0.0f, |
+ -0.2f / kResolution, 0.0f, 0.0f, |
+ 0.0f, -0.2f / kResolution, 0.0f, |
+ -1.0f / kResolution, -1.0f / kResolution, 0.0}; |
+ |
+// Stroke should be constant green. |
+GLfloat CHROMIUMPathRenderingTest::stroke_coefficients_[] = { |
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, |
}; |
TEST_F(CHROMIUMPathRenderingTest, TestMatrix) { |
@@ -107,4 +227,323 @@ TEST_F(CHROMIUMPathRenderingTest, TestMatrixErrors) { |
EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
} |
+TEST_F(CHROMIUMPathRenderingTest, TestTexCoordShader) { |
piman
2014/04/24 22:26:36
We'll have to skip those tests if the extension is
|
+ static const char* fs_str = |
+ "#extension GL_CHROMIUM_path_rendering: require\n" SHADER( |
+ precision mediump float; |
+ void main() { gl_FragColor = gl_TexCoord[0] + gl_TexCoord[% d]; }); |
+ |
+ GLint maxTextureCoords = -1; |
+ glGetIntegerv(GL_MAX_TEXTURE_COORDS_CHROMIUM, &maxTextureCoords); |
+ EXPECT_LT(static_cast<GLint>(0), maxTextureCoords); |
+ |
+ std::string fs_str_max = base::StringPrintf(fs_str, maxTextureCoords - 1); |
+ |
+ const char* shader_str = fs_str_max.c_str(); |
+ GLuint fs = glCreateShader(GL_FRAGMENT_SHADER); |
+ glShaderSource(fs, 1, &shader_str, NULL); |
+ glCompileShader(fs); |
+ GLint value = 0; |
+ glGetShaderiv(fs, GL_COMPILE_STATUS, &value); |
+ if (value == 0) { |
+ char buffer[1024]; |
+ GLsizei length = 0; |
+ glGetShaderInfoLog(fs, sizeof(buffer), &length, buffer); |
+ std::string log(buffer, length); |
+ EXPECT_EQ(1, value) << "Error compiling shader: " << log; |
+ } |
+ |
+ EXPECT_EQ(static_cast<GLint>(1), value); |
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
+ glDeleteShader(fs); |
+} |
+ |
+TEST_F(CHROMIUMPathRenderingTest, TooBigTexCoordShaderFails) { |
+ static const char* fs_str = |
+ "#extension GL_CHROMIUM_path_rendering: require\n" SHADER( |
+ precision mediump float; |
+ void main() { gl_FragColor = gl_TexCoord[0] + gl_TexCoord[% d]; }); |
+ |
+ GLint maxTextureCoords = -1; |
+ glGetIntegerv(GL_MAX_TEXTURE_COORDS_CHROMIUM, &maxTextureCoords); |
+ EXPECT_LT(static_cast<GLint>(0), maxTextureCoords); |
+ |
+ // Using too big TexCoord index should fail. |
+ std::string fs_str_too_big = base::StringPrintf(fs_str, maxTextureCoords); |
+ |
+ const char* shader_str = fs_str_too_big.c_str(); |
+ GLuint fs = glCreateShader(GL_FRAGMENT_SHADER); |
+ GLint value = 0; |
+ glShaderSource(fs, 1, &shader_str, NULL); |
+ glCompileShader(fs); |
+ glGetShaderiv(fs, GL_COMPILE_STATUS, &value); |
+ EXPECT_EQ(static_cast<GLint>(0), value); |
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
+ glDeleteShader(fs); |
+} |
+ |
+TEST_F(CHROMIUMPathRenderingTest, NoExtensionTexCoordShaderFails) { |
+ static const char* shader_str = SHADER( |
+ precision mediump float; void main() { gl_FragColor = gl_TexCoord[0]; }); |
+ GLuint fs = glCreateShader(GL_FRAGMENT_SHADER); |
+ GLint value = 0; |
+ glShaderSource(fs, 1, &shader_str, NULL); |
+ glCompileShader(fs); |
+ glGetShaderiv(fs, GL_COMPILE_STATUS, &value); |
+ EXPECT_EQ(static_cast<GLint>(0), value); |
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
+ glDeleteShader(fs); |
+} |
+ |
+TEST_F(CHROMIUMPathRenderingTest, TestSimpleCalls) { |
+ if (!GLTestHelper::HasExtension("GL_CHROMIUM_path_rendering")) { |
+ return; |
+ } |
+ |
+ GLuint path = glGenPathsCHROMIUM(1); |
+ EXPECT_TRUE(path != 0); |
+ glDeletePathsCHROMIUM(path, 1); |
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
+ |
+ GLuint firstPath = glGenPathsCHROMIUM(5); |
+ EXPECT_TRUE(firstPath != 0); |
+ glDeletePathsCHROMIUM(firstPath, 5); |
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
+ |
+ // Test deleting paths that are not actually allocated: |
+ // "unused names in /paths/ are silently ignored" |
+ firstPath = glGenPathsCHROMIUM(5); |
+ EXPECT_TRUE(firstPath != 0); |
+ glDeletePathsCHROMIUM(firstPath, 6); |
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
+ |
+ GLint maxTextureCoords = -1; |
+ glGetIntegerv(GL_MAX_TEXTURE_COORDS_CHROMIUM, &maxTextureCoords); |
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
+ EXPECT_LT(static_cast<GLint>(0), maxTextureCoords); |
+} |
+ |
+TEST_F(CHROMIUMPathRenderingTest, TestErrors) { |
+ if (!GLTestHelper::HasExtension("GL_CHROMIUM_path_rendering")) { |
+ return; |
+ } |
+ |
+ // This is unspecified. |
+ EXPECT_EQ(static_cast<GLuint>(-1), glGenPathsCHROMIUM(0)); |
+ EXPECT_EQ(static_cast<GLenum>(GL_INVALID_VALUE), glGetError()); |
+ |
+ // Using non-existing path object produces error. |
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
+ glPathParameterfCHROMIUM(555, GL_PATH_STROKE_WIDTH_CHROMIUM, 5.0f); |
+ EXPECT_EQ(static_cast<GLenum>(GL_INVALID_OPERATION), glGetError()); |
+ |
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
+ glPathParameteriCHROMIUM(555, GL_PATH_JOIN_STYLE_CHROMIUM, GL_ROUND_CHROMIUM); |
+ EXPECT_EQ(static_cast<GLenum>(GL_INVALID_OPERATION), glGetError()); |
+ |
+ // Trying to create a path object with non-existing path name produces error. |
+ // (Not a error in real NV_path_rendering). |
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
+ GLubyte commands[] = {GL_MOVE_TO_CHROMIUM, GL_CLOSE_PATH_CHROMIUM}; |
+ GLfloat coords[] = {50.0f, 50.0f}; |
+ glPathCommandsCHROMIUM(555, arraysize(commands), commands, arraysize(coords), |
+ GL_FLOAT, coords); |
+ EXPECT_EQ(static_cast<GLenum>(GL_INVALID_OPERATION), glGetError()); |
+ |
+ // Try creating a path object with non-GLfloat coords |
+ GLint path = glGenPathsCHROMIUM(1); |
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
+ GLbyte coords_b[] = {0, 0}; |
+ glPathCommandsCHROMIUM(path, arraysize(commands), commands, |
+ arraysize(coords_b), GL_BYTE, coords_b); |
+ EXPECT_EQ(static_cast<GLenum>(GL_INVALID_ENUM), glGetError()); |
+ |
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
+ GLshort coords_s[] = {0, 0}; |
+ glPathCommandsCHROMIUM(path, arraysize(commands), commands, |
+ arraysize(coords_s), GL_SHORT, coords_s); |
+ EXPECT_EQ(static_cast<GLenum>(GL_INVALID_ENUM), glGetError()); |
+ |
+ // Test that using other pathNameType than GL_UNSIGNED_INT fails for Instanced |
+ // functions. |
+ glPathCommandsCHROMIUM(path, arraysize(commands), commands, arraysize(coords), |
+ GL_FLOAT, coords); |
+ |
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
+ GLbyte pathsb[] = {1, 1, 1, 1, 1}; |
+ glStencilStrokePathInstancedCHROMIUM(arraysize(pathsb), GL_BYTE, pathsb, |
+ path - 1, 0x80, 0x80, GL_NONE, NULL); |
+ EXPECT_EQ(static_cast<GLenum>(GL_INVALID_ENUM), glGetError()); |
+ |
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
+ GLint pathssi[] = {1, 1, 1, 1, 1}; |
+ glStencilStrokePathInstancedCHROMIUM(arraysize(pathssi), GL_INT, pathssi, |
+ path - 1, 0x80, 0x80, GL_NONE, NULL); |
+ EXPECT_EQ(static_cast<GLenum>(GL_INVALID_ENUM), glGetError()); |
+ |
+ // Test that using pathNameType GL_UNSIGNED_INT succeeds. |
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
+ GLuint pathsui[] = {1, 1, 1, 1, 1}; |
+ glStencilStrokePathInstancedCHROMIUM(arraysize(pathsui), GL_UNSIGNED_INT, |
+ pathsui, path - 1, 0x80, 0x80, GL_NONE, |
+ NULL); |
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
+ |
+ // Test that using bogus transform enum (GL_FASTEST) fails. |
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
+ glStencilStrokePathInstancedCHROMIUM(arraysize(pathsui), GL_UNSIGNED_INT, |
+ pathsui, path - 1, 0x80, 0x80, |
+ GL_FASTEST, |
+ NULL); |
+ EXPECT_EQ(static_cast<GLenum>(GL_INVALID_ENUM), glGetError()); |
+ |
+ |
+ glDeletePathsCHROMIUM(path, 1); |
+} |
+ |
+// Tests that drawing with CHROMIUM_path_rendering functions work. |
+TEST_F(CHROMIUMPathRenderingTest, TestPathRendering) { |
+ if (!GLTestHelper::HasExtension("GL_CHROMIUM_path_rendering")) { |
+ return; |
+ } |
+ |
+ SetupStateForTestPattern(); |
+ |
+ GLuint path = glGenPathsCHROMIUM(1); |
+ SetupPathStateForTestPattern(path); |
+ |
+ // Do the stencil fill, cover fill, stencil stroke, cover stroke |
+ // in unconventional order: |
+ // 1) stencil the stroke in stencil high bit |
+ // 2) stencil the fill in low bits |
+ // 3) cover the fill |
+ // 4) cover the stroke |
+ // This is done to check that glPathStencilFunc works, eg the mask |
+ // goes through. Stencil func is not tested ATM, for simplicity. |
+ |
+ glPathStencilFuncCHROMIUM(GL_ALWAYS, 0, 0xFF); |
+ glStencilStrokePathCHROMIUM(path, 0x80, 0x80); |
+ |
+ glPathStencilFuncCHROMIUM(GL_ALWAYS, 0, 0x7F); |
+ glStencilFillPathCHROMIUM(path, GL_COUNT_UP_CHROMIUM, 0x7F); |
+ |
+ // TexCoord generation is tested by using the TexCoord values |
+ // as pixel values. Transform object coords, eg. [0..width], to [0..1]. |
+ // Setup two texture coordinate sets so that we check the support |
+ // for multiple TexCoords. See the verification section on how the |
+ // pixel color should look like. |
+ glPathTexGenCHROMIUM( |
+ GL_TEXTURE0, GL_OBJECT_LINEAR_CHROMIUM, 3, fill_coefficients_); |
+ glPathTexGenCHROMIUM(GL_TEXTURE0 + 1, |
+ GL_OBJECT_LINEAR_CHROMIUM, |
+ 3, |
+ &fill_coefficients_[3 * 3]); |
+ |
+ glStencilFunc(GL_LESS, 0, 0x7F); |
+ glStencilOp(GL_KEEP, GL_KEEP, GL_ZERO); |
+ glCoverFillPathCHROMIUM(path, GL_BOUNDING_BOX_CHROMIUM); |
+ |
+ glPathTexGenCHROMIUM( |
+ GL_TEXTURE0, GL_OBJECT_LINEAR_CHROMIUM, 3, stroke_coefficients_); |
+ glPathTexGenCHROMIUM( |
+ GL_TEXTURE0 + 1, GL_OBJECT_LINEAR_CHROMIUM, 3, stroke_coefficients_); |
+ glStencilFunc(GL_EQUAL, 0x80, 0x80); |
+ glStencilOp(GL_KEEP, GL_KEEP, GL_ZERO); |
+ glCoverStrokePathCHROMIUM(path, GL_BOUNDING_BOX_CHROMIUM); |
+ |
+ glDeletePathsCHROMIUM(path, 1); |
+ |
+ // Verify the image. |
+ VerifyTestPatternFill(0.f, 0.f); |
+ VerifyTestPatternBg(0.f, 0.f); |
+ VerifyTestPatternStroke(0.f, 0.f); |
+} |
+ |
+// Tests that drawing with *Instanced functions work. |
+TEST_F(CHROMIUMPathRenderingTest, TestPathRenderingInstanced) { |
+ if (!GLTestHelper::HasExtension("GL_CHROMIUM_path_rendering")) { |
+ return; |
+ } |
+ |
+ SetupStateForTestPattern(); |
+ |
+ GLuint path = glGenPathsCHROMIUM(1); |
+ SetupPathStateForTestPattern(path); |
+ |
+ GLuint paths[] = {1, 1, 1, 1, 1}; |
+ GLfloat transforms[] = { |
+ 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, |
+ 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 20.0f, 20.0f, 0.0f, |
+ 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 30.0f, 30.0f, 0.0f, |
+ 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 40.0f, 40.0f, 0.0f, |
+ 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 50.0f, 50.0f, 0.0f, |
+ 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 60.0f, 60.0f, 0.0f, |
+ }; |
+ |
+ // The test pattern is the same as in the simple draw case above, |
+ // except that the path is drawn 5 times with different offsets. |
+ glPathStencilFuncCHROMIUM(GL_ALWAYS, 0, 0xFF); |
+ glStencilStrokePathInstancedCHROMIUM(5, |
+ GL_UNSIGNED_INT, |
+ paths, |
+ path - 1, |
+ 0x80, |
+ 0x80, |
+ GL_AFFINE_3D_CHROMIUM, |
+ transforms); |
+ |
+ glPathStencilFuncCHROMIUM(GL_ALWAYS, 0, 0x7F); |
+ glStencilFillPathInstancedCHROMIUM(5, |
+ GL_UNSIGNED_INT, |
+ paths, |
+ path - 1, |
+ GL_COUNT_UP_CHROMIUM, |
+ 0x7F, |
+ GL_AFFINE_3D_CHROMIUM, |
+ transforms); |
+ |
+ glPathTexGenCHROMIUM( |
+ GL_TEXTURE0, GL_OBJECT_LINEAR_CHROMIUM, 3, fill_coefficients_); |
+ glPathTexGenCHROMIUM(GL_TEXTURE0 + 1, |
+ GL_OBJECT_LINEAR_CHROMIUM, |
+ 3, |
+ &fill_coefficients_[3 * 3]); |
+ |
+ glStencilFunc(GL_LESS, 0, 0x7F); |
+ glStencilOp(GL_KEEP, GL_KEEP, GL_ZERO); |
+ glCoverFillPathInstancedCHROMIUM(5, |
+ GL_UNSIGNED_INT, |
+ paths, |
+ path - 1, |
+ GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM, |
+ GL_AFFINE_3D_CHROMIUM, |
+ transforms); |
+ |
+ glPathTexGenCHROMIUM( |
+ GL_TEXTURE0, GL_OBJECT_LINEAR_CHROMIUM, 3, stroke_coefficients_); |
+ glPathTexGenCHROMIUM( |
+ GL_TEXTURE0 + 1, GL_OBJECT_LINEAR_CHROMIUM, 3, stroke_coefficients_); |
+ glStencilFunc(GL_EQUAL, 0x80, 0x80); |
+ glStencilOp(GL_KEEP, GL_KEEP, GL_ZERO); |
+ glCoverStrokePathInstancedCHROMIUM(5, |
+ GL_UNSIGNED_INT, |
+ paths, |
+ path - 1, |
+ GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM, |
+ GL_AFFINE_3D_CHROMIUM, |
+ transforms); |
+ |
+ glDeletePathsCHROMIUM(path, 1); |
+#if 0 |
+ // FIXME: the instanced picture is not set up to be correct yet, |
+ // and neither is the verification. |
+ GLTestHelper::SaveBackbufferAsBMP("nvpr-unittest.bmp", kResolution, |
+ kResolution); |
+ // Verify the image. |
+ VerifyTestPatternFill(0.f, 0.f); |
+ VerifyTestPatternBg(0.f, 0.f); |
+ VerifyTestPatternStroke(0.f, 0.f); |
+#endif |
+} |
+ |
} // namespace gpu |