| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "media/tools/player_x11/gles_video_renderer.h" | 5 #include "media/tools/player_x11/gles_video_renderer.h" |
| 6 | 6 |
| 7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
| 8 #include <EGL/eglext.h> | 8 #include <EGL/eglext.h> |
| 9 #include <X11/Xutil.h> | 9 #include <X11/Xutil.h> |
| 10 #include <X11/extensions/Xrender.h> | 10 #include <X11/extensions/Xrender.h> |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 GLenum type, | 357 GLenum type, |
| 358 const char* source, | 358 const char* source, |
| 359 int size) { | 359 int size) { |
| 360 GLuint shader = glCreateShader(type); | 360 GLuint shader = glCreateShader(type); |
| 361 glShaderSource(shader, 1, &source, &size); | 361 glShaderSource(shader, 1, &source, &size); |
| 362 glCompileShader(shader); | 362 glCompileShader(shader); |
| 363 int result = GL_FALSE; | 363 int result = GL_FALSE; |
| 364 glGetShaderiv(shader, GL_COMPILE_STATUS, &result); | 364 glGetShaderiv(shader, GL_COMPILE_STATUS, &result); |
| 365 if (!result) { | 365 if (!result) { |
| 366 char log[kErrorSize]; | 366 char log[kErrorSize]; |
| 367 int len; | 367 int len = 0; |
| 368 glGetShaderInfoLog(shader, kErrorSize - 1, &len, log); | 368 glGetShaderInfoLog(shader, kErrorSize - 1, &len, log); |
| 369 log[kErrorSize - 1] = 0; | 369 log[kErrorSize - 1] = 0; |
| 370 LOG(FATAL) << log; | 370 LOG(FATAL) << log; |
| 371 } | 371 } |
| 372 glAttachShader(program, shader); | 372 glAttachShader(program, shader); |
| 373 glDeleteShader(shader); | 373 glDeleteShader(shader); |
| 374 } | 374 } |
| 375 | 375 |
| 376 void GlesVideoRenderer::LinkProgram(GLuint program) { | 376 void GlesVideoRenderer::LinkProgram(GLuint program) { |
| 377 glLinkProgram(program); | 377 glLinkProgram(program); |
| 378 int result = GL_FALSE; | 378 int result = GL_FALSE; |
| 379 glGetProgramiv(program, GL_LINK_STATUS, &result); | 379 glGetProgramiv(program, GL_LINK_STATUS, &result); |
| 380 if (!result) { | 380 if (!result) { |
| 381 char log[kErrorSize]; | 381 char log[kErrorSize]; |
| 382 int len; | 382 int len = 0; |
| 383 glGetProgramInfoLog(program, kErrorSize - 1, &len, log); | 383 glGetProgramInfoLog(program, kErrorSize - 1, &len, log); |
| 384 log[kErrorSize - 1] = 0; | 384 log[kErrorSize - 1] = 0; |
| 385 LOG(FATAL) << log; | 385 LOG(FATAL) << log; |
| 386 } | 386 } |
| 387 glUseProgram(program); | 387 glUseProgram(program); |
| 388 glDeleteProgram(program); | 388 glDeleteProgram(program); |
| 389 } | 389 } |
| 390 | 390 |
| 391 void GlesVideoRenderer::CreateTextureAndProgramEgl() { | 391 void GlesVideoRenderer::CreateTextureAndProgramEgl() { |
| 392 if (!egl_create_image_khr_) | 392 if (!egl_create_image_khr_) |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 | 507 |
| 508 int pos_location = glGetAttribLocation(program, "in_pos"); | 508 int pos_location = glGetAttribLocation(program, "in_pos"); |
| 509 glEnableVertexAttribArray(pos_location); | 509 glEnableVertexAttribArray(pos_location); |
| 510 glVertexAttribPointer(pos_location, 2, GL_FLOAT, GL_FALSE, 0, kVertices); | 510 glVertexAttribPointer(pos_location, 2, GL_FLOAT, GL_FALSE, 0, kVertices); |
| 511 | 511 |
| 512 int tc_location = glGetAttribLocation(program, "in_tc"); | 512 int tc_location = glGetAttribLocation(program, "in_tc"); |
| 513 glEnableVertexAttribArray(tc_location); | 513 glEnableVertexAttribArray(tc_location); |
| 514 glVertexAttribPointer(tc_location, 2, GL_FLOAT, GL_FALSE, 0, | 514 glVertexAttribPointer(tc_location, 2, GL_FLOAT, GL_FALSE, 0, |
| 515 kTextureCoords); | 515 kTextureCoords); |
| 516 } | 516 } |
| OLD | NEW |