Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: command_buffer/client/cross/o3d_cmd_helper.h

Issue 332036: move all O3D specific command buffer stuff to command_buffer::o3d... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « command_buffer/client/cross/fenced_allocator_test.cc ('k') | command_buffer/command_buffer.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2009, Google Inc. 2 * Copyright 2009, Google Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 20 matching lines...) Expand all
31 31
32 32
33 // This file contains the o3d command buffer helper class. 33 // This file contains the o3d command buffer helper class.
34 34
35 #ifndef O3D_COMMAND_BUFFER_CLIENT_CROSS_O3D_CMD_HELPER_H_ 35 #ifndef O3D_COMMAND_BUFFER_CLIENT_CROSS_O3D_CMD_HELPER_H_
36 #define O3D_COMMAND_BUFFER_CLIENT_CROSS_O3D_CMD_HELPER_H_ 36 #define O3D_COMMAND_BUFFER_CLIENT_CROSS_O3D_CMD_HELPER_H_
37 37
38 #include "command_buffer/common/cross/logging.h" 38 #include "command_buffer/common/cross/logging.h"
39 #include "command_buffer/common/cross/constants.h" 39 #include "command_buffer/common/cross/constants.h"
40 #include "command_buffer/client/cross/cmd_buffer_helper.h" 40 #include "command_buffer/client/cross/cmd_buffer_helper.h"
41 #include "command_buffer/common/cross/cmd_buffer_format.h" 41 #include "command_buffer/common/cross/o3d_cmd_format.h"
42 #include "o3d/gpu_plugin/np_utils/np_object_pointer.h" 42 #include "o3d/gpu_plugin/np_utils/np_object_pointer.h"
43 43
44 namespace o3d { 44 namespace o3d {
45 namespace command_buffer { 45 namespace command_buffer {
46 46
47 // A helper for O3D command buffers. 47 // A helper for O3D command buffers.
48 class O3DCmdHelper : public CommandBufferHelper { 48 class O3DCmdHelper : public CommandBufferHelper {
49 public: 49 public:
50 O3DCmdHelper( 50 O3DCmdHelper(
51 NPP npp, 51 NPP npp,
52 const gpu_plugin::NPObjectPointer<NPObject>& command_buffer) 52 const gpu_plugin::NPObjectPointer<NPObject>& command_buffer)
53 : CommandBufferHelper(npp, command_buffer) { 53 : CommandBufferHelper(npp, command_buffer) {
54 } 54 }
55 virtual ~O3DCmdHelper() { 55 virtual ~O3DCmdHelper() {
56 } 56 }
57 57
58 // ------------------ Individual commands ---------------------- 58 // ------------------ Individual commands ----------------------
59 59
60 void Noop(uint32 skip_count) { 60 void Noop(uint32 skip_count) {
61 cmd::Noop& cmd = GetImmediateCmdSpace<cmd::Noop>( 61 o3d::Noop& cmd = GetImmediateCmdSpace<o3d::Noop>(
62 skip_count * sizeof(CommandBufferEntry)); 62 skip_count * sizeof(CommandBufferEntry));
63 cmd.Init(skip_count); 63 cmd.Init(skip_count);
64 } 64 }
65 65
66 void SetToken(uint32 token) { 66 void SetToken(uint32 token) {
67 cmd::SetToken& cmd = GetCmdSpace<cmd::SetToken>(); 67 o3d::SetToken& cmd = GetCmdSpace<o3d::SetToken>();
68 cmd.Init(token); 68 cmd.Init(token);
69 } 69 }
70 70
71 void BeginFrame() { 71 void BeginFrame() {
72 cmd::BeginFrame& cmd = GetCmdSpace<cmd::BeginFrame>(); 72 o3d::BeginFrame& cmd = GetCmdSpace<o3d::BeginFrame>();
73 cmd.Init(); 73 cmd.Init();
74 } 74 }
75 75
76 76
77 void EndFrame() { 77 void EndFrame() {
78 cmd::EndFrame& cmd = GetCmdSpace<cmd::EndFrame>(); 78 o3d::EndFrame& cmd = GetCmdSpace<o3d::EndFrame>();
79 cmd.Init(); 79 cmd.Init();
80 } 80 }
81 81
82 void Clear( 82 void Clear(
83 uint32 buffers, 83 uint32 buffers,
84 float red, float green, float blue, float alpha, 84 float red, float green, float blue, float alpha,
85 float depth, uint32 stencil) { 85 float depth, uint32 stencil) {
86 cmd::Clear& cmd = GetCmdSpace<cmd::Clear>(); 86 o3d::Clear& cmd = GetCmdSpace<o3d::Clear>();
87 cmd.Init(buffers, red, green, blue, alpha, depth, stencil); 87 cmd.Init(buffers, red, green, blue, alpha, depth, stencil);
88 } 88 }
89 89
90 void SetViewport( 90 void SetViewport(
91 uint32 left, 91 uint32 left,
92 uint32 top, 92 uint32 top,
93 uint32 width, 93 uint32 width,
94 uint32 height, 94 uint32 height,
95 float z_min, 95 float z_min,
96 float z_max) { 96 float z_max) {
97 cmd::SetViewport& cmd = GetCmdSpace<cmd::SetViewport>(); 97 o3d::SetViewport& cmd = GetCmdSpace<o3d::SetViewport>();
98 cmd.Init(left, top, width, height, z_min, z_max); 98 cmd.Init(left, top, width, height, z_min, z_max);
99 } 99 }
100 100
101 void CreateVertexBuffer( 101 void CreateVertexBuffer(
102 ResourceId vertex_buffer_id, uint32 size, vertex_buffer::Flags flags) { 102 ResourceId vertex_buffer_id, uint32 size, vertex_buffer::Flags flags) {
103 cmd::CreateVertexBuffer& cmd = GetCmdSpace<cmd::CreateVertexBuffer>(); 103 o3d::CreateVertexBuffer& cmd = GetCmdSpace<o3d::CreateVertexBuffer>();
104 cmd.Init(vertex_buffer_id, size, flags); 104 cmd.Init(vertex_buffer_id, size, flags);
105 } 105 }
106 106
107 void DestroyVertexBuffer(ResourceId vertex_buffer_id) { 107 void DestroyVertexBuffer(ResourceId vertex_buffer_id) {
108 cmd::DestroyVertexBuffer& cmd = GetCmdSpace<cmd::DestroyVertexBuffer>(); 108 o3d::DestroyVertexBuffer& cmd = GetCmdSpace<o3d::DestroyVertexBuffer>();
109 cmd.Init(vertex_buffer_id); 109 cmd.Init(vertex_buffer_id);
110 } 110 }
111 111
112 void SetVertexBufferDataImmediate( 112 void SetVertexBufferDataImmediate(
113 ResourceId vertex_buffer_id, uint32 offset, 113 ResourceId vertex_buffer_id, uint32 offset,
114 const void* data, uint32 size) { 114 const void* data, uint32 size) {
115 cmd::SetVertexBufferDataImmediate& cmd = 115 o3d::SetVertexBufferDataImmediate& cmd =
116 GetImmediateCmdSpace<cmd::SetVertexBufferDataImmediate>(size); 116 GetImmediateCmdSpace<o3d::SetVertexBufferDataImmediate>(size);
117 cmd.Init(vertex_buffer_id, offset, data, size); 117 cmd.Init(vertex_buffer_id, offset, data, size);
118 } 118 }
119 119
120 void SetVertexBufferData( 120 void SetVertexBufferData(
121 ResourceId vertex_buffer_id, uint32 offset, uint32 size, 121 ResourceId vertex_buffer_id, uint32 offset, uint32 size,
122 uint32 shared_memory_id, uint32 shared_memory_offset) { 122 uint32 shared_memory_id, uint32 shared_memory_offset) {
123 cmd::SetVertexBufferData& cmd = 123 o3d::SetVertexBufferData& cmd =
124 GetCmdSpace<cmd::SetVertexBufferData>(); 124 GetCmdSpace<o3d::SetVertexBufferData>();
125 cmd.Init(vertex_buffer_id, offset, size, 125 cmd.Init(vertex_buffer_id, offset, size,
126 shared_memory_id, shared_memory_offset); 126 shared_memory_id, shared_memory_offset);
127 } 127 }
128 128
129 void GetVertexBufferData( 129 void GetVertexBufferData(
130 ResourceId vertex_buffer_id, uint32 offset, uint32 size, 130 ResourceId vertex_buffer_id, uint32 offset, uint32 size,
131 uint32 shared_memory_id, uint32 shared_memory_offset) { 131 uint32 shared_memory_id, uint32 shared_memory_offset) {
132 cmd::GetVertexBufferData& cmd = 132 o3d::GetVertexBufferData& cmd =
133 GetCmdSpace<cmd::GetVertexBufferData>(); 133 GetCmdSpace<o3d::GetVertexBufferData>();
134 cmd.Init(vertex_buffer_id, offset, size, 134 cmd.Init(vertex_buffer_id, offset, size,
135 shared_memory_id, shared_memory_offset); 135 shared_memory_id, shared_memory_offset);
136 } 136 }
137 137
138 void CreateIndexBuffer( 138 void CreateIndexBuffer(
139 ResourceId index_buffer_id, uint32 size, index_buffer::Flags flags) { 139 ResourceId index_buffer_id, uint32 size, index_buffer::Flags flags) {
140 cmd::CreateIndexBuffer& cmd = 140 o3d::CreateIndexBuffer& cmd =
141 GetCmdSpace<cmd::CreateIndexBuffer>(); 141 GetCmdSpace<o3d::CreateIndexBuffer>();
142 cmd.Init(index_buffer_id, size, flags); 142 cmd.Init(index_buffer_id, size, flags);
143 } 143 }
144 144
145 void DestroyIndexBuffer(ResourceId index_buffer_id) { 145 void DestroyIndexBuffer(ResourceId index_buffer_id) {
146 cmd::DestroyIndexBuffer& cmd = GetCmdSpace<cmd::DestroyIndexBuffer>(); 146 o3d::DestroyIndexBuffer& cmd = GetCmdSpace<o3d::DestroyIndexBuffer>();
147 cmd.Init(index_buffer_id); 147 cmd.Init(index_buffer_id);
148 } 148 }
149 149
150 void SetIndexBufferDataImmediate( 150 void SetIndexBufferDataImmediate(
151 ResourceId index_buffer_id, uint32 offset, 151 ResourceId index_buffer_id, uint32 offset,
152 const void* data, uint32 size) { 152 const void* data, uint32 size) {
153 cmd::SetIndexBufferDataImmediate& cmd = 153 o3d::SetIndexBufferDataImmediate& cmd =
154 GetImmediateCmdSpace<cmd::SetIndexBufferDataImmediate>(size); 154 GetImmediateCmdSpace<o3d::SetIndexBufferDataImmediate>(size);
155 cmd.Init(index_buffer_id, offset, data, size); 155 cmd.Init(index_buffer_id, offset, data, size);
156 } 156 }
157 157
158 void SetIndexBufferData( 158 void SetIndexBufferData(
159 ResourceId index_buffer_id, uint32 offset, uint32 size, 159 ResourceId index_buffer_id, uint32 offset, uint32 size,
160 uint32 shared_memory_id, uint32 shared_memory_offset) { 160 uint32 shared_memory_id, uint32 shared_memory_offset) {
161 cmd::SetIndexBufferData& cmd = GetCmdSpace<cmd::SetIndexBufferData>(); 161 o3d::SetIndexBufferData& cmd = GetCmdSpace<o3d::SetIndexBufferData>();
162 cmd.Init(index_buffer_id, offset, size, 162 cmd.Init(index_buffer_id, offset, size,
163 shared_memory_id, shared_memory_offset); 163 shared_memory_id, shared_memory_offset);
164 } 164 }
165 165
166 void GetIndexBufferData( 166 void GetIndexBufferData(
167 ResourceId index_buffer_id, uint32 offset, uint32 size, 167 ResourceId index_buffer_id, uint32 offset, uint32 size,
168 uint32 shared_memory_id, uint32 shared_memory_offset) { 168 uint32 shared_memory_id, uint32 shared_memory_offset) {
169 cmd::GetIndexBufferData& cmd = GetCmdSpace<cmd::GetIndexBufferData>(); 169 o3d::GetIndexBufferData& cmd = GetCmdSpace<o3d::GetIndexBufferData>();
170 cmd.Init(index_buffer_id, offset, size, 170 cmd.Init(index_buffer_id, offset, size,
171 shared_memory_id, shared_memory_offset); 171 shared_memory_id, shared_memory_offset);
172 } 172 }
173 173
174 void CreateVertexStruct(ResourceId vertex_struct_id, uint32 input_count) { 174 void CreateVertexStruct(ResourceId vertex_struct_id, uint32 input_count) {
175 cmd::CreateVertexStruct& cmd = GetCmdSpace<cmd::CreateVertexStruct>(); 175 o3d::CreateVertexStruct& cmd = GetCmdSpace<o3d::CreateVertexStruct>();
176 cmd.Init(vertex_struct_id, input_count); 176 cmd.Init(vertex_struct_id, input_count);
177 } 177 }
178 178
179 void DestroyVertexStruct(ResourceId vertex_struct_id) { 179 void DestroyVertexStruct(ResourceId vertex_struct_id) {
180 cmd::DestroyVertexStruct& cmd = GetCmdSpace<cmd::DestroyVertexStruct>(); 180 o3d::DestroyVertexStruct& cmd = GetCmdSpace<o3d::DestroyVertexStruct>();
181 cmd.Init(vertex_struct_id); 181 cmd.Init(vertex_struct_id);
182 } 182 }
183 183
184 void SetVertexInput( 184 void SetVertexInput(
185 ResourceId vertex_struct_id, 185 ResourceId vertex_struct_id,
186 uint32 input_index, 186 uint32 input_index,
187 ResourceId vertex_buffer_id, 187 ResourceId vertex_buffer_id,
188 uint32 offset, 188 uint32 offset,
189 vertex_struct::Semantic semantic, 189 vertex_struct::Semantic semantic,
190 uint32 semantic_index, 190 uint32 semantic_index,
191 vertex_struct::Type type, 191 vertex_struct::Type type,
192 uint32 stride) { 192 uint32 stride) {
193 cmd::SetVertexInput& cmd = GetCmdSpace<cmd::SetVertexInput>(); 193 o3d::SetVertexInput& cmd = GetCmdSpace<o3d::SetVertexInput>();
194 cmd.Init( 194 cmd.Init(
195 vertex_struct_id, 195 vertex_struct_id,
196 input_index, 196 input_index,
197 vertex_buffer_id, 197 vertex_buffer_id,
198 offset, 198 offset,
199 semantic, 199 semantic,
200 semantic_index, 200 semantic_index,
201 type, 201 type,
202 stride); 202 stride);
203 } 203 }
204 204
205 void SetVertexStruct(ResourceId vertex_struct_id) { 205 void SetVertexStruct(ResourceId vertex_struct_id) {
206 cmd::SetVertexStruct& cmd = GetCmdSpace<cmd::SetVertexStruct>(); 206 o3d::SetVertexStruct& cmd = GetCmdSpace<o3d::SetVertexStruct>();
207 cmd.Init(vertex_struct_id); 207 cmd.Init(vertex_struct_id);
208 } 208 }
209 209
210 void Draw(PrimitiveType primitive_type, uint32 first, uint32 count) { 210 void Draw(o3d::PrimitiveType primitive_type, uint32 first, uint32 count) {
211 cmd::Draw& cmd = GetCmdSpace<cmd::Draw>(); 211 o3d::Draw& cmd = GetCmdSpace<o3d::Draw>();
212 cmd.Init(primitive_type, first, count); 212 cmd.Init(primitive_type, first, count);
213 } 213 }
214 214
215 void DrawIndexed( 215 void DrawIndexed(
216 PrimitiveType primitive_type, 216 o3d::PrimitiveType primitive_type,
217 ResourceId index_buffer_id, 217 ResourceId index_buffer_id,
218 uint32 first, 218 uint32 first,
219 uint32 count, 219 uint32 count,
220 uint32 min_index, 220 uint32 min_index,
221 uint32 max_index) { 221 uint32 max_index) {
222 cmd::DrawIndexed& cmd = GetCmdSpace<cmd::DrawIndexed>(); 222 o3d::DrawIndexed& cmd = GetCmdSpace<o3d::DrawIndexed>();
223 cmd.Init( 223 cmd.Init(
224 primitive_type, 224 primitive_type,
225 index_buffer_id, 225 index_buffer_id,
226 first, 226 first,
227 count, 227 count,
228 min_index, 228 min_index,
229 max_index); 229 max_index);
230 } 230 }
231 231
232 void CreateEffect( 232 void CreateEffect(
233 ResourceId effect_id, uint32 size, 233 ResourceId effect_id, uint32 size,
234 uint32 shared_memory_id, uint32 shared_memory_offset) { 234 uint32 shared_memory_id, uint32 shared_memory_offset) {
235 cmd::CreateEffect& cmd = GetCmdSpace<cmd::CreateEffect>(); 235 o3d::CreateEffect& cmd = GetCmdSpace<o3d::CreateEffect>();
236 cmd.Init(effect_id, size, shared_memory_id, shared_memory_offset); 236 cmd.Init(effect_id, size, shared_memory_id, shared_memory_offset);
237 } 237 }
238 238
239 void CreateEffectImmediate( 239 void CreateEffectImmediate(
240 ResourceId effect_id, uint32 size, const void* data) { 240 ResourceId effect_id, uint32 size, const void* data) {
241 cmd::CreateEffectImmediate& cmd = 241 o3d::CreateEffectImmediate& cmd =
242 GetImmediateCmdSpace<cmd::CreateEffectImmediate>(size); 242 GetImmediateCmdSpace<o3d::CreateEffectImmediate>(size);
243 cmd.Init(effect_id, size, data); 243 cmd.Init(effect_id, size, data);
244 } 244 }
245 245
246 void DestroyEffect(ResourceId effect_id) { 246 void DestroyEffect(ResourceId effect_id) {
247 cmd::DestroyEffect& cmd = GetCmdSpace<cmd::DestroyEffect>(); 247 o3d::DestroyEffect& cmd = GetCmdSpace<o3d::DestroyEffect>();
248 cmd.Init(effect_id); 248 cmd.Init(effect_id);
249 } 249 }
250 250
251 void SetEffect(ResourceId effect_id) { 251 void SetEffect(ResourceId effect_id) {
252 cmd::SetEffect& cmd = GetCmdSpace<cmd::SetEffect>(); 252 o3d::SetEffect& cmd = GetCmdSpace<o3d::SetEffect>();
253 cmd.Init(effect_id); 253 cmd.Init(effect_id);
254 } 254 }
255 255
256 void GetParamCount( 256 void GetParamCount(
257 ResourceId effect_id, uint32 size, 257 ResourceId effect_id, uint32 size,
258 uint32 shared_memory_id, uint32 shared_memory_offset) { 258 uint32 shared_memory_id, uint32 shared_memory_offset) {
259 cmd::GetParamCount& cmd = GetCmdSpace<cmd::GetParamCount>(); 259 o3d::GetParamCount& cmd = GetCmdSpace<o3d::GetParamCount>();
260 cmd.Init(effect_id, size, shared_memory_id, shared_memory_offset); 260 cmd.Init(effect_id, size, shared_memory_id, shared_memory_offset);
261 } 261 }
262 262
263 void CreateParam(ResourceId param_id, ResourceId effect_id, uint32 index) { 263 void CreateParam(ResourceId param_id, ResourceId effect_id, uint32 index) {
264 cmd::CreateParam& cmd = GetCmdSpace<cmd::CreateParam>(); 264 o3d::CreateParam& cmd = GetCmdSpace<o3d::CreateParam>();
265 cmd.Init(param_id, effect_id, index); 265 cmd.Init(param_id, effect_id, index);
266 } 266 }
267 267
268 void CreateParamByName( 268 void CreateParamByName(
269 ResourceId param_id, ResourceId effect_id, uint32 size, 269 ResourceId param_id, ResourceId effect_id, uint32 size,
270 uint32 shared_memory_id, uint32 shared_memory_offset) { 270 uint32 shared_memory_id, uint32 shared_memory_offset) {
271 cmd::CreateParamByName& cmd = GetCmdSpace<cmd::CreateParamByName>(); 271 o3d::CreateParamByName& cmd = GetCmdSpace<o3d::CreateParamByName>();
272 cmd.Init(param_id, effect_id, size, shared_memory_id, shared_memory_offset); 272 cmd.Init(param_id, effect_id, size, shared_memory_id, shared_memory_offset);
273 } 273 }
274 274
275 void CreateParamByNameImmediate( 275 void CreateParamByNameImmediate(
276 ResourceId param_id, ResourceId effect_id, 276 ResourceId param_id, ResourceId effect_id,
277 uint32 size, const void* data) { 277 uint32 size, const void* data) {
278 cmd::CreateParamByNameImmediate& cmd = 278 o3d::CreateParamByNameImmediate& cmd =
279 GetImmediateCmdSpace<cmd::CreateParamByNameImmediate>(size); 279 GetImmediateCmdSpace<o3d::CreateParamByNameImmediate>(size);
280 cmd.Init(param_id, effect_id, size, data); 280 cmd.Init(param_id, effect_id, size, data);
281 } 281 }
282 282
283 void DestroyParam(ResourceId param_id) { 283 void DestroyParam(ResourceId param_id) {
284 cmd::DestroyParam& cmd = GetCmdSpace<cmd::DestroyParam>(); 284 o3d::DestroyParam& cmd = GetCmdSpace<o3d::DestroyParam>();
285 cmd.Init(param_id); 285 cmd.Init(param_id);
286 } 286 }
287 287
288 void SetParamData( 288 void SetParamData(
289 ResourceId param_id, uint32 size, 289 ResourceId param_id, uint32 size,
290 uint32 shared_memory_id, uint32 shared_memory_offset) { 290 uint32 shared_memory_id, uint32 shared_memory_offset) {
291 cmd::SetParamData& cmd = GetCmdSpace<cmd::SetParamData>(); 291 o3d::SetParamData& cmd = GetCmdSpace<o3d::SetParamData>();
292 cmd.Init(param_id, size, shared_memory_id, shared_memory_offset); 292 cmd.Init(param_id, size, shared_memory_id, shared_memory_offset);
293 } 293 }
294 294
295 void SetParamDataImmediate( 295 void SetParamDataImmediate(
296 ResourceId param_id, uint32 size, const void* data) { 296 ResourceId param_id, uint32 size, const void* data) {
297 cmd::SetParamDataImmediate& cmd = 297 o3d::SetParamDataImmediate& cmd =
298 GetImmediateCmdSpace<cmd::SetParamDataImmediate>(size); 298 GetImmediateCmdSpace<o3d::SetParamDataImmediate>(size);
299 cmd.Init(param_id, size, data); 299 cmd.Init(param_id, size, data);
300 } 300 }
301 301
302 void GetParamDesc( 302 void GetParamDesc(
303 ResourceId param_id, uint32 size, 303 ResourceId param_id, uint32 size,
304 uint32 shared_memory_id, uint32 shared_memory_offset) { 304 uint32 shared_memory_id, uint32 shared_memory_offset) {
305 cmd::GetParamDesc& cmd = GetCmdSpace<cmd::GetParamDesc>(); 305 o3d::GetParamDesc& cmd = GetCmdSpace<o3d::GetParamDesc>();
306 cmd.Init(param_id, size, shared_memory_id, shared_memory_offset); 306 cmd.Init(param_id, size, shared_memory_id, shared_memory_offset);
307 } 307 }
308 308
309 void GetStreamCount( 309 void GetStreamCount(
310 ResourceId effect_id, uint32 size, 310 ResourceId effect_id, uint32 size,
311 uint32 shared_memory_id, uint32 shared_memory_offset) { 311 uint32 shared_memory_id, uint32 shared_memory_offset) {
312 cmd::GetStreamCount& cmd = GetCmdSpace<cmd::GetStreamCount>(); 312 o3d::GetStreamCount& cmd = GetCmdSpace<o3d::GetStreamCount>();
313 cmd.Init(effect_id, size, shared_memory_id, shared_memory_offset); 313 cmd.Init(effect_id, size, shared_memory_id, shared_memory_offset);
314 } 314 }
315 315
316 void GetStreamDesc( 316 void GetStreamDesc(
317 ResourceId effect_id, uint32 index, uint32 size, 317 ResourceId effect_id, uint32 index, uint32 size,
318 uint32 shared_memory_id, uint32 shared_memory_offset) { 318 uint32 shared_memory_id, uint32 shared_memory_offset) {
319 cmd::GetStreamDesc& cmd = GetCmdSpace<cmd::GetStreamDesc>(); 319 o3d::GetStreamDesc& cmd = GetCmdSpace<o3d::GetStreamDesc>();
320 cmd.Init(effect_id, index, size, shared_memory_id, shared_memory_offset); 320 cmd.Init(effect_id, index, size, shared_memory_id, shared_memory_offset);
321 } 321 }
322 322
323 void DestroyTexture(ResourceId texture_id) { 323 void DestroyTexture(ResourceId texture_id) {
324 cmd::DestroyTexture& cmd = GetCmdSpace<cmd::DestroyTexture>(); 324 o3d::DestroyTexture& cmd = GetCmdSpace<o3d::DestroyTexture>();
325 cmd.Init(texture_id); 325 cmd.Init(texture_id);
326 } 326 }
327 327
328 void CreateTexture2d( 328 void CreateTexture2d(
329 ResourceId texture_id, 329 ResourceId texture_id,
330 uint32 width, uint32 height, 330 uint32 width, uint32 height,
331 uint32 levels, texture::Format format, 331 uint32 levels, texture::Format format,
332 bool enable_render_surfaces) { 332 bool enable_render_surfaces) {
333 cmd::CreateTexture2d& cmd = GetCmdSpace<cmd::CreateTexture2d>(); 333 o3d::CreateTexture2d& cmd = GetCmdSpace<o3d::CreateTexture2d>();
334 cmd.Init(texture_id, 334 cmd.Init(texture_id,
335 width, height, levels, format, 335 width, height, levels, format,
336 enable_render_surfaces); 336 enable_render_surfaces);
337 } 337 }
338 338
339 void CreateTexture3d( 339 void CreateTexture3d(
340 ResourceId texture_id, 340 ResourceId texture_id,
341 uint32 width, uint32 height, uint32 depth, 341 uint32 width, uint32 height, uint32 depth,
342 uint32 levels, texture::Format format, 342 uint32 levels, texture::Format format,
343 bool enable_render_surfaces) { 343 bool enable_render_surfaces) {
344 cmd::CreateTexture3d& cmd = GetCmdSpace<cmd::CreateTexture3d>(); 344 o3d::CreateTexture3d& cmd = GetCmdSpace<o3d::CreateTexture3d>();
345 cmd.Init(texture_id, 345 cmd.Init(texture_id,
346 width, height, depth, 346 width, height, depth,
347 levels, format, 347 levels, format,
348 enable_render_surfaces); 348 enable_render_surfaces);
349 } 349 }
350 350
351 void CreateTextureCube( 351 void CreateTextureCube(
352 ResourceId texture_id, 352 ResourceId texture_id,
353 uint32 edge_length, uint32 levels, texture::Format format, 353 uint32 edge_length, uint32 levels, texture::Format format,
354 bool enable_render_surfaces) { 354 bool enable_render_surfaces) {
355 cmd::CreateTextureCube& cmd = GetCmdSpace<cmd::CreateTextureCube>(); 355 o3d::CreateTextureCube& cmd = GetCmdSpace<o3d::CreateTextureCube>();
356 cmd.Init(texture_id, 356 cmd.Init(texture_id,
357 edge_length, levels, format, 357 edge_length, levels, format,
358 enable_render_surfaces); 358 enable_render_surfaces);
359 } 359 }
360 360
361 void SetTextureData( 361 void SetTextureData(
362 ResourceId texture_id, 362 ResourceId texture_id,
363 uint32 x, 363 uint32 x,
364 uint32 y, 364 uint32 y,
365 uint32 z, 365 uint32 z,
366 uint32 width, 366 uint32 width,
367 uint32 height, 367 uint32 height,
368 uint32 depth, 368 uint32 depth,
369 uint32 level, 369 uint32 level,
370 texture::Face face, 370 texture::Face face,
371 uint32 row_pitch, 371 uint32 row_pitch,
372 uint32 slice_pitch, 372 uint32 slice_pitch,
373 uint32 size, 373 uint32 size,
374 uint32 shared_memory_id, 374 uint32 shared_memory_id,
375 uint32 shared_memory_offset) { 375 uint32 shared_memory_offset) {
376 cmd::SetTextureData& cmd = GetCmdSpace<cmd::SetTextureData>(); 376 o3d::SetTextureData& cmd = GetCmdSpace<o3d::SetTextureData>();
377 cmd.Init( 377 cmd.Init(
378 texture_id, 378 texture_id,
379 x, 379 x,
380 y, 380 y,
381 z, 381 z,
382 width, 382 width,
383 height, 383 height,
384 depth, 384 depth,
385 level, 385 level,
386 face, 386 face,
(...skipping 11 matching lines...) Expand all
398 uint32 z, 398 uint32 z,
399 uint32 width, 399 uint32 width,
400 uint32 height, 400 uint32 height,
401 uint32 depth, 401 uint32 depth,
402 uint32 level, 402 uint32 level,
403 texture::Face face, 403 texture::Face face,
404 uint32 row_pitch, 404 uint32 row_pitch,
405 uint32 slice_pitch, 405 uint32 slice_pitch,
406 uint32 size, 406 uint32 size,
407 const void* data) { 407 const void* data) {
408 cmd::SetTextureDataImmediate& cmd = 408 o3d::SetTextureDataImmediate& cmd =
409 GetImmediateCmdSpace<cmd::SetTextureDataImmediate>(size); 409 GetImmediateCmdSpace<o3d::SetTextureDataImmediate>(size);
410 cmd.Init( 410 cmd.Init(
411 texture_id, 411 texture_id,
412 x, 412 x,
413 y, 413 y,
414 z, 414 z,
415 width, 415 width,
416 height, 416 height,
417 depth, 417 depth,
418 level, 418 level,
419 face, 419 face,
(...skipping 11 matching lines...) Expand all
431 uint32 width, 431 uint32 width,
432 uint32 height, 432 uint32 height,
433 uint32 depth, 433 uint32 depth,
434 uint32 level, 434 uint32 level,
435 texture::Face face, 435 texture::Face face,
436 uint32 row_pitch, 436 uint32 row_pitch,
437 uint32 slice_pitch, 437 uint32 slice_pitch,
438 uint32 size, 438 uint32 size,
439 uint32 shared_memory_id, 439 uint32 shared_memory_id,
440 uint32 shared_memory_offset) { 440 uint32 shared_memory_offset) {
441 cmd::GetTextureData& cmd = GetCmdSpace<cmd::GetTextureData>(); 441 o3d::GetTextureData& cmd = GetCmdSpace<o3d::GetTextureData>();
442 cmd.Init( 442 cmd.Init(
443 texture_id, 443 texture_id,
444 x, 444 x,
445 y, 445 y,
446 z, 446 z,
447 width, 447 width,
448 height, 448 height,
449 depth, 449 depth,
450 level, 450 level,
451 face, 451 face,
452 row_pitch, 452 row_pitch,
453 slice_pitch, 453 slice_pitch,
454 size, 454 size,
455 shared_memory_id, 455 shared_memory_id,
456 shared_memory_offset); 456 shared_memory_offset);
457 } 457 }
458 458
459 void CreateSampler(ResourceId sampler_id) { 459 void CreateSampler(ResourceId sampler_id) {
460 cmd::CreateSampler& cmd = GetCmdSpace<cmd::CreateSampler>(); 460 o3d::CreateSampler& cmd = GetCmdSpace<o3d::CreateSampler>();
461 cmd.Init(sampler_id); 461 cmd.Init(sampler_id);
462 } 462 }
463 463
464 void DestroySampler(ResourceId sampler_id) { 464 void DestroySampler(ResourceId sampler_id) {
465 cmd::DestroySampler& cmd = GetCmdSpace<cmd::DestroySampler>(); 465 o3d::DestroySampler& cmd = GetCmdSpace<o3d::DestroySampler>();
466 cmd.Init(sampler_id); 466 cmd.Init(sampler_id);
467 } 467 }
468 468
469 void SetSamplerStates( 469 void SetSamplerStates(
470 ResourceId sampler_id, 470 ResourceId sampler_id,
471 sampler::AddressingMode address_u_value, 471 sampler::AddressingMode address_u_value,
472 sampler::AddressingMode address_v_value, 472 sampler::AddressingMode address_v_value,
473 sampler::AddressingMode address_w_value, 473 sampler::AddressingMode address_w_value,
474 sampler::FilteringMode mag_filter_value, 474 sampler::FilteringMode mag_filter_value,
475 sampler::FilteringMode min_filter_value, 475 sampler::FilteringMode min_filter_value,
476 sampler::FilteringMode mip_filter_value, 476 sampler::FilteringMode mip_filter_value,
477 uint8 max_anisotropy) { 477 uint8 max_anisotropy) {
478 cmd::SetSamplerStates& cmd = GetCmdSpace<cmd::SetSamplerStates>(); 478 o3d::SetSamplerStates& cmd = GetCmdSpace<o3d::SetSamplerStates>();
479 cmd.Init( 479 cmd.Init(
480 sampler_id, 480 sampler_id,
481 address_u_value, 481 address_u_value,
482 address_v_value, 482 address_v_value,
483 address_w_value, 483 address_w_value,
484 mag_filter_value, 484 mag_filter_value,
485 min_filter_value, 485 min_filter_value,
486 mip_filter_value, 486 mip_filter_value,
487 max_anisotropy); 487 max_anisotropy);
488 } 488 }
489 489
490 void SetSamplerBorderColor( 490 void SetSamplerBorderColor(
491 ResourceId sampler_id, 491 ResourceId sampler_id,
492 float red, float green, float blue, float alpha) { 492 float red, float green, float blue, float alpha) {
493 cmd::SetSamplerBorderColor& cmd = 493 o3d::SetSamplerBorderColor& cmd =
494 GetCmdSpace<cmd::SetSamplerBorderColor>(); 494 GetCmdSpace<o3d::SetSamplerBorderColor>();
495 cmd.Init(sampler_id, red, green, blue, alpha); 495 cmd.Init(sampler_id, red, green, blue, alpha);
496 } 496 }
497 497
498 void SetSamplerTexture(ResourceId sampler_id, ResourceId texture_id) { 498 void SetSamplerTexture(ResourceId sampler_id, ResourceId texture_id) {
499 cmd::SetSamplerTexture& cmd = GetCmdSpace<cmd::SetSamplerTexture>(); 499 o3d::SetSamplerTexture& cmd = GetCmdSpace<o3d::SetSamplerTexture>();
500 cmd.Init(sampler_id, texture_id); 500 cmd.Init(sampler_id, texture_id);
501 } 501 }
502 502
503 void SetScissor( 503 void SetScissor(
504 uint32 x, 504 uint32 x,
505 uint32 y, 505 uint32 y,
506 uint32 width, 506 uint32 width,
507 uint32 height, 507 uint32 height,
508 bool enable) { 508 bool enable) {
509 cmd::SetScissor& cmd = GetCmdSpace<cmd::SetScissor>(); 509 o3d::SetScissor& cmd = GetCmdSpace<o3d::SetScissor>();
510 cmd.Init( 510 cmd.Init(
511 x, 511 x,
512 y, 512 y,
513 width, 513 width,
514 height, 514 height,
515 enable); 515 enable);
516 } 516 }
517 517
518 void SetPolygonOffset(float slope_factor, float units) { 518 void SetPolygonOffset(float slope_factor, float units) {
519 cmd::SetPolygonOffset& cmd = GetCmdSpace<cmd::SetPolygonOffset>(); 519 o3d::SetPolygonOffset& cmd = GetCmdSpace<o3d::SetPolygonOffset>();
520 cmd.Init(slope_factor, units); 520 cmd.Init(slope_factor, units);
521 } 521 }
522 522
523 void SetPointLineRaster( 523 void SetPointLineRaster(
524 bool line_smooth_enable, bool point_sprite_enable, float point_size) { 524 bool line_smooth_enable, bool point_sprite_enable, float point_size) {
525 cmd::SetPointLineRaster& cmd = GetCmdSpace<cmd::SetPointLineRaster>(); 525 o3d::SetPointLineRaster& cmd = GetCmdSpace<o3d::SetPointLineRaster>();
526 cmd.Init(line_smooth_enable, point_sprite_enable, point_size); 526 cmd.Init(line_smooth_enable, point_sprite_enable, point_size);
527 } 527 }
528 528
529 void SetPolygonRaster(PolygonMode fill_mode, FaceCullMode cull_mode) { 529 void SetPolygonRaster(o3d::PolygonMode fill_mode,
530 cmd::SetPolygonRaster& cmd = GetCmdSpace<cmd::SetPolygonRaster>(); 530 o3d::FaceCullMode cull_mode) {
531 o3d::SetPolygonRaster& cmd = GetCmdSpace<o3d::SetPolygonRaster>();
531 cmd.Init(fill_mode, cull_mode); 532 cmd.Init(fill_mode, cull_mode);
532 } 533 }
533 534
534 void SetAlphaTest(Comparison func, bool enable, float value) { 535 void SetAlphaTest(o3d::Comparison func, bool enable, float value) {
535 cmd::SetAlphaTest& cmd = GetCmdSpace<cmd::SetAlphaTest>(); 536 o3d::SetAlphaTest& cmd = GetCmdSpace<o3d::SetAlphaTest>();
536 cmd.Init(func, enable, value); 537 cmd.Init(func, enable, value);
537 } 538 }
538 539
539 void SetDepthTest(Comparison func, bool write_enable, bool enable) { 540 void SetDepthTest(o3d::Comparison func, bool write_enable, bool enable) {
540 cmd::SetDepthTest& cmd = GetCmdSpace<cmd::SetDepthTest>(); 541 o3d::SetDepthTest& cmd = GetCmdSpace<o3d::SetDepthTest>();
541 cmd.Init(func, write_enable, enable); 542 cmd.Init(func, write_enable, enable);
542 } 543 }
543 544
544 void SetStencilTest( 545 void SetStencilTest(
545 uint8 write_mask, 546 uint8 write_mask,
546 uint8 compare_mask, 547 uint8 compare_mask,
547 uint8 reference_value, 548 uint8 reference_value,
548 bool separate_ccw, 549 bool separate_ccw,
549 bool enable, 550 bool enable,
550 Comparison cw_func, 551 o3d::Comparison cw_func,
551 StencilOp cw_pass_op, 552 o3d::StencilOp cw_pass_op,
552 StencilOp cw_fail_op, 553 o3d::StencilOp cw_fail_op,
553 StencilOp cw_z_fail_op, 554 o3d::StencilOp cw_z_fail_op,
554 Comparison ccw_func, 555 o3d::Comparison ccw_func,
555 StencilOp ccw_pass_op, 556 o3d::StencilOp ccw_pass_op,
556 StencilOp ccw_fail_op, 557 o3d::StencilOp ccw_fail_op,
557 StencilOp ccw_z_fail_op) { 558 o3d::StencilOp ccw_z_fail_op) {
558 cmd::SetStencilTest& cmd = GetCmdSpace<cmd::SetStencilTest>(); 559 o3d::SetStencilTest& cmd = GetCmdSpace<o3d::SetStencilTest>();
559 cmd.Init( 560 cmd.Init(
560 write_mask, 561 write_mask,
561 compare_mask, 562 compare_mask,
562 reference_value, 563 reference_value,
563 separate_ccw, 564 separate_ccw,
564 enable, 565 enable,
565 cw_func, 566 cw_func,
566 cw_pass_op, 567 cw_pass_op,
567 cw_fail_op, 568 cw_fail_op,
568 cw_z_fail_op, 569 cw_z_fail_op,
569 ccw_func, 570 ccw_func,
570 ccw_pass_op, 571 ccw_pass_op,
571 ccw_fail_op, 572 ccw_fail_op,
572 ccw_z_fail_op); 573 ccw_z_fail_op);
573 } 574 }
574 575
575 void SetColorWrite(uint8 mask, bool dither_enable) { 576 void SetColorWrite(uint8 mask, bool dither_enable) {
576 cmd::SetColorWrite& cmd = GetCmdSpace<cmd::SetColorWrite>(); 577 o3d::SetColorWrite& cmd = GetCmdSpace<o3d::SetColorWrite>();
577 cmd.Init(mask, dither_enable); 578 cmd.Init(mask, dither_enable);
578 } 579 }
579 580
580 void SetBlending( 581 void SetBlending(
581 BlendFunc color_src_func, 582 o3d::BlendFunc color_src_func,
582 BlendFunc color_dst_func, 583 o3d::BlendFunc color_dst_func,
583 BlendEq color_eq, 584 o3d::BlendEq color_eq,
584 BlendFunc alpha_src_func, 585 o3d::BlendFunc alpha_src_func,
585 BlendFunc alpha_dst_func, 586 o3d::BlendFunc alpha_dst_func,
586 BlendEq alpha_eq, 587 o3d::BlendEq alpha_eq,
587 bool separate_alpha, 588 bool separate_alpha,
588 bool enable) { 589 bool enable) {
589 cmd::SetBlending& cmd = GetCmdSpace<cmd::SetBlending>(); 590 o3d::SetBlending& cmd = GetCmdSpace<o3d::SetBlending>();
590 cmd.Init( 591 cmd.Init(
591 color_src_func, 592 color_src_func,
592 color_dst_func, 593 color_dst_func,
593 color_eq, 594 color_eq,
594 alpha_src_func, 595 alpha_src_func,
595 alpha_dst_func, 596 alpha_dst_func,
596 alpha_eq, 597 alpha_eq,
597 separate_alpha, 598 separate_alpha,
598 enable); 599 enable);
599 } 600 }
600 601
601 void SetBlendingColor(float red, float green, float blue, float alpha) { 602 void SetBlendingColor(float red, float green, float blue, float alpha) {
602 cmd::SetBlendingColor& cmd = GetCmdSpace<cmd::SetBlendingColor>(); 603 o3d::SetBlendingColor& cmd = GetCmdSpace<o3d::SetBlendingColor>();
603 cmd.Init(red, green, blue, alpha); 604 cmd.Init(red, green, blue, alpha);
604 } 605 }
605 606
606 void CreateRenderSurface( 607 void CreateRenderSurface(
607 ResourceId render_surface_id, ResourceId texture_id, 608 ResourceId render_surface_id, ResourceId texture_id,
608 uint32 width, uint32 height, 609 uint32 width, uint32 height,
609 uint32 level, uint32 side) { 610 uint32 level, uint32 side) {
610 cmd::CreateRenderSurface& cmd = GetCmdSpace<cmd::CreateRenderSurface>(); 611 o3d::CreateRenderSurface& cmd = GetCmdSpace<o3d::CreateRenderSurface>();
611 cmd.Init(render_surface_id, texture_id, width, height, level, side); 612 cmd.Init(render_surface_id, texture_id, width, height, level, side);
612 } 613 }
613 614
614 void DestroyRenderSurface(ResourceId render_surface_id) { 615 void DestroyRenderSurface(ResourceId render_surface_id) {
615 cmd::DestroyRenderSurface& cmd = 616 o3d::DestroyRenderSurface& cmd =
616 GetCmdSpace<cmd::DestroyRenderSurface>(); 617 GetCmdSpace<o3d::DestroyRenderSurface>();
617 cmd.Init(render_surface_id); 618 cmd.Init(render_surface_id);
618 } 619 }
619 620
620 void CreateDepthSurface( 621 void CreateDepthSurface(
621 ResourceId depth_surface_id, uint32 width, uint32 height) { 622 ResourceId depth_surface_id, uint32 width, uint32 height) {
622 cmd::CreateDepthSurface& cmd = GetCmdSpace<cmd::CreateDepthSurface>(); 623 o3d::CreateDepthSurface& cmd = GetCmdSpace<o3d::CreateDepthSurface>();
623 cmd.Init(depth_surface_id, width, height); 624 cmd.Init(depth_surface_id, width, height);
624 } 625 }
625 626
626 void DestroyDepthSurface(ResourceId depth_surface_id) { 627 void DestroyDepthSurface(ResourceId depth_surface_id) {
627 cmd::DestroyDepthSurface& cmd = GetCmdSpace<cmd::DestroyDepthSurface>(); 628 o3d::DestroyDepthSurface& cmd = GetCmdSpace<o3d::DestroyDepthSurface>();
628 cmd.Init(depth_surface_id); 629 cmd.Init(depth_surface_id);
629 } 630 }
630 631
631 void SetRenderSurface( 632 void SetRenderSurface(
632 ResourceId render_surface_id, ResourceId depth_surface_id) { 633 ResourceId render_surface_id, ResourceId depth_surface_id) {
633 cmd::SetRenderSurface& cmd = GetCmdSpace<cmd::SetRenderSurface>(); 634 o3d::SetRenderSurface& cmd = GetCmdSpace<o3d::SetRenderSurface>();
634 cmd.Init(render_surface_id, depth_surface_id); 635 cmd.Init(render_surface_id, depth_surface_id);
635 } 636 }
636 637
637 void SetBackSurfaces() { 638 void SetBackSurfaces() {
638 cmd::SetBackSurfaces& cmd = GetCmdSpace<cmd::SetBackSurfaces>(); 639 o3d::SetBackSurfaces& cmd = GetCmdSpace<o3d::SetBackSurfaces>();
639 cmd.Init(); 640 cmd.Init();
640 } 641 }
641 }; 642 };
642 643
643 } // namespace command_buffer 644 } // namespace command_buffer
644 } // namespace o3d 645 } // namespace o3d
645 646
646 #endif // O3D_COMMAND_BUFFER_CLIENT_CROSS_O3D_CMD_HELPER_H_ 647 #endif // O3D_COMMAND_BUFFER_CLIENT_CROSS_O3D_CMD_HELPER_H_
647 648
OLDNEW
« no previous file with comments | « command_buffer/client/cross/fenced_allocator_test.cc ('k') | command_buffer/command_buffer.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698