OLD | NEW |
| (Empty) |
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 "components/view_manager/gles2/command_buffer_type_conversions.h" | |
6 | |
7 #include "components/view_manager/public/interfaces/command_buffer.mojom.h" | |
8 | |
9 namespace mojo { | |
10 | |
11 CommandBufferStatePtr | |
12 TypeConverter<CommandBufferStatePtr, gpu::CommandBuffer::State>::Convert( | |
13 const gpu::CommandBuffer::State& input) { | |
14 CommandBufferStatePtr result(CommandBufferState::New()); | |
15 result->get_offset = input.get_offset; | |
16 result->token = input.token; | |
17 result->error = input.error; | |
18 result->context_lost_reason = input.context_lost_reason; | |
19 result->generation = input.generation; | |
20 return result.Pass(); | |
21 } | |
22 | |
23 gpu::CommandBuffer::State | |
24 TypeConverter<gpu::CommandBuffer::State, CommandBufferStatePtr>::Convert( | |
25 const CommandBufferStatePtr& input) { | |
26 gpu::CommandBuffer::State state; | |
27 state.get_offset = input->get_offset; | |
28 state.token = input->token; | |
29 state.error = static_cast<gpu::error::Error>(input->error); | |
30 state.context_lost_reason = | |
31 static_cast<gpu::error::ContextLostReason>(input->context_lost_reason); | |
32 state.generation = input->generation; | |
33 return state; | |
34 } | |
35 | |
36 GpuShaderPrecisionPtr | |
37 TypeConverter<GpuShaderPrecisionPtr, gpu::Capabilities::ShaderPrecision>:: | |
38 Convert(const gpu::Capabilities::ShaderPrecision& input) { | |
39 GpuShaderPrecisionPtr result(GpuShaderPrecision::New()); | |
40 result->min_range = input.min_range; | |
41 result->max_range = input.max_range; | |
42 result->precision = input.precision; | |
43 return result.Pass(); | |
44 } | |
45 | |
46 gpu::Capabilities::ShaderPrecision TypeConverter< | |
47 gpu::Capabilities::ShaderPrecision, | |
48 GpuShaderPrecisionPtr>::Convert(const GpuShaderPrecisionPtr& input) { | |
49 gpu::Capabilities::ShaderPrecision result; | |
50 result.min_range = input->min_range; | |
51 result.max_range = input->max_range; | |
52 result.precision = input->precision; | |
53 return result; | |
54 } | |
55 | |
56 GpuPerStagePrecisionsPtr | |
57 TypeConverter<GpuPerStagePrecisionsPtr, gpu::Capabilities::PerStagePrecisions>:: | |
58 Convert(const gpu::Capabilities::PerStagePrecisions& input) { | |
59 GpuPerStagePrecisionsPtr result(GpuPerStagePrecisions::New()); | |
60 result->low_int = GpuShaderPrecision::From(input.low_int); | |
61 result->medium_int = GpuShaderPrecision::From(input.medium_int); | |
62 result->high_int = GpuShaderPrecision::From(input.high_int); | |
63 result->low_float = GpuShaderPrecision::From(input.low_float); | |
64 result->medium_float = GpuShaderPrecision::From(input.medium_float); | |
65 result->high_float = GpuShaderPrecision::From(input.high_float); | |
66 return result.Pass(); | |
67 } | |
68 | |
69 gpu::Capabilities::PerStagePrecisions TypeConverter< | |
70 gpu::Capabilities::PerStagePrecisions, | |
71 GpuPerStagePrecisionsPtr>::Convert(const GpuPerStagePrecisionsPtr& input) { | |
72 gpu::Capabilities::PerStagePrecisions result; | |
73 result.low_int = input->low_int.To<gpu::Capabilities::ShaderPrecision>(); | |
74 result.medium_int = | |
75 input->medium_int.To<gpu::Capabilities::ShaderPrecision>(); | |
76 result.high_int = input->high_int.To<gpu::Capabilities::ShaderPrecision>(); | |
77 result.low_float = input->low_float.To<gpu::Capabilities::ShaderPrecision>(); | |
78 result.medium_float = | |
79 input->medium_float.To<gpu::Capabilities::ShaderPrecision>(); | |
80 result.high_float = | |
81 input->high_float.To<gpu::Capabilities::ShaderPrecision>(); | |
82 return result; | |
83 } | |
84 | |
85 GpuCapabilitiesPtr | |
86 TypeConverter<GpuCapabilitiesPtr, gpu::Capabilities>::Convert( | |
87 const gpu::Capabilities& input) { | |
88 GpuCapabilitiesPtr result(GpuCapabilities::New()); | |
89 result->vertex_shader_precisions = | |
90 GpuPerStagePrecisions::From(input.vertex_shader_precisions); | |
91 result->fragment_shader_precisions = | |
92 GpuPerStagePrecisions::From(input.fragment_shader_precisions); | |
93 result->max_combined_texture_image_units = | |
94 input.max_combined_texture_image_units; | |
95 result->max_cube_map_texture_size = input.max_cube_map_texture_size; | |
96 result->max_fragment_uniform_vectors = input.max_fragment_uniform_vectors; | |
97 result->max_renderbuffer_size = input.max_renderbuffer_size; | |
98 result->max_texture_image_units = input.max_texture_image_units; | |
99 result->max_texture_size = input.max_texture_size; | |
100 result->max_varying_vectors = input.max_varying_vectors; | |
101 result->max_vertex_attribs = input.max_vertex_attribs; | |
102 result->max_vertex_texture_image_units = input.max_vertex_texture_image_units; | |
103 result->max_vertex_uniform_vectors = input.max_vertex_uniform_vectors; | |
104 result->num_compressed_texture_formats = input.num_compressed_texture_formats; | |
105 result->num_shader_binary_formats = input.num_shader_binary_formats; | |
106 result->bind_generates_resource_chromium = | |
107 input.bind_generates_resource_chromium; | |
108 result->post_sub_buffer = input.post_sub_buffer; | |
109 result->egl_image_external = input.egl_image_external; | |
110 result->texture_format_bgra8888 = input.texture_format_bgra8888; | |
111 result->texture_format_etc1 = input.texture_format_etc1; | |
112 result->texture_format_etc1_npot = input.texture_format_etc1_npot; | |
113 result->texture_rectangle = input.texture_rectangle; | |
114 result->iosurface = input.iosurface; | |
115 result->texture_usage = input.texture_usage; | |
116 result->texture_storage = input.texture_storage; | |
117 result->discard_framebuffer = input.discard_framebuffer; | |
118 result->sync_query = input.sync_query; | |
119 result->image = input.image; | |
120 result->future_sync_points = input.future_sync_points; | |
121 result->blend_equation_advanced = input.blend_equation_advanced; | |
122 result->blend_equation_advanced_coherent = | |
123 input.blend_equation_advanced_coherent; | |
124 return result.Pass(); | |
125 } | |
126 | |
127 gpu::Capabilities TypeConverter<gpu::Capabilities, GpuCapabilitiesPtr>::Convert( | |
128 const GpuCapabilitiesPtr& input) { | |
129 gpu::Capabilities result; | |
130 result.vertex_shader_precisions = | |
131 input->vertex_shader_precisions | |
132 .To<gpu::Capabilities::PerStagePrecisions>(); | |
133 result.fragment_shader_precisions = | |
134 input->fragment_shader_precisions | |
135 .To<gpu::Capabilities::PerStagePrecisions>(); | |
136 result.max_combined_texture_image_units = | |
137 input->max_combined_texture_image_units; | |
138 result.max_cube_map_texture_size = input->max_cube_map_texture_size; | |
139 result.max_fragment_uniform_vectors = input->max_fragment_uniform_vectors; | |
140 result.max_renderbuffer_size = input->max_renderbuffer_size; | |
141 result.max_texture_image_units = input->max_texture_image_units; | |
142 result.max_texture_size = input->max_texture_size; | |
143 result.max_varying_vectors = input->max_varying_vectors; | |
144 result.max_vertex_attribs = input->max_vertex_attribs; | |
145 result.max_vertex_texture_image_units = input->max_vertex_texture_image_units; | |
146 result.max_vertex_uniform_vectors = input->max_vertex_uniform_vectors; | |
147 result.num_compressed_texture_formats = input->num_compressed_texture_formats; | |
148 result.num_shader_binary_formats = input->num_shader_binary_formats; | |
149 result.bind_generates_resource_chromium = | |
150 input->bind_generates_resource_chromium; | |
151 result.post_sub_buffer = input->post_sub_buffer; | |
152 result.egl_image_external = input->egl_image_external; | |
153 result.texture_format_bgra8888 = input->texture_format_bgra8888; | |
154 result.texture_format_etc1 = input->texture_format_etc1; | |
155 result.texture_format_etc1_npot = input->texture_format_etc1_npot; | |
156 result.texture_rectangle = input->texture_rectangle; | |
157 result.iosurface = input->iosurface; | |
158 result.texture_usage = input->texture_usage; | |
159 result.texture_storage = input->texture_storage; | |
160 result.discard_framebuffer = input->discard_framebuffer; | |
161 result.sync_query = input->sync_query; | |
162 result.image = input->image; | |
163 result.future_sync_points = input->future_sync_points; | |
164 result.blend_equation_advanced = input->blend_equation_advanced; | |
165 result.blend_equation_advanced_coherent = | |
166 input->blend_equation_advanced_coherent; | |
167 return result; | |
168 } | |
169 | |
170 } // namespace gles2 | |
OLD | NEW |