| OLD | NEW |
| 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 uint32 left, | 212 uint32 left, |
| 213 uint32 top, | 213 uint32 top, |
| 214 uint32 width, | 214 uint32 width, |
| 215 uint32 height, | 215 uint32 height, |
| 216 float z_min, | 216 float z_min, |
| 217 float z_max) { | 217 float z_max) { |
| 218 cmd::SetViewport& cmd = GetCmdSpace<cmd::SetViewport>(); | 218 cmd::SetViewport& cmd = GetCmdSpace<cmd::SetViewport>(); |
| 219 cmd.Init(left, top, width, height, z_min, z_max); | 219 cmd.Init(left, top, width, height, z_min, z_max); |
| 220 } | 220 } |
| 221 | 221 |
| 222 void CreateVertexBuffer(uint32 id, uint32 size, uint32 flags) { | 222 void CreateVertexBuffer( |
| 223 ResourceId vertex_buffer_id, uint32 size, vertex_buffer::Flags flags) { |
| 223 cmd::CreateVertexBuffer& cmd = GetCmdSpace<cmd::CreateVertexBuffer>(); | 224 cmd::CreateVertexBuffer& cmd = GetCmdSpace<cmd::CreateVertexBuffer>(); |
| 224 cmd.Init(id, size, flags); | 225 cmd.Init(vertex_buffer_id, size, flags); |
| 225 } | 226 } |
| 226 | 227 |
| 227 void DestroyVertexBuffer(uint32 id) { | 228 void DestroyVertexBuffer(ResourceId vertex_buffer_id) { |
| 228 cmd::DestroyVertexBuffer& cmd = GetCmdSpace<cmd::DestroyVertexBuffer>(); | 229 cmd::DestroyVertexBuffer& cmd = GetCmdSpace<cmd::DestroyVertexBuffer>(); |
| 229 cmd.Init(id); | 230 cmd.Init(vertex_buffer_id); |
| 230 } | 231 } |
| 231 | 232 |
| 232 void SetVertexBufferDataImmediate( | 233 void SetVertexBufferDataImmediate( |
| 233 uint32 id, uint32 offset, | 234 ResourceId vertex_buffer_id, uint32 offset, |
| 234 const void* data, uint32 size) { | 235 const void* data, uint32 size) { |
| 235 cmd::SetVertexBufferDataImmediate& cmd = | 236 cmd::SetVertexBufferDataImmediate& cmd = |
| 236 GetImmediateCmdSpace<cmd::SetVertexBufferDataImmediate>(size); | 237 GetImmediateCmdSpace<cmd::SetVertexBufferDataImmediate>(size); |
| 237 cmd.Init(id, offset, data, size); | 238 cmd.Init(vertex_buffer_id, offset, data, size); |
| 238 } | 239 } |
| 239 | 240 |
| 240 void SetVertexBufferData( | 241 void SetVertexBufferData( |
| 241 uint32 id, uint32 offset, uint32 size, | 242 ResourceId vertex_buffer_id, uint32 offset, uint32 size, |
| 242 uint32 shared_memory_id, uint32 shared_memory_offset) { | 243 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 243 cmd::SetVertexBufferData& cmd = | 244 cmd::SetVertexBufferData& cmd = |
| 244 GetCmdSpace<cmd::SetVertexBufferData>(); | 245 GetCmdSpace<cmd::SetVertexBufferData>(); |
| 245 cmd.Init(id, offset, size, | 246 cmd.Init(vertex_buffer_id, offset, size, |
| 246 shared_memory_id, shared_memory_offset); | 247 shared_memory_id, shared_memory_offset); |
| 247 } | 248 } |
| 248 | 249 |
| 249 void GetVertexBufferData( | 250 void GetVertexBufferData( |
| 250 uint32 id, uint32 offset, uint32 size, | 251 ResourceId vertex_buffer_id, uint32 offset, uint32 size, |
| 251 uint32 shared_memory_id, uint32 shared_memory_offset) { | 252 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 252 cmd::GetVertexBufferData& cmd = | 253 cmd::GetVertexBufferData& cmd = |
| 253 GetCmdSpace<cmd::GetVertexBufferData>(); | 254 GetCmdSpace<cmd::GetVertexBufferData>(); |
| 254 cmd.Init(id, offset, size, | 255 cmd.Init(vertex_buffer_id, offset, size, |
| 255 shared_memory_id, shared_memory_offset); | 256 shared_memory_id, shared_memory_offset); |
| 256 } | 257 } |
| 257 | 258 |
| 258 void CreateIndexBuffer(uint32 id, uint32 size, uint32 flags) { | 259 void CreateIndexBuffer( |
| 260 ResourceId index_buffer_id, uint32 size, index_buffer::Flags flags) { |
| 259 cmd::CreateIndexBuffer& cmd = | 261 cmd::CreateIndexBuffer& cmd = |
| 260 GetCmdSpace<cmd::CreateIndexBuffer>(); | 262 GetCmdSpace<cmd::CreateIndexBuffer>(); |
| 261 cmd.Init(id, size, flags); | 263 cmd.Init(index_buffer_id, size, flags); |
| 262 } | 264 } |
| 263 | 265 |
| 264 void DestroyIndexBuffer(uint32 id) { | 266 void DestroyIndexBuffer(ResourceId index_buffer_id) { |
| 265 cmd::DestroyIndexBuffer& cmd = GetCmdSpace<cmd::DestroyIndexBuffer>(); | 267 cmd::DestroyIndexBuffer& cmd = GetCmdSpace<cmd::DestroyIndexBuffer>(); |
| 266 cmd.Init(id); | 268 cmd.Init(index_buffer_id); |
| 267 } | 269 } |
| 268 | 270 |
| 269 void SetIndexBufferDataImmediate( | 271 void SetIndexBufferDataImmediate( |
| 270 uint32 id, uint32 offset, const void* data, uint32 size) { | 272 ResourceId index_buffer_id, uint32 offset, |
| 273 const void* data, uint32 size) { |
| 271 cmd::SetIndexBufferDataImmediate& cmd = | 274 cmd::SetIndexBufferDataImmediate& cmd = |
| 272 GetImmediateCmdSpace<cmd::SetIndexBufferDataImmediate>(size); | 275 GetImmediateCmdSpace<cmd::SetIndexBufferDataImmediate>(size); |
| 273 cmd.Init(id, offset, data, size); | 276 cmd.Init(index_buffer_id, offset, data, size); |
| 274 } | 277 } |
| 275 | 278 |
| 276 void SetIndexBufferData( | 279 void SetIndexBufferData( |
| 277 uint32 id, uint32 offset, uint32 size, | 280 ResourceId index_buffer_id, uint32 offset, uint32 size, |
| 278 uint32 shared_memory_id, uint32 shared_memory_offset) { | 281 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 279 cmd::SetIndexBufferData& cmd = GetCmdSpace<cmd::SetIndexBufferData>(); | 282 cmd::SetIndexBufferData& cmd = GetCmdSpace<cmd::SetIndexBufferData>(); |
| 280 cmd.Init(id, offset, size, shared_memory_id, shared_memory_offset); | 283 cmd.Init(index_buffer_id, offset, size, |
| 284 shared_memory_id, shared_memory_offset); |
| 281 } | 285 } |
| 282 | 286 |
| 283 void GetIndexBufferData( | 287 void GetIndexBufferData( |
| 284 uint32 id, uint32 offset, uint32 size, | 288 ResourceId index_buffer_id, uint32 offset, uint32 size, |
| 285 uint32 shared_memory_id, uint32 shared_memory_offset) { | 289 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 286 cmd::GetIndexBufferData& cmd = GetCmdSpace<cmd::GetIndexBufferData>(); | 290 cmd::GetIndexBufferData& cmd = GetCmdSpace<cmd::GetIndexBufferData>(); |
| 287 cmd.Init(id, offset, size, shared_memory_id, shared_memory_offset); | 291 cmd.Init(index_buffer_id, offset, size, |
| 292 shared_memory_id, shared_memory_offset); |
| 288 } | 293 } |
| 289 | 294 |
| 290 void CreateVertexStruct(uint32 id, uint32 input_count) { | 295 void CreateVertexStruct(ResourceId vertex_struct_id, uint32 input_count) { |
| 291 cmd::CreateVertexStruct& cmd = GetCmdSpace<cmd::CreateVertexStruct>(); | 296 cmd::CreateVertexStruct& cmd = GetCmdSpace<cmd::CreateVertexStruct>(); |
| 292 cmd.Init(id, input_count); | 297 cmd.Init(vertex_struct_id, input_count); |
| 293 } | 298 } |
| 294 | 299 |
| 295 void DestroyVertexStruct(uint32 id) { | 300 void DestroyVertexStruct(ResourceId vertex_struct_id) { |
| 296 cmd::DestroyVertexStruct& cmd = GetCmdSpace<cmd::DestroyVertexStruct>(); | 301 cmd::DestroyVertexStruct& cmd = GetCmdSpace<cmd::DestroyVertexStruct>(); |
| 297 cmd.Init(id); | 302 cmd.Init(vertex_struct_id); |
| 298 } | 303 } |
| 299 | 304 |
| 300 void SetVertexInput( | 305 void SetVertexInput( |
| 301 uint32 vertex_struct_id, | 306 ResourceId vertex_struct_id, |
| 302 uint32 input_index, | 307 uint32 input_index, |
| 303 uint32 vertex_buffer_id, | 308 ResourceId vertex_buffer_id, |
| 304 uint32 offset, | 309 uint32 offset, |
| 305 uint8 semantic, | 310 vertex_struct::Semantic semantic, |
| 306 uint32 semantic_index, | 311 uint32 semantic_index, |
| 307 uint8 type, | 312 vertex_struct::Type type, |
| 308 uint32 stride) { | 313 uint32 stride) { |
| 309 cmd::SetVertexInput& cmd = GetCmdSpace<cmd::SetVertexInput>(); | 314 cmd::SetVertexInput& cmd = GetCmdSpace<cmd::SetVertexInput>(); |
| 310 cmd.Init( | 315 cmd.Init( |
| 311 vertex_struct_id, | 316 vertex_struct_id, |
| 312 input_index, | 317 input_index, |
| 313 vertex_buffer_id, | 318 vertex_buffer_id, |
| 314 offset, | 319 offset, |
| 315 semantic, | 320 semantic, |
| 316 semantic_index, | 321 semantic_index, |
| 317 type, | 322 type, |
| 318 stride); | 323 stride); |
| 319 } | 324 } |
| 320 | 325 |
| 321 void SetVertexStruct(uint32 id) { | 326 void SetVertexStruct(ResourceId vertex_struct_id) { |
| 322 cmd::SetVertexStruct& cmd = GetCmdSpace<cmd::SetVertexStruct>(); | 327 cmd::SetVertexStruct& cmd = GetCmdSpace<cmd::SetVertexStruct>(); |
| 323 cmd.Init(id); | 328 cmd.Init(vertex_struct_id); |
| 324 } | 329 } |
| 325 | 330 |
| 326 void Draw(uint32 primitive_type, uint32 first, uint32 count) { | 331 void Draw(PrimitiveType primitive_type, uint32 first, uint32 count) { |
| 327 cmd::Draw& cmd = GetCmdSpace<cmd::Draw>(); | 332 cmd::Draw& cmd = GetCmdSpace<cmd::Draw>(); |
| 328 cmd.Init(primitive_type, first, count); | 333 cmd.Init(primitive_type, first, count); |
| 329 } | 334 } |
| 330 | 335 |
| 331 void DrawIndexed( | 336 void DrawIndexed( |
| 332 uint32 primitive_type, | 337 PrimitiveType primitive_type, |
| 333 uint32 index_buffer_id, | 338 ResourceId index_buffer_id, |
| 334 uint32 first, | 339 uint32 first, |
| 335 uint32 count, | 340 uint32 count, |
| 336 uint32 min_index, | 341 uint32 min_index, |
| 337 uint32 max_index) { | 342 uint32 max_index) { |
| 338 cmd::DrawIndexed& cmd = GetCmdSpace<cmd::DrawIndexed>(); | 343 cmd::DrawIndexed& cmd = GetCmdSpace<cmd::DrawIndexed>(); |
| 339 cmd.Init( | 344 cmd.Init( |
| 340 primitive_type, | 345 primitive_type, |
| 341 index_buffer_id, | 346 index_buffer_id, |
| 342 first, | 347 first, |
| 343 count, | 348 count, |
| 344 min_index, | 349 min_index, |
| 345 max_index); | 350 max_index); |
| 346 } | 351 } |
| 347 | 352 |
| 348 void CreateEffect( | 353 void CreateEffect( |
| 349 uint32 id, uint32 size, | 354 ResourceId effect_id, uint32 size, |
| 350 uint32 shared_memory_id, uint32 shared_memory_offset) { | 355 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 351 cmd::CreateEffect& cmd = GetCmdSpace<cmd::CreateEffect>(); | 356 cmd::CreateEffect& cmd = GetCmdSpace<cmd::CreateEffect>(); |
| 352 cmd.Init(id, size, shared_memory_id, shared_memory_offset); | 357 cmd.Init(effect_id, size, shared_memory_id, shared_memory_offset); |
| 353 } | 358 } |
| 354 | 359 |
| 355 void CreateEffectImmediate(uint32 id, uint32 size, const void* data) { | 360 void CreateEffectImmediate( |
| 361 ResourceId effect_id, uint32 size, const void* data) { |
| 356 cmd::CreateEffectImmediate& cmd = | 362 cmd::CreateEffectImmediate& cmd = |
| 357 GetImmediateCmdSpace<cmd::CreateEffectImmediate>(size); | 363 GetImmediateCmdSpace<cmd::CreateEffectImmediate>(size); |
| 358 cmd.Init(id, size, data); | 364 cmd.Init(effect_id, size, data); |
| 359 } | 365 } |
| 360 | 366 |
| 361 void DestroyEffect(uint32 id) { | 367 void DestroyEffect(ResourceId effect_id) { |
| 362 cmd::DestroyEffect& cmd = GetCmdSpace<cmd::DestroyEffect>(); | 368 cmd::DestroyEffect& cmd = GetCmdSpace<cmd::DestroyEffect>(); |
| 363 cmd.Init(id); | 369 cmd.Init(effect_id); |
| 364 } | 370 } |
| 365 | 371 |
| 366 void SetEffect(uint32 id) { | 372 void SetEffect(ResourceId effect_id) { |
| 367 cmd::SetEffect& cmd = GetCmdSpace<cmd::SetEffect>(); | 373 cmd::SetEffect& cmd = GetCmdSpace<cmd::SetEffect>(); |
| 368 cmd.Init(id); | 374 cmd.Init(effect_id); |
| 369 } | 375 } |
| 370 | 376 |
| 371 void GetParamCount( | 377 void GetParamCount( |
| 372 uint32 id, uint32 size, | 378 ResourceId effect_id, uint32 size, |
| 373 uint32 shared_memory_id, uint32 shared_memory_offset) { | 379 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 374 cmd::GetParamCount& cmd = GetCmdSpace<cmd::GetParamCount>(); | 380 cmd::GetParamCount& cmd = GetCmdSpace<cmd::GetParamCount>(); |
| 375 cmd.Init(id, size, shared_memory_id, shared_memory_offset); | 381 cmd.Init(effect_id, size, shared_memory_id, shared_memory_offset); |
| 376 } | 382 } |
| 377 | 383 |
| 378 void CreateParam(uint32 param_id, uint32 effect_id, uint32 index) { | 384 void CreateParam(ResourceId param_id, ResourceId effect_id, uint32 index) { |
| 379 cmd::CreateParam& cmd = GetCmdSpace<cmd::CreateParam>(); | 385 cmd::CreateParam& cmd = GetCmdSpace<cmd::CreateParam>(); |
| 380 cmd.Init(param_id, effect_id, index); | 386 cmd.Init(param_id, effect_id, index); |
| 381 } | 387 } |
| 382 | 388 |
| 383 void CreateParamByName( | 389 void CreateParamByName( |
| 384 uint32 param_id, uint32 effect_id, uint32 size, | 390 ResourceId param_id, ResourceId effect_id, uint32 size, |
| 385 uint32 shared_memory_id, uint32 shared_memory_offset) { | 391 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 386 cmd::CreateParamByName& cmd = GetCmdSpace<cmd::CreateParamByName>(); | 392 cmd::CreateParamByName& cmd = GetCmdSpace<cmd::CreateParamByName>(); |
| 387 cmd.Init(param_id, effect_id, size, shared_memory_id, shared_memory_offset); | 393 cmd.Init(param_id, effect_id, size, shared_memory_id, shared_memory_offset); |
| 388 } | 394 } |
| 389 | 395 |
| 390 void CreateParamByNameImmediate( | 396 void CreateParamByNameImmediate( |
| 391 uint32 param_id, uint32 effect_id, uint32 size, const void* data) { | 397 ResourceId param_id, ResourceId effect_id, |
| 398 uint32 size, const void* data) { |
| 392 cmd::CreateParamByNameImmediate& cmd = | 399 cmd::CreateParamByNameImmediate& cmd = |
| 393 GetImmediateCmdSpace<cmd::CreateParamByNameImmediate>(size); | 400 GetImmediateCmdSpace<cmd::CreateParamByNameImmediate>(size); |
| 394 cmd.Init(param_id, effect_id, size, data); | 401 cmd.Init(param_id, effect_id, size, data); |
| 395 } | 402 } |
| 396 | 403 |
| 397 void DestroyParam(uint32 id) { | 404 void DestroyParam(ResourceId param_id) { |
| 398 cmd::DestroyParam& cmd = GetCmdSpace<cmd::DestroyParam>(); | 405 cmd::DestroyParam& cmd = GetCmdSpace<cmd::DestroyParam>(); |
| 399 cmd.Init(id); | 406 cmd.Init(param_id); |
| 400 } | 407 } |
| 401 | 408 |
| 402 void SetParamData( | 409 void SetParamData( |
| 403 uint32 id, uint32 size, | 410 ResourceId param_id, uint32 size, |
| 404 uint32 shared_memory_id, uint32 shared_memory_offset) { | 411 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 405 cmd::SetParamData& cmd = GetCmdSpace<cmd::SetParamData>(); | 412 cmd::SetParamData& cmd = GetCmdSpace<cmd::SetParamData>(); |
| 406 cmd.Init(id, size, shared_memory_id, shared_memory_offset); | 413 cmd.Init(param_id, size, shared_memory_id, shared_memory_offset); |
| 407 } | 414 } |
| 408 | 415 |
| 409 void SetParamDataImmediate(uint32 id, uint32 size, const void* data) { | 416 void SetParamDataImmediate( |
| 417 ResourceId param_id, uint32 size, const void* data) { |
| 410 cmd::SetParamDataImmediate& cmd = | 418 cmd::SetParamDataImmediate& cmd = |
| 411 GetImmediateCmdSpace<cmd::SetParamDataImmediate>(size); | 419 GetImmediateCmdSpace<cmd::SetParamDataImmediate>(size); |
| 412 cmd.Init(id, size, data); | 420 cmd.Init(param_id, size, data); |
| 413 } | 421 } |
| 414 | 422 |
| 415 void GetParamDesc( | 423 void GetParamDesc( |
| 416 uint32 id, uint32 size, | 424 ResourceId param_id, uint32 size, |
| 417 uint32 shared_memory_id, uint32 shared_memory_offset) { | 425 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 418 cmd::GetParamDesc& cmd = GetCmdSpace<cmd::GetParamDesc>(); | 426 cmd::GetParamDesc& cmd = GetCmdSpace<cmd::GetParamDesc>(); |
| 419 cmd.Init(id, size, shared_memory_id, shared_memory_offset); | 427 cmd.Init(param_id, size, shared_memory_id, shared_memory_offset); |
| 420 } | 428 } |
| 421 | 429 |
| 422 void GetStreamCount( | 430 void GetStreamCount( |
| 423 uint32 id, uint32 size, | 431 ResourceId effect_id, uint32 size, |
| 424 uint32 shared_memory_id, uint32 shared_memory_offset) { | 432 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 425 cmd::GetStreamCount& cmd = GetCmdSpace<cmd::GetStreamCount>(); | 433 cmd::GetStreamCount& cmd = GetCmdSpace<cmd::GetStreamCount>(); |
| 426 cmd.Init(id, size, shared_memory_id, shared_memory_offset); | 434 cmd.Init(effect_id, size, shared_memory_id, shared_memory_offset); |
| 427 } | 435 } |
| 428 | 436 |
| 429 void GetStreamDesc( | 437 void GetStreamDesc( |
| 430 uint32 id, uint32 index, uint32 size, | 438 ResourceId effect_id, uint32 index, uint32 size, |
| 431 uint32 shared_memory_id, uint32 shared_memory_offset) { | 439 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 432 cmd::GetStreamDesc& cmd = GetCmdSpace<cmd::GetStreamDesc>(); | 440 cmd::GetStreamDesc& cmd = GetCmdSpace<cmd::GetStreamDesc>(); |
| 433 cmd.Init(id, index, size, shared_memory_id, shared_memory_offset); | 441 cmd.Init(effect_id, index, size, shared_memory_id, shared_memory_offset); |
| 434 } | 442 } |
| 435 | 443 |
| 436 void DestroyTexture(uint32 id) { | 444 void DestroyTexture(ResourceId texture_id) { |
| 437 cmd::DestroyTexture& cmd = GetCmdSpace<cmd::DestroyTexture>(); | 445 cmd::DestroyTexture& cmd = GetCmdSpace<cmd::DestroyTexture>(); |
| 438 cmd.Init(id); | 446 cmd.Init(texture_id); |
| 439 } | 447 } |
| 440 | 448 |
| 441 void CreateTexture2d( | 449 void CreateTexture2d( |
| 442 uint32 texture_id, | 450 ResourceId texture_id, |
| 443 uint32 width, uint32 height, | 451 uint32 width, uint32 height, |
| 444 uint32 levels, uint32 format, | 452 uint32 levels, texture::Format format, |
| 445 uint32 enable_render_surfaces) { | 453 bool enable_render_surfaces) { |
| 446 cmd::CreateTexture2d& cmd = GetCmdSpace<cmd::CreateTexture2d>(); | 454 cmd::CreateTexture2d& cmd = GetCmdSpace<cmd::CreateTexture2d>(); |
| 447 cmd.Init(texture_id, | 455 cmd.Init(texture_id, |
| 448 width, height, levels, format, | 456 width, height, levels, format, |
| 449 enable_render_surfaces); | 457 enable_render_surfaces); |
| 450 } | 458 } |
| 451 | 459 |
| 452 void CreateTexture3d( | 460 void CreateTexture3d( |
| 453 uint32 texture_id, | 461 ResourceId texture_id, |
| 454 uint32 width, uint32 height, uint32 depth, | 462 uint32 width, uint32 height, uint32 depth, |
| 455 uint32 levels, uint32 format, | 463 uint32 levels, texture::Format format, |
| 456 uint32 enable_render_surfaces) { | 464 bool enable_render_surfaces) { |
| 457 cmd::CreateTexture3d& cmd = GetCmdSpace<cmd::CreateTexture3d>(); | 465 cmd::CreateTexture3d& cmd = GetCmdSpace<cmd::CreateTexture3d>(); |
| 458 cmd.Init(texture_id, | 466 cmd.Init(texture_id, |
| 459 width, height, depth, | 467 width, height, depth, |
| 460 levels, format, | 468 levels, format, |
| 461 enable_render_surfaces); | 469 enable_render_surfaces); |
| 462 } | 470 } |
| 463 | 471 |
| 464 void CreateTextureCube( | 472 void CreateTextureCube( |
| 465 uint32 texture_id, | 473 ResourceId texture_id, |
| 466 uint32 edge_length, uint32 levels, uint32 format, | 474 uint32 edge_length, uint32 levels, texture::Format format, |
| 467 uint32 enable_render_surfaces) { | 475 bool enable_render_surfaces) { |
| 468 cmd::CreateTextureCube& cmd = GetCmdSpace<cmd::CreateTextureCube>(); | 476 cmd::CreateTextureCube& cmd = GetCmdSpace<cmd::CreateTextureCube>(); |
| 469 cmd.Init(texture_id, | 477 cmd.Init(texture_id, |
| 470 edge_length, levels, format, | 478 edge_length, levels, format, |
| 471 enable_render_surfaces); | 479 enable_render_surfaces); |
| 472 } | 480 } |
| 473 | 481 |
| 474 void SetTextureData( | 482 void SetTextureData( |
| 475 uint32 texture_id, | 483 ResourceId texture_id, |
| 476 uint32 x, | 484 uint32 x, |
| 477 uint32 y, | 485 uint32 y, |
| 478 uint32 z, | 486 uint32 z, |
| 479 uint32 width, | 487 uint32 width, |
| 480 uint32 height, | 488 uint32 height, |
| 481 uint32 depth, | 489 uint32 depth, |
| 482 uint32 level, | 490 uint32 level, |
| 483 uint32 face, | 491 texture::Face face, |
| 484 uint32 row_pitch, | 492 uint32 row_pitch, |
| 485 uint32 slice_pitch, | 493 uint32 slice_pitch, |
| 486 uint32 size, | 494 uint32 size, |
| 487 uint32 shared_memory_id, | 495 uint32 shared_memory_id, |
| 488 uint32 shared_memory_offset) { | 496 uint32 shared_memory_offset) { |
| 489 cmd::SetTextureData& cmd = GetCmdSpace<cmd::SetTextureData>(); | 497 cmd::SetTextureData& cmd = GetCmdSpace<cmd::SetTextureData>(); |
| 490 cmd.Init( | 498 cmd.Init( |
| 491 texture_id, | 499 texture_id, |
| 492 x, | 500 x, |
| 493 y, | 501 y, |
| 494 z, | 502 z, |
| 495 width, | 503 width, |
| 496 height, | 504 height, |
| 497 depth, | 505 depth, |
| 498 level, | 506 level, |
| 499 face, | 507 face, |
| 500 row_pitch, | 508 row_pitch, |
| 501 slice_pitch, | 509 slice_pitch, |
| 502 size, | 510 size, |
| 503 shared_memory_id, | 511 shared_memory_id, |
| 504 shared_memory_offset); | 512 shared_memory_offset); |
| 505 } | 513 } |
| 506 | 514 |
| 507 void SetTextureDataImmediate( | 515 void SetTextureDataImmediate( |
| 508 uint32 texture_id, | 516 ResourceId texture_id, |
| 509 uint32 x, | 517 uint32 x, |
| 510 uint32 y, | 518 uint32 y, |
| 511 uint32 z, | 519 uint32 z, |
| 512 uint32 width, | 520 uint32 width, |
| 513 uint32 height, | 521 uint32 height, |
| 514 uint32 depth, | 522 uint32 depth, |
| 515 uint32 level, | 523 uint32 level, |
| 516 uint32 face, | 524 texture::Face face, |
| 517 uint32 row_pitch, | 525 uint32 row_pitch, |
| 518 uint32 slice_pitch, | 526 uint32 slice_pitch, |
| 519 uint32 size, | 527 uint32 size, |
| 520 const void* data) { | 528 const void* data) { |
| 521 cmd::SetTextureDataImmediate& cmd = | 529 cmd::SetTextureDataImmediate& cmd = |
| 522 GetImmediateCmdSpace<cmd::SetTextureDataImmediate>(size); | 530 GetImmediateCmdSpace<cmd::SetTextureDataImmediate>(size); |
| 523 cmd.Init( | 531 cmd.Init( |
| 524 texture_id, | 532 texture_id, |
| 525 x, | 533 x, |
| 526 y, | 534 y, |
| 527 z, | 535 z, |
| 528 width, | 536 width, |
| 529 height, | 537 height, |
| 530 depth, | 538 depth, |
| 531 level, | 539 level, |
| 532 face, | 540 face, |
| 533 row_pitch, | 541 row_pitch, |
| 534 slice_pitch, | 542 slice_pitch, |
| 535 size, | 543 size, |
| 536 data); | 544 data); |
| 537 } | 545 } |
| 538 | 546 |
| 539 void GetTextureData( | 547 void GetTextureData( |
| 540 uint32 texture_id, | 548 ResourceId texture_id, |
| 541 uint32 x, | 549 uint32 x, |
| 542 uint32 y, | 550 uint32 y, |
| 543 uint32 z, | 551 uint32 z, |
| 544 uint32 width, | 552 uint32 width, |
| 545 uint32 height, | 553 uint32 height, |
| 546 uint32 depth, | 554 uint32 depth, |
| 547 uint32 level, | 555 uint32 level, |
| 548 uint32 face, | 556 texture::Face face, |
| 549 uint32 row_pitch, | 557 uint32 row_pitch, |
| 550 uint32 slice_pitch, | 558 uint32 slice_pitch, |
| 551 uint32 size, | 559 uint32 size, |
| 552 uint32 shared_memory_id, | 560 uint32 shared_memory_id, |
| 553 uint32 shared_memory_offset) { | 561 uint32 shared_memory_offset) { |
| 554 cmd::GetTextureData& cmd = GetCmdSpace<cmd::GetTextureData>(); | 562 cmd::GetTextureData& cmd = GetCmdSpace<cmd::GetTextureData>(); |
| 555 cmd.Init( | 563 cmd.Init( |
| 556 texture_id, | 564 texture_id, |
| 557 x, | 565 x, |
| 558 y, | 566 y, |
| 559 z, | 567 z, |
| 560 width, | 568 width, |
| 561 height, | 569 height, |
| 562 depth, | 570 depth, |
| 563 level, | 571 level, |
| 564 face, | 572 face, |
| 565 row_pitch, | 573 row_pitch, |
| 566 slice_pitch, | 574 slice_pitch, |
| 567 size, | 575 size, |
| 568 shared_memory_id, | 576 shared_memory_id, |
| 569 shared_memory_offset); | 577 shared_memory_offset); |
| 570 } | 578 } |
| 571 | 579 |
| 572 void CreateSampler(uint32 id) { | 580 void CreateSampler(ResourceId sampler_id) { |
| 573 cmd::CreateSampler& cmd = GetCmdSpace<cmd::CreateSampler>(); | 581 cmd::CreateSampler& cmd = GetCmdSpace<cmd::CreateSampler>(); |
| 574 cmd.Init(id); | 582 cmd.Init(sampler_id); |
| 575 } | 583 } |
| 576 | 584 |
| 577 void DestroySampler(uint32 id) { | 585 void DestroySampler(ResourceId sampler_id) { |
| 578 cmd::DestroySampler& cmd = GetCmdSpace<cmd::DestroySampler>(); | 586 cmd::DestroySampler& cmd = GetCmdSpace<cmd::DestroySampler>(); |
| 579 cmd.Init(id); | 587 cmd.Init(sampler_id); |
| 580 } | 588 } |
| 581 | 589 |
| 582 void SetSamplerStates(uint32 id, | 590 void SetSamplerStates( |
| 583 uint32 address_u_value, | 591 ResourceId sampler_id, |
| 584 uint32 address_v_value, | 592 sampler::AddressingMode address_u_value, |
| 585 uint32 address_w_value, | 593 sampler::AddressingMode address_v_value, |
| 586 uint32 mag_filter_value, | 594 sampler::AddressingMode address_w_value, |
| 587 uint32 min_filter_value, | 595 sampler::FilteringMode mag_filter_value, |
| 588 uint32 mip_filter_value, | 596 sampler::FilteringMode min_filter_value, |
| 589 uint32 max_anisotropy) { | 597 sampler::FilteringMode mip_filter_value, |
| 598 uint8 max_anisotropy) { |
| 590 cmd::SetSamplerStates& cmd = GetCmdSpace<cmd::SetSamplerStates>(); | 599 cmd::SetSamplerStates& cmd = GetCmdSpace<cmd::SetSamplerStates>(); |
| 591 cmd.Init( | 600 cmd.Init( |
| 592 id, | 601 sampler_id, |
| 593 address_u_value, | 602 address_u_value, |
| 594 address_v_value, | 603 address_v_value, |
| 595 address_w_value, | 604 address_w_value, |
| 596 mag_filter_value, | 605 mag_filter_value, |
| 597 min_filter_value, | 606 min_filter_value, |
| 598 mip_filter_value, | 607 mip_filter_value, |
| 599 max_anisotropy); | 608 max_anisotropy); |
| 600 } | 609 } |
| 601 | 610 |
| 602 void SetSamplerBorderColor( | 611 void SetSamplerBorderColor( |
| 603 uint32 id, | 612 ResourceId sampler_id, |
| 604 float red, float green, float blue, float alpha) { | 613 float red, float green, float blue, float alpha) { |
| 605 cmd::SetSamplerBorderColor& cmd = | 614 cmd::SetSamplerBorderColor& cmd = |
| 606 GetCmdSpace<cmd::SetSamplerBorderColor>(); | 615 GetCmdSpace<cmd::SetSamplerBorderColor>(); |
| 607 cmd.Init(id, red, green, blue, alpha); | 616 cmd.Init(sampler_id, red, green, blue, alpha); |
| 608 } | 617 } |
| 609 | 618 |
| 610 void SetSamplerTexture(uint32 id, uint32 texture_id) { | 619 void SetSamplerTexture(ResourceId sampler_id, ResourceId texture_id) { |
| 611 cmd::SetSamplerTexture& cmd = GetCmdSpace<cmd::SetSamplerTexture>(); | 620 cmd::SetSamplerTexture& cmd = GetCmdSpace<cmd::SetSamplerTexture>(); |
| 612 cmd.Init(id, texture_id); | 621 cmd.Init(sampler_id, texture_id); |
| 613 } | 622 } |
| 614 | 623 |
| 615 void SetScissor( | 624 void SetScissor( |
| 616 uint32 x, | 625 uint32 x, |
| 617 uint32 y, | 626 uint32 y, |
| 618 uint32 width, | 627 uint32 width, |
| 619 uint32 height, | 628 uint32 height, |
| 620 bool enable) { | 629 bool enable) { |
| 621 cmd::SetScissor& cmd = GetCmdSpace<cmd::SetScissor>(); | 630 cmd::SetScissor& cmd = GetCmdSpace<cmd::SetScissor>(); |
| 622 cmd.Init( | 631 cmd.Init( |
| 623 x, | 632 x, |
| 624 y, | 633 y, |
| 625 width, | 634 width, |
| 626 height, | 635 height, |
| 627 enable); | 636 enable); |
| 628 } | 637 } |
| 629 | 638 |
| 630 void SetPolygonOffset(float slope_factor, float units) { | 639 void SetPolygonOffset(float slope_factor, float units) { |
| 631 cmd::SetPolygonOffset& cmd = GetCmdSpace<cmd::SetPolygonOffset>(); | 640 cmd::SetPolygonOffset& cmd = GetCmdSpace<cmd::SetPolygonOffset>(); |
| 632 cmd.Init(slope_factor, units); | 641 cmd.Init(slope_factor, units); |
| 633 } | 642 } |
| 634 | 643 |
| 635 void SetPointLineRaster( | 644 void SetPointLineRaster( |
| 636 bool line_smooth_enable, bool point_sprite_enable, float point_size) { | 645 bool line_smooth_enable, bool point_sprite_enable, float point_size) { |
| 637 cmd::SetPointLineRaster& cmd = GetCmdSpace<cmd::SetPointLineRaster>(); | 646 cmd::SetPointLineRaster& cmd = GetCmdSpace<cmd::SetPointLineRaster>(); |
| 638 cmd.Init(line_smooth_enable, point_sprite_enable, point_size); | 647 cmd.Init(line_smooth_enable, point_sprite_enable, point_size); |
| 639 } | 648 } |
| 640 | 649 |
| 641 void SetPolygonRaster(uint32 fill_mode, uint32 cull_mode) { | 650 void SetPolygonRaster(PolygonMode fill_mode, FaceCullMode cull_mode) { |
| 642 cmd::SetPolygonRaster& cmd = GetCmdSpace<cmd::SetPolygonRaster>(); | 651 cmd::SetPolygonRaster& cmd = GetCmdSpace<cmd::SetPolygonRaster>(); |
| 643 cmd.Init(fill_mode, cull_mode); | 652 cmd.Init(fill_mode, cull_mode); |
| 644 } | 653 } |
| 645 | 654 |
| 646 void SetAlphaTest(uint32 func, bool enable, float value) { | 655 void SetAlphaTest(Comparison func, bool enable, float value) { |
| 647 cmd::SetAlphaTest& cmd = GetCmdSpace<cmd::SetAlphaTest>(); | 656 cmd::SetAlphaTest& cmd = GetCmdSpace<cmd::SetAlphaTest>(); |
| 648 cmd.Init(func, enable, value); | 657 cmd.Init(func, enable, value); |
| 649 } | 658 } |
| 650 | 659 |
| 651 void SetDepthTest(uint32 func, bool write_enable, bool enable) { | 660 void SetDepthTest(Comparison func, bool write_enable, bool enable) { |
| 652 cmd::SetDepthTest& cmd = GetCmdSpace<cmd::SetDepthTest>(); | 661 cmd::SetDepthTest& cmd = GetCmdSpace<cmd::SetDepthTest>(); |
| 653 cmd.Init(func, write_enable, enable); | 662 cmd.Init(func, write_enable, enable); |
| 654 } | 663 } |
| 655 | 664 |
| 656 void SetStencilTest( | 665 void SetStencilTest( |
| 657 uint8 write_mask, | 666 uint8 write_mask, |
| 658 uint8 compare_mask, | 667 uint8 compare_mask, |
| 659 uint8 reference_value, | 668 uint8 reference_value, |
| 660 bool separate_ccw, | 669 bool separate_ccw, |
| 661 bool enable, | 670 bool enable, |
| 662 uint8 cw_func, | 671 Comparison cw_func, |
| 663 uint8 cw_pass_op, | 672 StencilOp cw_pass_op, |
| 664 uint8 cw_fail_op, | 673 StencilOp cw_fail_op, |
| 665 uint8 cw_z_fail_op, | 674 StencilOp cw_z_fail_op, |
| 666 uint8 ccw_func, | 675 Comparison ccw_func, |
| 667 uint8 ccw_pass_op, | 676 StencilOp ccw_pass_op, |
| 668 uint8 ccw_fail_op, | 677 StencilOp ccw_fail_op, |
| 669 uint8 ccw_z_fail_op) { | 678 StencilOp ccw_z_fail_op) { |
| 670 cmd::SetStencilTest& cmd = GetCmdSpace<cmd::SetStencilTest>(); | 679 cmd::SetStencilTest& cmd = GetCmdSpace<cmd::SetStencilTest>(); |
| 671 cmd.Init( | 680 cmd.Init( |
| 672 write_mask, | 681 write_mask, |
| 673 compare_mask, | 682 compare_mask, |
| 674 reference_value, | 683 reference_value, |
| 675 separate_ccw, | 684 separate_ccw, |
| 676 enable, | 685 enable, |
| 677 cw_func, | 686 cw_func, |
| 678 cw_pass_op, | 687 cw_pass_op, |
| 679 cw_fail_op, | 688 cw_fail_op, |
| 680 cw_z_fail_op, | 689 cw_z_fail_op, |
| 681 ccw_func, | 690 ccw_func, |
| 682 ccw_pass_op, | 691 ccw_pass_op, |
| 683 ccw_fail_op, | 692 ccw_fail_op, |
| 684 ccw_z_fail_op); | 693 ccw_z_fail_op); |
| 685 } | 694 } |
| 686 | 695 |
| 687 void SetColorWrite(uint8 mask, bool dither_enable) { | 696 void SetColorWrite(uint8 mask, bool dither_enable) { |
| 688 cmd::SetColorWrite& cmd = GetCmdSpace<cmd::SetColorWrite>(); | 697 cmd::SetColorWrite& cmd = GetCmdSpace<cmd::SetColorWrite>(); |
| 689 cmd.Init(mask, dither_enable); | 698 cmd.Init(mask, dither_enable); |
| 690 } | 699 } |
| 691 | 700 |
| 692 void SetBlending( | 701 void SetBlending( |
| 693 uint8 color_src_func, | 702 BlendFunc color_src_func, |
| 694 uint8 color_dst_func, | 703 BlendFunc color_dst_func, |
| 695 uint8 color_eq, | 704 BlendEq color_eq, |
| 696 uint8 alpha_src_func, | 705 BlendFunc alpha_src_func, |
| 697 uint8 alpha_dst_func, | 706 BlendFunc alpha_dst_func, |
| 698 uint8 alpha_eq, | 707 BlendEq alpha_eq, |
| 699 bool separate_alpha, | 708 bool separate_alpha, |
| 700 bool enable) { | 709 bool enable) { |
| 701 cmd::SetBlending& cmd = GetCmdSpace<cmd::SetBlending>(); | 710 cmd::SetBlending& cmd = GetCmdSpace<cmd::SetBlending>(); |
| 702 cmd.Init( | 711 cmd.Init( |
| 703 color_src_func, | 712 color_src_func, |
| 704 color_dst_func, | 713 color_dst_func, |
| 705 color_eq, | 714 color_eq, |
| 706 alpha_src_func, | 715 alpha_src_func, |
| 707 alpha_dst_func, | 716 alpha_dst_func, |
| 708 alpha_eq, | 717 alpha_eq, |
| 709 separate_alpha, | 718 separate_alpha, |
| 710 enable); | 719 enable); |
| 711 } | 720 } |
| 712 | 721 |
| 713 void SetBlendingColor(float red, float green, float blue, float alpha) { | 722 void SetBlendingColor(float red, float green, float blue, float alpha) { |
| 714 cmd::SetBlendingColor& cmd = GetCmdSpace<cmd::SetBlendingColor>(); | 723 cmd::SetBlendingColor& cmd = GetCmdSpace<cmd::SetBlendingColor>(); |
| 715 cmd.Init(red, green, blue, alpha); | 724 cmd.Init(red, green, blue, alpha); |
| 716 } | 725 } |
| 717 | 726 |
| 718 void CreateRenderSurface( | 727 void CreateRenderSurface( |
| 719 uint32 id, uint32 texture_id, | 728 ResourceId render_surface_id, ResourceId texture_id, |
| 720 uint32 width, uint32 height, | 729 uint32 width, uint32 height, |
| 721 uint32 level, uint32 side) { | 730 uint32 level, uint32 side) { |
| 722 cmd::CreateRenderSurface& cmd = GetCmdSpace<cmd::CreateRenderSurface>(); | 731 cmd::CreateRenderSurface& cmd = GetCmdSpace<cmd::CreateRenderSurface>(); |
| 723 cmd.Init(id, texture_id, width, height, level, side); | 732 cmd.Init(render_surface_id, texture_id, width, height, level, side); |
| 724 } | 733 } |
| 725 | 734 |
| 726 void DestroyRenderSurface(uint32 id) { | 735 void DestroyRenderSurface(ResourceId render_surface_id) { |
| 727 cmd::DestroyRenderSurface& cmd = | 736 cmd::DestroyRenderSurface& cmd = |
| 728 GetCmdSpace<cmd::DestroyRenderSurface>(); | 737 GetCmdSpace<cmd::DestroyRenderSurface>(); |
| 729 cmd.Init(id); | 738 cmd.Init(render_surface_id); |
| 730 } | 739 } |
| 731 | 740 |
| 732 void CreateDepthSurface(uint32 id, uint32 width, uint32 height) { | 741 void CreateDepthSurface( |
| 742 ResourceId depth_surface_id, uint32 width, uint32 height) { |
| 733 cmd::CreateDepthSurface& cmd = GetCmdSpace<cmd::CreateDepthSurface>(); | 743 cmd::CreateDepthSurface& cmd = GetCmdSpace<cmd::CreateDepthSurface>(); |
| 734 cmd.Init(id, width, height); | 744 cmd.Init(depth_surface_id, width, height); |
| 735 } | 745 } |
| 736 | 746 |
| 737 void DestroyDepthSurface(uint32 id) { | 747 void DestroyDepthSurface(ResourceId depth_surface_id) { |
| 738 cmd::DestroyDepthSurface& cmd = GetCmdSpace<cmd::DestroyDepthSurface>(); | 748 cmd::DestroyDepthSurface& cmd = GetCmdSpace<cmd::DestroyDepthSurface>(); |
| 739 cmd.Init(id); | 749 cmd.Init(depth_surface_id); |
| 740 } | 750 } |
| 741 | 751 |
| 742 void SetRenderSurface(uint32 render_surface_id, uint32 depth_surface_id) { | 752 void SetRenderSurface( |
| 753 ResourceId render_surface_id, ResourceId depth_surface_id) { |
| 743 cmd::SetRenderSurface& cmd = GetCmdSpace<cmd::SetRenderSurface>(); | 754 cmd::SetRenderSurface& cmd = GetCmdSpace<cmd::SetRenderSurface>(); |
| 744 cmd.Init(render_surface_id, depth_surface_id); | 755 cmd.Init(render_surface_id, depth_surface_id); |
| 745 } | 756 } |
| 746 | 757 |
| 747 void SetBackSurfaces() { | 758 void SetBackSurfaces() { |
| 748 cmd::SetBackSurfaces& cmd = GetCmdSpace<cmd::SetBackSurfaces>(); | 759 cmd::SetBackSurfaces& cmd = GetCmdSpace<cmd::SetBackSurfaces>(); |
| 749 cmd.Init(); | 760 cmd.Init(); |
| 750 } | 761 } |
| 751 | 762 |
| 752 private: | 763 private: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 769 CommandBufferOffset get_; | 780 CommandBufferOffset get_; |
| 770 CommandBufferOffset put_; | 781 CommandBufferOffset put_; |
| 771 | 782 |
| 772 friend class CommandBufferHelperTest; | 783 friend class CommandBufferHelperTest; |
| 773 }; | 784 }; |
| 774 | 785 |
| 775 } // namespace command_buffer | 786 } // namespace command_buffer |
| 776 } // namespace o3d | 787 } // namespace o3d |
| 777 | 788 |
| 778 #endif // O3D_COMMAND_BUFFER_CLIENT_CROSS_CMD_BUFFER_HELPER_H_ | 789 #endif // O3D_COMMAND_BUFFER_CLIENT_CROSS_CMD_BUFFER_HELPER_H_ |
| OLD | NEW |