| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file defines tests that implementations of GLImage should pass in order | 5 // This file defines tests that implementations of GLImage should pass in order |
| 6 // to be conformant. | 6 // to be conformant. |
| 7 | 7 |
| 8 #ifndef UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ | 8 #ifndef UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ |
| 9 #define UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ | 9 #define UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ |
| 10 | 10 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 "#define SamplerType sampler2D\n" | 60 "#define SamplerType sampler2D\n" |
| 61 "#define TextureLookup texture2D\n" | 61 "#define TextureLookup texture2D\n" |
| 62 "#define TextureScale vec2(1.0, 1.0)\n" | 62 "#define TextureScale vec2(1.0, 1.0)\n" |
| 63 "%s", | 63 "%s", |
| 64 is_gles ? kShaderFloatPrecision : "", | 64 is_gles ? kShaderFloatPrecision : "", |
| 65 kFragmentShader) | 65 kFragmentShader) |
| 66 .c_str()); | 66 .c_str()); |
| 67 case GL_TEXTURE_RECTANGLE_ARB: | 67 case GL_TEXTURE_RECTANGLE_ARB: |
| 68 return GLHelper::LoadShader( | 68 return GLHelper::LoadShader( |
| 69 GL_FRAGMENT_SHADER, | 69 GL_FRAGMENT_SHADER, |
| 70 base::StringPrintf("%s\n" | 70 base::StringPrintf("#extension GL_ARB_texture_rectangle : require\n" |
| 71 "#extension GL_ARB_texture_rectangle : require\n" | 71 "%s\n" |
| 72 "#define SamplerType sampler2DRect\n" | 72 "#define SamplerType sampler2DRect\n" |
| 73 "#define TextureLookup texture2DRect\n" | 73 "#define TextureLookup texture2DRect\n" |
| 74 "#define TextureScale vec2(%f, %f)\n" | 74 "#define TextureScale vec2(%f, %f)\n" |
| 75 "%s", | 75 "%s", |
| 76 is_gles ? kShaderFloatPrecision : "", | 76 is_gles ? kShaderFloatPrecision : "", |
| 77 static_cast<double>(size.width()), | 77 static_cast<double>(size.width()), |
| 78 static_cast<double>(size.height()), | 78 static_cast<double>(size.height()), |
| 79 kFragmentShader) | 79 kFragmentShader) |
| 80 .c_str()); | 80 .c_str()); |
| 81 case GL_TEXTURE_EXTERNAL_OES: |
| 82 return GLHelper::LoadShader( |
| 83 GL_FRAGMENT_SHADER, |
| 84 base::StringPrintf("#extension GL_OES_EGL_image_external : require\n" |
| 85 "%s\n" |
| 86 "#define SamplerType samplerExternalOES\n" |
| 87 "#define TextureLookup texture2D\n" |
| 88 "#define TextureScale vec2(1.0, 1.0)\n" |
| 89 "%s", |
| 90 is_gles ? kShaderFloatPrecision : "", |
| 91 kFragmentShader) |
| 92 .c_str()); |
| 81 default: | 93 default: |
| 82 NOTREACHED(); | 94 NOTREACHED(); |
| 83 return 0; | 95 return 0; |
| 84 } | 96 } |
| 85 } | 97 } |
| 86 | 98 |
| 87 // Draws texture bound to |target| of texture unit 0 to the currently bound | 99 // Draws texture bound to |target| of texture unit 0 to the currently bound |
| 88 // frame buffer. | 100 // frame buffer. |
| 89 void DrawTextureQuad(GLenum target, const gfx::Size& size) { | 101 void DrawTextureQuad(GLenum target, const gfx::Size& size) { |
| 90 // clang-format off | 102 // clang-format off |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 image->Destroy(true /* have_context */); | 342 image->Destroy(true /* have_context */); |
| 331 } | 343 } |
| 332 | 344 |
| 333 // The GLImageCopyTest test case verifies that the GLImage implementation | 345 // The GLImageCopyTest test case verifies that the GLImage implementation |
| 334 // handles CopyTexImage correctly. | 346 // handles CopyTexImage correctly. |
| 335 REGISTER_TYPED_TEST_CASE_P(GLImageCopyTest, CopyTexImage); | 347 REGISTER_TYPED_TEST_CASE_P(GLImageCopyTest, CopyTexImage); |
| 336 | 348 |
| 337 } // namespace gl | 349 } // namespace gl |
| 338 | 350 |
| 339 #endif // UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ | 351 #endif // UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ |
| OLD | NEW |