| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 #include <stdio.h> | 5 #include <stdio.h> |
| 6 | 6 |
| 7 #include "main.h" | 7 #include "main.h" |
| 8 #include "testbase.h" | 8 #include "testbase.h" |
| 9 #include "utils.h" | 9 #include "utils.h" |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 void InitializeCompositing(); | 27 void InitializeCompositing(); |
| 28 void TeardownCompositing(); | 28 void TeardownCompositing(); |
| 29 void InitBaseTexture(); | 29 void InitBaseTexture(); |
| 30 void UpdateTexture(); | 30 void UpdateTexture(); |
| 31 void LoadTexture(); | 31 void LoadTexture(); |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 bool scissor_; | 34 bool scissor_; |
| 35 uint32_t texture_base_[WINDOW_HEIGHT*WINDOW_WIDTH]; | 35 uint32_t texture_base_[WINDOW_HEIGHT*WINDOW_WIDTH]; |
| 36 uint32_t texture_update_[WINDOW_HEIGHT*WINDOW_WIDTH]; | 36 uint32_t texture_update_[WINDOW_HEIGHT*WINDOW_WIDTH]; |
| 37 #ifndef USE_EGL | |
| 38 GLuint compositing_textures_[5]; | 37 GLuint compositing_textures_[5]; |
| 39 GLuint compositing_background_program_; | 38 GLuint compositing_background_program_; |
| 40 GLuint compositing_foreground_program_; | 39 GLuint compositing_foreground_program_; |
| 41 #endif | |
| 42 DISALLOW_COPY_AND_ASSIGN(WindowManagerCompositingTest); | 40 DISALLOW_COPY_AND_ASSIGN(WindowManagerCompositingTest); |
| 43 }; | 41 }; |
| 44 | 42 |
| 45 TestBase* GetWindowManagerCompositingTest(bool enable_scissor) { | 43 TestBase* GetWindowManagerCompositingTest(bool enable_scissor) { |
| 46 return new WindowManagerCompositingTest(enable_scissor); | 44 return new WindowManagerCompositingTest(enable_scissor); |
| 47 } | 45 } |
| 48 | 46 |
| 49 bool WindowManagerCompositingTest::Run() { | 47 bool WindowManagerCompositingTest::Run() { |
| 50 const char* testname = "1280x768_fps_compositing"; | 48 const char* testname = "1280x768_fps_compositing"; |
| 51 if (scissor_) { | 49 if (scissor_) { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 // This is a static window, so we don't update it. | 115 // This is a static window, so we don't update it. |
| 118 glActiveTexture(GL_TEXTURE0); | 116 glActiveTexture(GL_TEXTURE0); |
| 119 glBindTexture(GL_TEXTURE_2D, compositing_textures_[4]); | 117 glBindTexture(GL_TEXTURE_2D, compositing_textures_[4]); |
| 120 // TODO(papakipos): add color interpolation here, and modulate | 118 // TODO(papakipos): add color interpolation here, and modulate |
| 121 // texture against it. | 119 // texture against it. |
| 122 glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); | 120 glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); |
| 123 } | 121 } |
| 124 return true; | 122 return true; |
| 125 } | 123 } |
| 126 | 124 |
| 127 #if I915_WORKAROUND | 125 #if defined(I915_WORKAROUND) |
| 128 #define V1 "gl_TexCoord[0]" | 126 #define V1 "gl_TexCoord[0]" |
| 129 #define V2 "gl_TexCoord[1]" | 127 #define V2 "gl_TexCoord[1]" |
| 130 #define V3 "gl_TexCoord[2]" | 128 #define V3 "gl_TexCoord[2]" |
| 131 #else | 129 #else |
| 132 #define V1 "v1" | 130 #define V1 "v1" |
| 133 #define V2 "v2" | 131 #define V2 "v2" |
| 134 #define V3 "v3" | 132 #define V3 "v3" |
| 135 #endif | 133 #endif |
| 136 | 134 |
| 137 const char *kBasicTextureVertexShader = | 135 const char *kBasicTextureVertexShader = |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 } | 409 } |
| 412 | 410 |
| 413 void WindowManagerCompositingTest::LoadTexture() { | 411 void WindowManagerCompositingTest::LoadTexture() { |
| 414 // Use GL_RGBA for compatibility with GLES2.0. | 412 // Use GL_RGBA for compatibility with GLES2.0. |
| 415 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, | 413 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, |
| 416 WINDOW_WIDTH, WINDOW_HEIGHT, 0, | 414 WINDOW_WIDTH, WINDOW_HEIGHT, 0, |
| 417 GL_RGBA, GL_UNSIGNED_BYTE, texture_update_); | 415 GL_RGBA, GL_UNSIGNED_BYTE, texture_update_); |
| 418 } | 416 } |
| 419 | 417 |
| 420 } // namespace glbench | 418 } // namespace glbench |
| OLD | NEW |