1// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "mojo/services/gles2/command_buffer_type_conversions.h"
6
7#include "mojo/services/gles2/command_buffer.mojom.h"
8
9namespace mojo {
10
11CommandBufferStatePtr
12TypeConverter<CommandBufferStatePtr, gpu::CommandBuffer::State>::Convert(
13    const gpu::CommandBuffer::State& input) {
14  CommandBufferStatePtr result(CommandBufferState::New());
15  result->num_entries = input.num_entries;
16  result->get_offset = input.get_offset;
17  result->put_offset = input.put_offset;
18  result->token = input.token;
19  result->error = input.error;
20  result->context_lost_reason = input.context_lost_reason;
21  result->generation = input.generation;
22  return result.Pass();
23}
24
25gpu::CommandBuffer::State
26TypeConverter<gpu::CommandBuffer::State, CommandBufferStatePtr>::Convert(
27    const CommandBufferStatePtr& input) {
28  gpu::CommandBuffer::State state;
29  state.num_entries = input->num_entries;
30  state.get_offset = input->get_offset;
31  state.put_offset = input->put_offset;
32  state.token = input->token;
33  state.error = static_cast<gpu::error::Error>(input->error);
34  state.context_lost_reason =
35      static_cast<gpu::error::ContextLostReason>(input->context_lost_reason);
36  state.generation = input->generation;
37  return state;
38}
39
40}  // namespace mojo
41