Chromium Code Reviews| Index: ppapi/examples/video_decode/video_decode_dev.cc |
| diff --git a/ppapi/examples/video_decode/video_decode_dev.cc b/ppapi/examples/video_decode/video_decode_dev.cc |
| index d6cb592bfa13e6ea46cc90e769d44652aeb5dee8..99af7215355b8d38f79d0c74f4d9b4cd2f9041f5 100644 |
| --- a/ppapi/examples/video_decode/video_decode_dev.cc |
| +++ b/ppapi/examples/video_decode/video_decode_dev.cc |
| @@ -35,8 +35,7 @@ |
| // Assert |context_| isn't holding any GL Errors. Done as a macro instead of a |
| // function to preserve line number information in the failure message. |
| -#define assertNoGLError() \ |
| - assert(!gles2_if_->GetError(context_->pp_resource())); |
| +#define assertNoGLError() assert(!gles2_if_->GetError(context_->pp_resource())); |
|
Ami GONE FROM CHROMIUM
2014/05/28 20:50:56
I assume almost all the edits in this file are cla
bbudge
2014/05/29 00:03:34
I'm not sure what happened here. I'll remove this
|
| namespace { |
| @@ -46,8 +45,7 @@ struct PictureBufferInfo { |
| }; |
| struct Shader { |
| - Shader() : program(0), |
| - texcoord_scale_location(0) {} |
| + Shader() : program(0), texcoord_scale_location(0) {} |
| GLuint program; |
| GLint texcoord_scale_location; |
| @@ -74,19 +72,20 @@ class VideoDecodeDemoInstance : public pp::Instance, |
| } |
| // pp::VideoDecoderClient_Dev implementation. |
| - virtual void ProvidePictureBuffers( |
| - PP_Resource decoder, |
| - uint32_t req_num_of_bufs, |
| - const PP_Size& dimensions, |
| - uint32_t texture_target); |
| + virtual void ProvidePictureBuffers(PP_Resource decoder, |
| + uint32_t req_num_of_bufs, |
| + const PP_Size& dimensions, |
| + uint32_t texture_target); |
| virtual void DismissPictureBuffer(PP_Resource decoder, |
| int32_t picture_buffer_id); |
| virtual void PictureReady(PP_Resource decoder, const PP_Picture_Dev& picture); |
| virtual void NotifyError(PP_Resource decoder, PP_VideoDecodeError_Dev error); |
| private: |
| - enum { kNumConcurrentDecodes = 7, |
| - kNumDecoders = 2 }; // Baked into viewport rendering. |
| + enum { |
| + kNumConcurrentDecodes = 7, |
| + kNumDecoders = 2 |
| + }; // Baked into viewport rendering. |
| // A single decoder's client interface. |
| class DecoderClient { |
| @@ -98,10 +97,9 @@ class VideoDecodeDemoInstance : public pp::Instance, |
| void DecodeNextNALUs(); |
| // Per-decoder implementation of part of pp::VideoDecoderClient_Dev. |
| - void ProvidePictureBuffers( |
| - uint32_t req_num_of_bufs, |
| - PP_Size dimensions, |
| - uint32_t texture_target); |
| + void ProvidePictureBuffers(uint32_t req_num_of_bufs, |
| + PP_Size dimensions, |
| + uint32_t texture_target); |
| void DismissPictureBuffer(int32_t picture_buffer_id); |
| const PictureBufferInfo& GetPictureBufferInfoById(int id); |
| @@ -137,11 +135,11 @@ class VideoDecodeDemoInstance : public pp::Instance, |
| void CreateGLObjects(); |
| void Create2DProgramOnce(); |
| void CreateRectangleARBProgramOnce(); |
| - Shader CreateProgram(const char* vertex_shader, |
| - const char* fragment_shader); |
| + Shader CreateProgram(const char* vertex_shader, const char* fragment_shader); |
| void CreateShader(GLuint program, GLenum type, const char* source, int size); |
| void DeleteTexture(GLuint id); |
| - void PaintFinished(int32_t result, PP_Resource decoder, |
| + void PaintFinished(int32_t result, |
| + PP_Resource decoder, |
| int picture_buffer_id); |
| // Log an error to the developer console and stderr (though the latter may be |
| @@ -153,14 +151,15 @@ class VideoDecodeDemoInstance : public pp::Instance, |
| LogError(VideoDecodeDemoInstance* demo) : demo_(demo) {} |
| ~LogError() { |
| const std::string& msg = stream_.str(); |
| - demo_->console_if_->Log(demo_->pp_instance(), PP_LOGLEVEL_ERROR, |
| - pp::Var(msg).pp_var()); |
| + demo_->console_if_->Log( |
| + demo_->pp_instance(), PP_LOGLEVEL_ERROR, pp::Var(msg).pp_var()); |
| std::cerr << msg << std::endl; |
| } |
| // Impl note: it would have been nicer to have LogError derive from |
| // std::ostringstream so that it can be streamed to directly, but lookup |
| // rules turn streamed string literals to hex pointers on output. |
| std::ostringstream& s() { return stream_; } |
| + |
| private: |
| VideoDecodeDemoInstance* demo_; // Unowned. |
| std::ostringstream stream_; |
| @@ -194,10 +193,14 @@ class VideoDecodeDemoInstance : public pp::Instance, |
| }; |
| VideoDecodeDemoInstance::DecoderClient::DecoderClient( |
| - VideoDecodeDemoInstance* gles2, pp::VideoDecoder_Dev* decoder) |
| - : gles2_(gles2), decoder_(decoder), callback_factory_(this), |
| + VideoDecodeDemoInstance* gles2, |
| + pp::VideoDecoder_Dev* decoder) |
| + : gles2_(gles2), |
| + decoder_(decoder), |
| + callback_factory_(this), |
| next_picture_buffer_id_(0), |
| - next_bitstream_buffer_id_(0), encoded_data_next_pos_to_decode_(0) { |
| + next_bitstream_buffer_id_(0), |
| + encoded_data_next_pos_to_decode_(0) { |
| } |
| VideoDecodeDemoInstance::DecoderClient::~DecoderClient() { |
| @@ -205,13 +208,15 @@ VideoDecodeDemoInstance::DecoderClient::~DecoderClient() { |
| decoder_ = NULL; |
| for (BitstreamBufferMap::iterator it = bitstream_buffers_by_id_.begin(); |
| - it != bitstream_buffers_by_id_.end(); ++it) { |
| + it != bitstream_buffers_by_id_.end(); |
| + ++it) { |
| delete it->second; |
| } |
| bitstream_buffers_by_id_.clear(); |
| for (PictureBufferMap::iterator it = picture_buffers_by_id_.begin(); |
| - it != picture_buffers_by_id_.end(); ++it) { |
| + it != picture_buffers_by_id_.end(); |
| + ++it) { |
| gles2_->DeleteTexture(it->second.buffer.texture_id); |
| } |
| picture_buffers_by_id_.clear(); |
| @@ -219,7 +224,8 @@ VideoDecodeDemoInstance::DecoderClient::~DecoderClient() { |
| VideoDecodeDemoInstance::VideoDecodeDemoInstance(PP_Instance instance, |
| pp::Module* module) |
| - : pp::Instance(instance), pp::Graphics3DClient(this), |
| + : pp::Instance(instance), |
| + pp::Graphics3DClient(this), |
| pp::VideoDecoderClient_Dev(this), |
| is_painting_(false), |
| num_frames_rendered_(0), |
| @@ -228,31 +234,32 @@ VideoDecodeDemoInstance::VideoDecodeDemoInstance(PP_Instance instance, |
| callback_factory_(this), |
| context_(NULL) { |
| assert((console_if_ = static_cast<const PPB_Console*>( |
| - module->GetBrowserInterface(PPB_CONSOLE_INTERFACE)))); |
| + module->GetBrowserInterface(PPB_CONSOLE_INTERFACE)))); |
| assert((core_if_ = static_cast<const PPB_Core*>( |
| - module->GetBrowserInterface(PPB_CORE_INTERFACE)))); |
| + module->GetBrowserInterface(PPB_CORE_INTERFACE)))); |
| assert((gles2_if_ = static_cast<const PPB_OpenGLES2*>( |
| - module->GetBrowserInterface(PPB_OPENGLES2_INTERFACE)))); |
| + module->GetBrowserInterface(PPB_OPENGLES2_INTERFACE)))); |
| } |
| VideoDecodeDemoInstance::~VideoDecodeDemoInstance() { |
| if (shader_2d_.program) |
| gles2_if_->DeleteProgram(context_->pp_resource(), shader_2d_.program); |
| if (shader_rectangle_arb_.program) { |
| - gles2_if_->DeleteProgram( |
| - context_->pp_resource(), shader_rectangle_arb_.program); |
| + gles2_if_->DeleteProgram(context_->pp_resource(), |
| + shader_rectangle_arb_.program); |
| } |
| for (Decoders::iterator it = video_decoders_.begin(); |
| - it != video_decoders_.end(); ++it) { |
| + it != video_decoders_.end(); |
| + ++it) { |
| delete it->second; |
| } |
| video_decoders_.clear(); |
| delete context_; |
| } |
| -void VideoDecodeDemoInstance::DidChangeView( |
| - const pp::Rect& position, const pp::Rect& clip_ignored) { |
| +void VideoDecodeDemoInstance::DidChangeView(const pp::Rect& position, |
| + const pp::Rect& clip_ignored) { |
| if (position.width() == 0 || position.height() == 0) |
| return; |
| if (plugin_size_.width()) { |
| @@ -270,17 +277,20 @@ void VideoDecodeDemoInstance::InitializeDecoders() { |
| assert(video_decoders_.empty()); |
| for (int i = 0; i < kNumDecoders; ++i) { |
| DecoderClient* client = new DecoderClient( |
| - this, new pp::VideoDecoder_Dev( |
| + this, |
| + new pp::VideoDecoder_Dev( |
| this, *context_, PP_VIDEODECODER_H264PROFILE_MAIN)); |
| assert(!client->decoder()->is_null()); |
| - assert(video_decoders_.insert(std::make_pair( |
| - client->decoder()->pp_resource(), client)).second); |
| + assert( |
| + video_decoders_.insert(std::make_pair(client->decoder()->pp_resource(), |
| + client)).second); |
| client->DecodeNextNALUs(); |
| } |
| } |
| void VideoDecodeDemoInstance::DecoderClient::DecoderBitstreamDone( |
| - int32_t result, int bitstream_buffer_id) { |
| + int32_t result, |
| + int bitstream_buffer_id) { |
| assert(bitstream_ids_at_decoder_.erase(bitstream_buffer_id) == 1); |
| BitstreamBufferMap::iterator it = |
| bitstream_buffers_by_id_.find(bitstream_buffer_id); |
| @@ -300,18 +310,17 @@ void VideoDecodeDemoInstance::DecoderClient::DecoderFlushDone(int32_t result) { |
| } |
| static bool LookingAtNAL(const unsigned char* encoded, size_t pos) { |
| - return pos + 3 < kDataLen && |
| - encoded[pos] == 0 && encoded[pos + 1] == 0 && |
| - encoded[pos + 2] == 0 && encoded[pos + 3] == 1; |
| + return pos + 3 < kDataLen && encoded[pos] == 0 && encoded[pos + 1] == 0 && |
| + encoded[pos + 2] == 0 && encoded[pos + 3] == 1; |
| } |
| void VideoDecodeDemoInstance::DecoderClient::GetNextNALUBoundary( |
| - size_t start_pos, size_t* end_pos) { |
| + size_t start_pos, |
| + size_t* end_pos) { |
| assert(LookingAtNAL(kData, start_pos)); |
| *end_pos = start_pos; |
| *end_pos += 4; |
| - while (*end_pos + 3 < kDataLen && |
| - !LookingAtNAL(kData, *end_pos)) { |
| + while (*end_pos + 3 < kDataLen && !LookingAtNAL(kData, *end_pos)) { |
| ++*end_pos; |
| } |
| if (*end_pos + 3 >= kDataLen) { |
| @@ -347,9 +356,8 @@ void VideoDecodeDemoInstance::DecoderClient::DecodeNextNALU() { |
| memcpy(buffer->data(), kData + start_pos, end_pos - start_pos); |
| assert(bitstream_buffers_by_id_.insert(std::make_pair(id, buffer)).second); |
| - pp::CompletionCallback cb = |
| - callback_factory_.NewCallback( |
| - &VideoDecodeDemoInstance::DecoderClient::DecoderBitstreamDone, id); |
| + pp::CompletionCallback cb = callback_factory_.NewCallback( |
| + &VideoDecodeDemoInstance::DecoderClient::DecoderBitstreamDone, id); |
| assert(bitstream_ids_at_decoder_.insert(id).second); |
| encoded_data_next_pos_to_decode_ = end_pos; |
| decoder_->Decode(bitstream_buffer, cb); |
| @@ -384,15 +392,14 @@ void VideoDecodeDemoInstance::DecoderClient::ProvidePictureBuffers( |
| } |
| const PictureBufferInfo& |
| -VideoDecodeDemoInstance::DecoderClient::GetPictureBufferInfoById( |
| - int id) { |
| +VideoDecodeDemoInstance::DecoderClient::GetPictureBufferInfoById(int id) { |
| PictureBufferMap::iterator it = picture_buffers_by_id_.find(id); |
| assert(it != picture_buffers_by_id_.end()); |
| return it->second; |
| } |
| void VideoDecodeDemoInstance::DismissPictureBuffer(PP_Resource decoder, |
| - int32_t picture_buffer_id) { |
| + int32_t picture_buffer_id) { |
| DecoderClient* client = video_decoders_[decoder]; |
| assert(client); |
| client->DismissPictureBuffer(picture_buffer_id); |
| @@ -400,13 +407,13 @@ void VideoDecodeDemoInstance::DismissPictureBuffer(PP_Resource decoder, |
| void VideoDecodeDemoInstance::DecoderClient::DismissPictureBuffer( |
| int32_t picture_buffer_id) { |
| - gles2_->DeleteTexture(GetPictureBufferInfoById( |
| - picture_buffer_id).buffer.texture_id); |
| + gles2_->DeleteTexture( |
| + GetPictureBufferInfoById(picture_buffer_id).buffer.texture_id); |
| picture_buffers_by_id_.erase(picture_buffer_id); |
| } |
| void VideoDecodeDemoInstance::PictureReady(PP_Resource decoder, |
| - const PP_Picture_Dev& picture) { |
| + const PP_Picture_Dev& picture) { |
| if (first_frame_delivered_ticks_ == -1) |
| assert((first_frame_delivered_ticks_ = core_if_->GetTimeTicks()) != -1); |
| if (is_painting_) { |
| @@ -434,15 +441,17 @@ void VideoDecodeDemoInstance::PictureReady(PP_Resource decoder, |
| } else { |
| assert(info.texture_target == GL_TEXTURE_RECTANGLE_ARB); |
| CreateRectangleARBProgramOnce(); |
| - gles2_if_->UseProgram( |
| - context_->pp_resource(), shader_rectangle_arb_.program); |
| + gles2_if_->UseProgram(context_->pp_resource(), |
| + shader_rectangle_arb_.program); |
| gles2_if_->Uniform2f(context_->pp_resource(), |
| shader_rectangle_arb_.texcoord_scale_location, |
| info.buffer.size.width, |
| info.buffer.size.height); |
| } |
| - gles2_if_->Viewport(context_->pp_resource(), x, y, |
| + gles2_if_->Viewport(context_->pp_resource(), |
| + x, |
| + y, |
| plugin_size_.width() / kNumDecoders, |
| plugin_size_.height() / kNumDecoders); |
| gles2_if_->ActiveTexture(context_->pp_resource(), GL_TEXTURE0); |
| @@ -452,9 +461,8 @@ void VideoDecodeDemoInstance::PictureReady(PP_Resource decoder, |
| gles2_if_->UseProgram(context_->pp_resource(), 0); |
| - pp::CompletionCallback cb = |
| - callback_factory_.NewCallback( |
| - &VideoDecodeDemoInstance::PaintFinished, decoder, info.buffer.id); |
| + pp::CompletionCallback cb = callback_factory_.NewCallback( |
| + &VideoDecodeDemoInstance::PaintFinished, decoder, info.buffer.id); |
| last_swap_request_ticks_ = core_if_->GetTimeTicks(); |
| assert(context_->SwapBuffers(cb) == PP_OK_COMPLETIONPENDING); |
| } |
| @@ -483,17 +491,17 @@ void VideoDecodeDemoInstance::InitGL() { |
| assert(!context_); |
| int32_t context_attributes[] = { |
| - PP_GRAPHICS3DATTRIB_ALPHA_SIZE, 8, |
| - PP_GRAPHICS3DATTRIB_BLUE_SIZE, 8, |
| - PP_GRAPHICS3DATTRIB_GREEN_SIZE, 8, |
| - PP_GRAPHICS3DATTRIB_RED_SIZE, 8, |
| - PP_GRAPHICS3DATTRIB_DEPTH_SIZE, 0, |
| - PP_GRAPHICS3DATTRIB_STENCIL_SIZE, 0, |
| - PP_GRAPHICS3DATTRIB_SAMPLES, 0, |
| - PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS, 0, |
| - PP_GRAPHICS3DATTRIB_WIDTH, plugin_size_.width(), |
| - PP_GRAPHICS3DATTRIB_HEIGHT, plugin_size_.height(), |
| - PP_GRAPHICS3DATTRIB_NONE, |
| + PP_GRAPHICS3DATTRIB_ALPHA_SIZE, 8, |
| + PP_GRAPHICS3DATTRIB_BLUE_SIZE, 8, |
| + PP_GRAPHICS3DATTRIB_GREEN_SIZE, 8, |
| + PP_GRAPHICS3DATTRIB_RED_SIZE, 8, |
| + PP_GRAPHICS3DATTRIB_DEPTH_SIZE, 0, |
| + PP_GRAPHICS3DATTRIB_STENCIL_SIZE, 0, |
| + PP_GRAPHICS3DATTRIB_SAMPLES, 0, |
| + PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS, 0, |
| + PP_GRAPHICS3DATTRIB_WIDTH, plugin_size_.width(), |
| + PP_GRAPHICS3DATTRIB_HEIGHT, plugin_size_.height(), |
| + PP_GRAPHICS3DATTRIB_NONE, |
| }; |
| context_ = new pp::Graphics3D(this, context_attributes); |
| assert(!context_->is_null()); |
| @@ -508,8 +516,9 @@ void VideoDecodeDemoInstance::InitGL() { |
| CreateGLObjects(); |
| } |
| -void VideoDecodeDemoInstance::PaintFinished(int32_t result, PP_Resource decoder, |
| - int picture_buffer_id) { |
| +void VideoDecodeDemoInstance::PaintFinished(int32_t result, |
| + PP_Resource decoder, |
| + int picture_buffer_id) { |
| assert(result == PP_OK); |
| swap_ticks_ += core_if_->GetTimeTicks() - last_swap_request_ticks_; |
| is_painting_ = false; |
| @@ -519,8 +528,8 @@ void VideoDecodeDemoInstance::PaintFinished(int32_t result, PP_Resource decoder, |
| double fps = (elapsed > 0) ? num_frames_rendered_ / elapsed : 1000; |
| double ms_per_swap = (swap_ticks_ * 1e3) / num_frames_rendered_; |
| LogError(this).s() << "Rendered frames: " << num_frames_rendered_ |
| - << ", fps: " << fps << ", with average ms/swap of: " |
| - << ms_per_swap; |
| + << ", fps: " << fps |
| + << ", with average ms/swap of: " << ms_per_swap; |
| } |
| DecoderClient* client = video_decoders_[decoder]; |
| if (client && client->decoder()) |
| @@ -542,23 +551,34 @@ GLuint VideoDecodeDemoInstance::CreateTexture(int32_t width, |
| // Assign parameters. |
| gles2_if_->ActiveTexture(context_->pp_resource(), GL_TEXTURE0); |
| gles2_if_->BindTexture(context_->pp_resource(), texture_target, texture_id); |
| - gles2_if_->TexParameteri( |
| - context_->pp_resource(), texture_target, GL_TEXTURE_MIN_FILTER, |
| - GL_NEAREST); |
| - gles2_if_->TexParameteri( |
| - context_->pp_resource(), texture_target, GL_TEXTURE_MAG_FILTER, |
| - GL_NEAREST); |
| - gles2_if_->TexParameterf( |
| - context_->pp_resource(), texture_target, GL_TEXTURE_WRAP_S, |
| - GL_CLAMP_TO_EDGE); |
| - gles2_if_->TexParameterf( |
| - context_->pp_resource(), texture_target, GL_TEXTURE_WRAP_T, |
| - GL_CLAMP_TO_EDGE); |
| + gles2_if_->TexParameteri(context_->pp_resource(), |
| + texture_target, |
| + GL_TEXTURE_MIN_FILTER, |
| + GL_NEAREST); |
| + gles2_if_->TexParameteri(context_->pp_resource(), |
| + texture_target, |
| + GL_TEXTURE_MAG_FILTER, |
| + GL_NEAREST); |
| + gles2_if_->TexParameterf(context_->pp_resource(), |
| + texture_target, |
| + GL_TEXTURE_WRAP_S, |
| + GL_CLAMP_TO_EDGE); |
| + gles2_if_->TexParameterf(context_->pp_resource(), |
| + texture_target, |
| + GL_TEXTURE_WRAP_T, |
| + GL_CLAMP_TO_EDGE); |
| if (texture_target == GL_TEXTURE_2D) { |
| - gles2_if_->TexImage2D( |
| - context_->pp_resource(), texture_target, 0, GL_RGBA, width, height, 0, |
| - GL_RGBA, GL_UNSIGNED_BYTE, NULL); |
| + gles2_if_->TexImage2D(context_->pp_resource(), |
| + texture_target, |
| + 0, |
| + GL_RGBA, |
| + width, |
| + height, |
| + 0, |
| + GL_RGBA, |
| + GL_UNSIGNED_BYTE, |
| + NULL); |
| } |
| assertNoGLError(); |
| return texture_id; |
| @@ -572,16 +592,19 @@ void VideoDecodeDemoInstance::CreateGLObjects() { |
| // Assign vertex positions and texture coordinates to buffers for use in |
| // shader program. |
| static const float kVertices[] = { |
| - -1, 1, -1, -1, 1, 1, 1, -1, // Position coordinates. |
| - 0, 1, 0, 0, 1, 1, 1, 0, // Texture coordinates. |
| + -1, 1, -1, -1, 1, 1, 1, -1, // Position coordinates. |
| + 0, 1, 0, 0, 1, 1, 1, 0, // Texture coordinates. |
| }; |
| GLuint buffer; |
| gles2_if_->GenBuffers(context_->pp_resource(), 1, &buffer); |
| gles2_if_->BindBuffer(context_->pp_resource(), GL_ARRAY_BUFFER, buffer); |
| - gles2_if_->BufferData(context_->pp_resource(), GL_ARRAY_BUFFER, |
| - sizeof(kVertices), kVertices, GL_STATIC_DRAW); |
| + gles2_if_->BufferData(context_->pp_resource(), |
| + GL_ARRAY_BUFFER, |
| + sizeof(kVertices), |
| + kVertices, |
| + GL_STATIC_DRAW); |
| assertNoGLError(); |
| } |
| @@ -633,16 +656,19 @@ Shader VideoDecodeDemoInstance::CreateProgram(const char* vertex_shader, |
| // Create shader program. |
| shader.program = gles2_if_->CreateProgram(context_->pp_resource()); |
| - CreateShader(shader.program, GL_VERTEX_SHADER, vertex_shader, |
| - strlen(vertex_shader)); |
| - CreateShader(shader.program, GL_FRAGMENT_SHADER, fragment_shader, |
| + CreateShader( |
| + shader.program, GL_VERTEX_SHADER, vertex_shader, strlen(vertex_shader)); |
| + CreateShader(shader.program, |
| + GL_FRAGMENT_SHADER, |
| + fragment_shader, |
| strlen(fragment_shader)); |
| gles2_if_->LinkProgram(context_->pp_resource(), shader.program); |
| gles2_if_->UseProgram(context_->pp_resource(), shader.program); |
| gles2_if_->Uniform1i( |
| context_->pp_resource(), |
| gles2_if_->GetUniformLocation( |
| - context_->pp_resource(), shader.program, "s_texture"), 0); |
| + context_->pp_resource(), shader.program, "s_texture"), |
| + 0); |
| assertNoGLError(); |
| shader.texcoord_scale_location = gles2_if_->GetUniformLocation( |
| @@ -655,11 +681,16 @@ Shader VideoDecodeDemoInstance::CreateProgram(const char* vertex_shader, |
| assertNoGLError(); |
| gles2_if_->EnableVertexAttribArray(context_->pp_resource(), pos_location); |
| - gles2_if_->VertexAttribPointer(context_->pp_resource(), pos_location, 2, |
| - GL_FLOAT, GL_FALSE, 0, 0); |
| + gles2_if_->VertexAttribPointer( |
| + context_->pp_resource(), pos_location, 2, GL_FLOAT, GL_FALSE, 0, 0); |
| gles2_if_->EnableVertexAttribArray(context_->pp_resource(), tc_location); |
| gles2_if_->VertexAttribPointer( |
| - context_->pp_resource(), tc_location, 2, GL_FLOAT, GL_FALSE, 0, |
| + context_->pp_resource(), |
| + tc_location, |
| + 2, |
| + GL_FLOAT, |
| + GL_FALSE, |
| + 0, |
| static_cast<float*>(0) + 8); // Skip position coordinates. |
| gles2_if_->UseProgram(context_->pp_resource(), 0); |
| @@ -667,8 +698,10 @@ Shader VideoDecodeDemoInstance::CreateProgram(const char* vertex_shader, |
| return shader; |
| } |
| -void VideoDecodeDemoInstance::CreateShader( |
| - GLuint program, GLenum type, const char* source, int size) { |
| +void VideoDecodeDemoInstance::CreateShader(GLuint program, |
| + GLenum type, |
| + const char* source, |
| + int size) { |
| GLuint shader = gles2_if_->CreateShader(context_->pp_resource(), type); |
| gles2_if_->ShaderSource(context_->pp_resource(), shader, 1, &source, &size); |
| gles2_if_->CompileShader(context_->pp_resource(), shader); |