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

Side by Side Diff: core/cross/command_buffer/states_cb.cc

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 | « core/cross/command_buffer/states_cb.h ('k') | core/cross/command_buffer/stream_bank_cb.cc » ('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 30 matching lines...) Expand all
41 41
42 namespace o3d { 42 namespace o3d {
43 using command_buffer::CommandBufferEntry; 43 using command_buffer::CommandBufferEntry;
44 using command_buffer::CommandBufferHelper; 44 using command_buffer::CommandBufferHelper;
45 45
46 namespace { 46 namespace {
47 47
48 // Converts values meant to represent a Cull Mode to the corresponding 48 // Converts values meant to represent a Cull Mode to the corresponding
49 // command-buffer value. 49 // command-buffer value.
50 // Default: CULL_NONE. 50 // Default: CULL_NONE.
51 command_buffer::FaceCullMode CullModeToCB(int cull) { 51 command_buffer::o3d::FaceCullMode CullModeToCB(int cull) {
52 switch (cull) { 52 switch (cull) {
53 default: 53 default:
54 case State::CULL_NONE: 54 case State::CULL_NONE:
55 return command_buffer::kCullNone; 55 return command_buffer::o3d::kCullNone;
56 case State::CULL_CW: 56 case State::CULL_CW:
57 return command_buffer::kCullCW; 57 return command_buffer::o3d::kCullCW;
58 case State::CULL_CCW: 58 case State::CULL_CCW:
59 return command_buffer::kCullCCW; 59 return command_buffer::o3d::kCullCCW;
60 } 60 }
61 } 61 }
62 62
63 // Converts values meant to represent a Polygon Fill Mode to the corresponding 63 // Converts values meant to represent a Polygon Fill Mode to the corresponding
64 // command-buffer value. 64 // command-buffer value.
65 // Default: kPolygonModeFill. 65 // Default: kPolygonModeFill.
66 command_buffer::PolygonMode FillModeToCB(int fill) { 66 command_buffer::o3d::PolygonMode FillModeToCB(int fill) {
67 switch (fill) { 67 switch (fill) {
68 case State::POINT: 68 case State::POINT:
69 return command_buffer::kPolygonModePoints; 69 return command_buffer::o3d::kPolygonModePoints;
70 case State::WIREFRAME: 70 case State::WIREFRAME:
71 return command_buffer::kPolygonModeLines; 71 return command_buffer::o3d::kPolygonModeLines;
72 default: 72 default:
73 case State::SOLID: 73 case State::SOLID:
74 return command_buffer::kPolygonModeFill; 74 return command_buffer::o3d::kPolygonModeFill;
75 } 75 }
76 } 76 }
77 77
78 // Converts values meant to represent a Comparison Function to the corresponding 78 // Converts values meant to represent a Comparison Function to the corresponding
79 // command-buffer value. 79 // command-buffer value.
80 // Default: kAlways. 80 // Default: kAlways.
81 command_buffer::Comparison ComparisonToCB(int comparison) { 81 command_buffer::o3d::Comparison ComparisonToCB(int comparison) {
82 switch (comparison) { 82 switch (comparison) {
83 case State::CMP_NEVER: 83 case State::CMP_NEVER:
84 return command_buffer::kNever; 84 return command_buffer::o3d::kNever;
85 case State::CMP_LESS: 85 case State::CMP_LESS:
86 return command_buffer::kLess; 86 return command_buffer::o3d::kLess;
87 case State::CMP_EQUAL: 87 case State::CMP_EQUAL:
88 return command_buffer::kEqual; 88 return command_buffer::o3d::kEqual;
89 case State::CMP_LEQUAL: 89 case State::CMP_LEQUAL:
90 return command_buffer::kLEqual; 90 return command_buffer::o3d::kLEqual;
91 case State::CMP_GREATER: 91 case State::CMP_GREATER:
92 return command_buffer::kGreater; 92 return command_buffer::o3d::kGreater;
93 case State::CMP_NOTEQUAL: 93 case State::CMP_NOTEQUAL:
94 return command_buffer::kNotEqual; 94 return command_buffer::o3d::kNotEqual;
95 case State::CMP_GEQUAL: 95 case State::CMP_GEQUAL:
96 return command_buffer::kGEqual; 96 return command_buffer::o3d::kGEqual;
97 case State::CMP_ALWAYS: 97 case State::CMP_ALWAYS:
98 default: 98 default:
99 return command_buffer::kAlways; 99 return command_buffer::o3d::kAlways;
100 } 100 }
101 } 101 }
102 102
103 // Converts values meant to represent a Stencil Operation to the corresponding 103 // Converts values meant to represent a Stencil Operation to the corresponding
104 // command-buffer value. 104 // command-buffer value.
105 // Default: kKeep. 105 // Default: kKeep.
106 command_buffer::StencilOp StencilOpToCB(int op) { 106 command_buffer::o3d::StencilOp StencilOpToCB(int op) {
107 switch (op) { 107 switch (op) {
108 default: 108 default:
109 case State::STENCIL_KEEP: 109 case State::STENCIL_KEEP:
110 return command_buffer::kKeep; 110 return command_buffer::o3d::kKeep;
111 case State::STENCIL_ZERO: 111 case State::STENCIL_ZERO:
112 return command_buffer::kZero; 112 return command_buffer::o3d::kZero;
113 case State::STENCIL_REPLACE: 113 case State::STENCIL_REPLACE:
114 return command_buffer::kReplace; 114 return command_buffer::o3d::kReplace;
115 case State::STENCIL_INCREMENT_SATURATE: 115 case State::STENCIL_INCREMENT_SATURATE:
116 return command_buffer::kIncNoWrap; 116 return command_buffer::o3d::kIncNoWrap;
117 case State::STENCIL_DECREMENT_SATURATE: 117 case State::STENCIL_DECREMENT_SATURATE:
118 return command_buffer::kDecNoWrap; 118 return command_buffer::o3d::kDecNoWrap;
119 case State::STENCIL_INVERT: 119 case State::STENCIL_INVERT:
120 return command_buffer::kInvert; 120 return command_buffer::o3d::kInvert;
121 case State::STENCIL_INCREMENT: 121 case State::STENCIL_INCREMENT:
122 return command_buffer::kIncWrap; 122 return command_buffer::o3d::kIncWrap;
123 case State::STENCIL_DECREMENT: 123 case State::STENCIL_DECREMENT:
124 return command_buffer::kDecWrap; 124 return command_buffer::o3d::kDecWrap;
125 } 125 }
126 } 126 }
127 127
128 // Converts values meant to represent a Blending Function to the corresponding 128 // Converts values meant to represent a Blending Function to the corresponding
129 // command-buffer value. 129 // command-buffer value.
130 // Default: kBlendFuncOne. 130 // Default: kBlendFuncOne.
131 command_buffer::BlendFunc BlendFuncToCB(int func) { 131 command_buffer::o3d::BlendFunc BlendFuncToCB(int func) {
132 switch (func) { 132 switch (func) {
133 case State::BLENDFUNC_ZERO: 133 case State::BLENDFUNC_ZERO:
134 return command_buffer::kBlendFuncZero; 134 return command_buffer::o3d::kBlendFuncZero;
135 default: 135 default:
136 case State::BLENDFUNC_ONE: 136 case State::BLENDFUNC_ONE:
137 return command_buffer::kBlendFuncOne; 137 return command_buffer::o3d::kBlendFuncOne;
138 case State::BLENDFUNC_SOURCE_COLOR: 138 case State::BLENDFUNC_SOURCE_COLOR:
139 return command_buffer::kBlendFuncSrcColor; 139 return command_buffer::o3d::kBlendFuncSrcColor;
140 case State::BLENDFUNC_INVERSE_SOURCE_COLOR: 140 case State::BLENDFUNC_INVERSE_SOURCE_COLOR:
141 return command_buffer::kBlendFuncInvSrcColor; 141 return command_buffer::o3d::kBlendFuncInvSrcColor;
142 case State::BLENDFUNC_SOURCE_ALPHA: 142 case State::BLENDFUNC_SOURCE_ALPHA:
143 return command_buffer::kBlendFuncSrcAlpha; 143 return command_buffer::o3d::kBlendFuncSrcAlpha;
144 case State::BLENDFUNC_INVERSE_SOURCE_ALPHA: 144 case State::BLENDFUNC_INVERSE_SOURCE_ALPHA:
145 return command_buffer::kBlendFuncInvSrcAlpha; 145 return command_buffer::o3d::kBlendFuncInvSrcAlpha;
146 case State::BLENDFUNC_DESTINATION_ALPHA: 146 case State::BLENDFUNC_DESTINATION_ALPHA:
147 return command_buffer::kBlendFuncDstAlpha; 147 return command_buffer::o3d::kBlendFuncDstAlpha;
148 case State::BLENDFUNC_INVERSE_DESTINATION_ALPHA: 148 case State::BLENDFUNC_INVERSE_DESTINATION_ALPHA:
149 return command_buffer::kBlendFuncInvDstAlpha; 149 return command_buffer::o3d::kBlendFuncInvDstAlpha;
150 case State::BLENDFUNC_DESTINATION_COLOR: 150 case State::BLENDFUNC_DESTINATION_COLOR:
151 return command_buffer::kBlendFuncDstColor; 151 return command_buffer::o3d::kBlendFuncDstColor;
152 case State::BLENDFUNC_INVERSE_DESTINATION_COLOR: 152 case State::BLENDFUNC_INVERSE_DESTINATION_COLOR:
153 return command_buffer::kBlendFuncInvDstColor; 153 return command_buffer::o3d::kBlendFuncInvDstColor;
154 case State::BLENDFUNC_SOURCE_ALPHA_SATUTRATE: 154 case State::BLENDFUNC_SOURCE_ALPHA_SATUTRATE:
155 return command_buffer::kBlendFuncSrcAlphaSaturate; 155 return command_buffer::o3d::kBlendFuncSrcAlphaSaturate;
156 } 156 }
157 } 157 }
158 158
159 // Converts values meant to represent a Blending Equation to the corresponding 159 // Converts values meant to represent a Blending Equation to the corresponding
160 // command-buffer value. 160 // command-buffer value.
161 // Default: kBlendEqAdd. 161 // Default: kBlendEqAdd.
162 command_buffer::BlendEq BlendEqToCB(int eq) { 162 command_buffer::o3d::BlendEq BlendEqToCB(int eq) {
163 switch (eq) { 163 switch (eq) {
164 default: 164 default:
165 case State::BLEND_ADD: 165 case State::BLEND_ADD:
166 return command_buffer::kBlendEqAdd; 166 return command_buffer::o3d::kBlendEqAdd;
167 case State::BLEND_SUBTRACT: 167 case State::BLEND_SUBTRACT:
168 return command_buffer::kBlendEqSub; 168 return command_buffer::o3d::kBlendEqSub;
169 case State::BLEND_REVERSE_SUBTRACT: 169 case State::BLEND_REVERSE_SUBTRACT:
170 return command_buffer::kBlendEqRevSub; 170 return command_buffer::o3d::kBlendEqRevSub;
171 case State::BLEND_MIN: 171 case State::BLEND_MIN:
172 return command_buffer::kBlendEqMin; 172 return command_buffer::o3d::kBlendEqMin;
173 case State::BLEND_MAX: 173 case State::BLEND_MAX:
174 return command_buffer::kBlendEqMax; 174 return command_buffer::o3d::kBlendEqMax;
175 } 175 }
176 } 176 }
177 177
178 } // anonymous namespace 178 } // anonymous namespace
179 179
180 // This class wraps StateHandler to make it type-safe. 180 // This class wraps StateHandler to make it type-safe.
181 template <typename T> 181 template <typename T>
182 class TypedStateHandler : public RendererCB::StateHandler { 182 class TypedStateHandler : public RendererCB::StateHandler {
183 public: 183 public:
184 // Override this function to set a specific state. 184 // Override this function to set a specific state.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 // A handler for the color write state. 257 // A handler for the color write state.
258 class ColorWriteStateHandler : public TypedStateHandler<ParamInteger> { 258 class ColorWriteStateHandler : public TypedStateHandler<ParamInteger> {
259 public: 259 public:
260 ColorWriteStateHandler(uint32 *value, bool *dirty) 260 ColorWriteStateHandler(uint32 *value, bool *dirty)
261 : value_(value), 261 : value_(value),
262 dirty_(dirty) { 262 dirty_(dirty) {
263 } 263 }
264 264
265 virtual void SetStateFromTypedParam(RendererCB* renderer, 265 virtual void SetStateFromTypedParam(RendererCB* renderer,
266 ParamInteger* param) const { 266 ParamInteger* param) const {
267 using command_buffer::cmd::SetColorWrite; 267 using command_buffer::o3d::SetColorWrite;
268 int mask = param->value(); 268 int mask = param->value();
269 SetColorWrite::AllColorsMask::Set(value_, mask); 269 SetColorWrite::AllColorsMask::Set(value_, mask);
270 renderer->SetWriteMask(mask); 270 renderer->SetWriteMask(mask);
271 *dirty_ = true; 271 *dirty_ = true;
272 } 272 }
273 private: 273 private:
274 uint32 *value_; 274 uint32 *value_;
275 bool *dirty_; 275 bool *dirty_;
276 }; 276 };
277 277
(...skipping 29 matching lines...) Expand all
307 // dirty: a pointer to the dirty bit. 307 // dirty: a pointer to the dirty bit.
308 class CullModeStateHandler : public TypedStateHandler<ParamInteger> { 308 class CullModeStateHandler : public TypedStateHandler<ParamInteger> {
309 public: 309 public:
310 CullModeStateHandler(uint32 *value, bool *dirty) 310 CullModeStateHandler(uint32 *value, bool *dirty)
311 : value_(value), 311 : value_(value),
312 dirty_(dirty) { 312 dirty_(dirty) {
313 } 313 }
314 314
315 virtual void SetStateFromTypedParam(RendererCB* renderer, 315 virtual void SetStateFromTypedParam(RendererCB* renderer,
316 ParamInteger* param) const { 316 ParamInteger* param) const {
317 using command_buffer::cmd::SetPolygonRaster; 317 using command_buffer::o3d::SetPolygonRaster;
318 SetPolygonRaster::CullMode::Set(value_, CullModeToCB(param->value())); 318 SetPolygonRaster::CullMode::Set(value_, CullModeToCB(param->value()));
319 *dirty_ = true; 319 *dirty_ = true;
320 } 320 }
321 private: 321 private:
322 uint32 *value_; 322 uint32 *value_;
323 bool *dirty_; 323 bool *dirty_;
324 }; 324 };
325 325
326 // Handler for Polygon Fill Mode. 326 // Handler for Polygon Fill Mode.
327 // Parameters: 327 // Parameters:
328 // value: a pointer to the argument value as an uint32. 328 // value: a pointer to the argument value as an uint32.
329 // dirty: a pointer to the dirty bit. 329 // dirty: a pointer to the dirty bit.
330 class FillModeStateHandler : public TypedStateHandler<ParamInteger> { 330 class FillModeStateHandler : public TypedStateHandler<ParamInteger> {
331 public: 331 public:
332 FillModeStateHandler(uint32 *value, bool *dirty) 332 FillModeStateHandler(uint32 *value, bool *dirty)
333 : value_(value), 333 : value_(value),
334 dirty_(dirty) { 334 dirty_(dirty) {
335 } 335 }
336 336
337 virtual void SetStateFromTypedParam(RendererCB* renderer, 337 virtual void SetStateFromTypedParam(RendererCB* renderer,
338 ParamInteger* param) const { 338 ParamInteger* param) const {
339 using command_buffer::cmd::SetPolygonRaster; 339 using command_buffer::o3d::SetPolygonRaster;
340 SetPolygonRaster::FillMode::Set(value_, FillModeToCB(param->value())); 340 SetPolygonRaster::FillMode::Set(value_, FillModeToCB(param->value()));
341 *dirty_ = true; 341 *dirty_ = true;
342 } 342 }
343 private: 343 private:
344 uint32 *value_; 344 uint32 *value_;
345 bool *dirty_; 345 bool *dirty_;
346 }; 346 };
347 347
348 // A template that generates a handler for comparison functions. 348 // A template that generates a handler for comparison functions.
349 // Template Parameters: 349 // Template Parameters:
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 bool *dirty_; 441 bool *dirty_;
442 }; 442 };
443 443
444 // Adds all the state handlers for all the states. The list of handlers must 444 // Adds all the state handlers for all the states. The list of handlers must
445 // match in names and types the list in Renderer::AddDefaultStates() 445 // match in names and types the list in Renderer::AddDefaultStates()
446 // (in renderer.cc). 446 // (in renderer.cc).
447 void RendererCB::StateManager::AddStateHandlers(RendererCB *renderer) { 447 void RendererCB::StateManager::AddStateHandlers(RendererCB *renderer) {
448 // Point/Line raster 448 // Point/Line raster
449 { 449 {
450 bool *dirty = point_line_helper_.dirty_ptr(); 450 bool *dirty = point_line_helper_.dirty_ptr();
451 using command_buffer::cmd::SetPointLineRaster; 451 using command_buffer::o3d::SetPointLineRaster;
452 SetPointLineRaster& cmd = point_line_helper_.command(); 452 SetPointLineRaster& cmd = point_line_helper_.command();
453 renderer->AddStateHandler( 453 renderer->AddStateHandler(
454 State::kLineSmoothEnableParamName, 454 State::kLineSmoothEnableParamName,
455 new EnableStateHandler< 455 new EnableStateHandler<
456 SetPointLineRaster::LineSmoothEnable>(&cmd.enables, dirty)); 456 SetPointLineRaster::LineSmoothEnable>(&cmd.enables, dirty));
457 renderer->AddStateHandler( 457 renderer->AddStateHandler(
458 State::kPointSpriteEnableParamName, 458 State::kPointSpriteEnableParamName,
459 new EnableStateHandler< 459 new EnableStateHandler<
460 SetPointLineRaster::PointSpriteEnable>(&cmd.enables, dirty)); 460 SetPointLineRaster::PointSpriteEnable>(&cmd.enables, dirty));
461 renderer->AddStateHandler(State::kPointSizeParamName, 461 renderer->AddStateHandler(State::kPointSizeParamName,
462 new ValueStateHandler<ParamFloat>( 462 new ValueStateHandler<ParamFloat>(
463 &cmd.point_size, dirty)); 463 &cmd.point_size, dirty));
464 } 464 }
465 465
466 // Polygon Raster 466 // Polygon Raster
467 { 467 {
468 bool *dirty = poly_raster_helper_.dirty_ptr(); 468 bool *dirty = poly_raster_helper_.dirty_ptr();
469 using command_buffer::cmd::SetPolygonRaster; 469 using command_buffer::o3d::SetPolygonRaster;
470 SetPolygonRaster& cmd = poly_raster_helper_.command(); 470 SetPolygonRaster& cmd = poly_raster_helper_.command();
471 renderer->AddStateHandler(State::kCullModeParamName, 471 renderer->AddStateHandler(State::kCullModeParamName,
472 new CullModeStateHandler(&cmd.fill_cull, dirty)); 472 new CullModeStateHandler(&cmd.fill_cull, dirty));
473 renderer->AddStateHandler(State::kFillModeParamName, 473 renderer->AddStateHandler(State::kFillModeParamName,
474 new FillModeStateHandler(&cmd.fill_cull, dirty)); 474 new FillModeStateHandler(&cmd.fill_cull, dirty));
475 } 475 }
476 476
477 // Polygon Offset 477 // Polygon Offset
478 { 478 {
479 bool *dirty = poly_offset_helper_.dirty_ptr(); 479 bool *dirty = poly_offset_helper_.dirty_ptr();
480 command_buffer::cmd::SetPolygonOffset& cmd = 480 command_buffer::o3d::SetPolygonOffset& cmd =
481 poly_offset_helper_.command(); 481 poly_offset_helper_.command();
482 renderer->AddStateHandler( 482 renderer->AddStateHandler(
483 State::kPolygonOffset1ParamName, 483 State::kPolygonOffset1ParamName,
484 new ValueStateHandler<ParamFloat>(&cmd.slope_factor, dirty)); 484 new ValueStateHandler<ParamFloat>(&cmd.slope_factor, dirty));
485 renderer->AddStateHandler( 485 renderer->AddStateHandler(
486 State::kPolygonOffset2ParamName, 486 State::kPolygonOffset2ParamName,
487 new ValueStateHandler<ParamFloat>(&cmd.units, dirty)); 487 new ValueStateHandler<ParamFloat>(&cmd.units, dirty));
488 } 488 }
489 489
490 // Alpha test 490 // Alpha test
491 { 491 {
492 using command_buffer::cmd::SetAlphaTest; 492 using command_buffer::o3d::SetAlphaTest;
493 SetAlphaTest& cmd = alpha_test_helper_.command(); 493 SetAlphaTest& cmd = alpha_test_helper_.command();
494 bool *dirty = alpha_test_helper_.dirty_ptr(); 494 bool *dirty = alpha_test_helper_.dirty_ptr();
495 renderer->AddStateHandler( 495 renderer->AddStateHandler(
496 State::kAlphaTestEnableParamName, 496 State::kAlphaTestEnableParamName,
497 new EnableStateHandler<SetAlphaTest::Enable>(&cmd.func_enable, dirty)); 497 new EnableStateHandler<SetAlphaTest::Enable>(&cmd.func_enable, dirty));
498 renderer->AddStateHandler( 498 renderer->AddStateHandler(
499 State::kAlphaComparisonFunctionParamName, 499 State::kAlphaComparisonFunctionParamName,
500 new ComparisonStateHandler<SetAlphaTest::Func>(&cmd.func_enable, dirty)) ; 500 new ComparisonStateHandler<SetAlphaTest::Func>(&cmd.func_enable, dirty)) ;
501 renderer->AddStateHandler( 501 renderer->AddStateHandler(
502 State::kAlphaReferenceParamName, 502 State::kAlphaReferenceParamName,
503 new ValueStateHandler<ParamFloat>(&cmd.value, dirty)); 503 new ValueStateHandler<ParamFloat>(&cmd.value, dirty));
504 } 504 }
505 505
506 // Depth Test 506 // Depth Test
507 { 507 {
508 bool *dirty = depth_test_helper_.dirty_ptr(); 508 bool *dirty = depth_test_helper_.dirty_ptr();
509 using command_buffer::cmd::SetDepthTest; 509 using command_buffer::o3d::SetDepthTest;
510 SetDepthTest& cmd = depth_test_helper_.command(); 510 SetDepthTest& cmd = depth_test_helper_.command();
511 renderer->AddStateHandler( 511 renderer->AddStateHandler(
512 State::kZWriteEnableParamName, 512 State::kZWriteEnableParamName,
513 new EnableStateHandler<SetDepthTest::WriteEnable>(&cmd.func_enable, dirt y)); 513 new EnableStateHandler<SetDepthTest::WriteEnable>(&cmd.func_enable, dirt y));
514 renderer->AddStateHandler( 514 renderer->AddStateHandler(
515 State::kZEnableParamName, 515 State::kZEnableParamName,
516 new EnableStateHandler<SetDepthTest::Enable>(&cmd.func_enable, dirty)); 516 new EnableStateHandler<SetDepthTest::Enable>(&cmd.func_enable, dirty));
517 renderer->AddStateHandler( 517 renderer->AddStateHandler(
518 State::kZComparisonFunctionParamName, 518 State::kZComparisonFunctionParamName,
519 new ComparisonStateHandler<SetDepthTest::Func>(&cmd.func_enable, dirty)) ; 519 new ComparisonStateHandler<SetDepthTest::Func>(&cmd.func_enable, dirty)) ;
520 } 520 }
521 521
522 // Stencil Test 522 // Stencil Test
523 { 523 {
524 bool *dirty = stencil_test_helper_.dirty_ptr(); 524 bool *dirty = stencil_test_helper_.dirty_ptr();
525 using command_buffer::cmd::SetStencilTest; 525 using command_buffer::o3d::SetStencilTest;
526 SetStencilTest& cmd = stencil_test_helper_.command(); 526 SetStencilTest& cmd = stencil_test_helper_.command();
527 renderer->AddStateHandler( 527 renderer->AddStateHandler(
528 State::kStencilEnableParamName, 528 State::kStencilEnableParamName,
529 new EnableStateHandler<SetStencilTest::Enable>(&cmd.stencil_args0, dirty )); 529 new EnableStateHandler<SetStencilTest::Enable>(&cmd.stencil_args0, dirty ));
530 renderer->AddStateHandler( 530 renderer->AddStateHandler(
531 State::kTwoSidedStencilEnableParamName, 531 State::kTwoSidedStencilEnableParamName,
532 new EnableStateHandler< 532 new EnableStateHandler<
533 SetStencilTest::SeparateCCW>(&cmd.stencil_args0, dirty)); 533 SetStencilTest::SeparateCCW>(&cmd.stencil_args0, dirty));
534 renderer->AddStateHandler( 534 renderer->AddStateHandler(
535 State::kStencilReferenceParamName, 535 State::kStencilReferenceParamName,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 SetStencilTest::CCWFailOp>(&cmd.stencil_args1, dirty)); 576 SetStencilTest::CCWFailOp>(&cmd.stencil_args1, dirty));
577 renderer->AddStateHandler( 577 renderer->AddStateHandler(
578 State::kCCWStencilZFailOperationParamName, 578 State::kCCWStencilZFailOperationParamName,
579 new StencilOpStateHandler< 579 new StencilOpStateHandler<
580 SetStencilTest::CCWZFailOp>(&cmd.stencil_args1, dirty)); 580 SetStencilTest::CCWZFailOp>(&cmd.stencil_args1, dirty));
581 } 581 }
582 582
583 // Blending 583 // Blending
584 { 584 {
585 bool *dirty = blending_helper_.dirty_ptr(); 585 bool *dirty = blending_helper_.dirty_ptr();
586 using command_buffer::cmd::SetBlending; 586 using command_buffer::o3d::SetBlending;
587 SetBlending& cmd = blending_helper_.command(); 587 SetBlending& cmd = blending_helper_.command();
588 renderer->AddStateHandler( 588 renderer->AddStateHandler(
589 State::kAlphaBlendEnableParamName, 589 State::kAlphaBlendEnableParamName,
590 new EnableStateHandler<SetBlending::Enable>(&cmd.blend_settings, dirty)) ; 590 new EnableStateHandler<SetBlending::Enable>(&cmd.blend_settings, dirty)) ;
591 renderer->AddStateHandler( 591 renderer->AddStateHandler(
592 State::kSeparateAlphaBlendEnableParamName, 592 State::kSeparateAlphaBlendEnableParamName,
593 new EnableStateHandler<SetBlending::SeparateAlpha>(&cmd.blend_settings, dirty)); 593 new EnableStateHandler<SetBlending::SeparateAlpha>(&cmd.blend_settings, dirty));
594 594
595 renderer->AddStateHandler( 595 renderer->AddStateHandler(
596 State::kSourceBlendFunctionParamName, 596 State::kSourceBlendFunctionParamName,
(...skipping 17 matching lines...) Expand all
614 SetBlending::AlphaDstFunc>(&cmd.blend_settings, dirty)); 614 SetBlending::AlphaDstFunc>(&cmd.blend_settings, dirty));
615 renderer->AddStateHandler( 615 renderer->AddStateHandler(
616 State::kBlendAlphaEquationParamName, 616 State::kBlendAlphaEquationParamName,
617 new BlendEqStateHandler< 617 new BlendEqStateHandler<
618 SetBlending::AlphaEq>(&cmd.blend_settings, dirty)); 618 SetBlending::AlphaEq>(&cmd.blend_settings, dirty));
619 } 619 }
620 620
621 // Color Write 621 // Color Write
622 { 622 {
623 bool *dirty = color_write_helper_.dirty_ptr(); 623 bool *dirty = color_write_helper_.dirty_ptr();
624 using command_buffer::cmd::SetColorWrite; 624 using command_buffer::o3d::SetColorWrite;
625 SetColorWrite& cmd = color_write_helper_.command(); 625 SetColorWrite& cmd = color_write_helper_.command();
626 renderer->AddStateHandler( 626 renderer->AddStateHandler(
627 State::kDitherEnableParamName, 627 State::kDitherEnableParamName,
628 new EnableStateHandler<SetColorWrite::DitherEnable>(&cmd.flags, dirty)); 628 new EnableStateHandler<SetColorWrite::DitherEnable>(&cmd.flags, dirty));
629 renderer->AddStateHandler( 629 renderer->AddStateHandler(
630 State::kColorWriteEnableParamName, 630 State::kColorWriteEnableParamName,
631 new ColorWriteStateHandler(&cmd.flags, dirty)); 631 new ColorWriteStateHandler(&cmd.flags, dirty));
632 } 632 }
633 } 633 }
634 634
635 void RendererCB::StateManager::ValidateStates(CommandBufferHelper *helper) { 635 void RendererCB::StateManager::ValidateStates(CommandBufferHelper *helper) {
636 point_line_helper_.Validate(helper); 636 point_line_helper_.Validate(helper);
637 poly_offset_helper_.Validate(helper); 637 poly_offset_helper_.Validate(helper);
638 poly_raster_helper_.Validate(helper); 638 poly_raster_helper_.Validate(helper);
639 alpha_test_helper_.Validate(helper); 639 alpha_test_helper_.Validate(helper);
640 depth_test_helper_.Validate(helper); 640 depth_test_helper_.Validate(helper);
641 stencil_test_helper_.Validate(helper); 641 stencil_test_helper_.Validate(helper);
642 color_write_helper_.Validate(helper); 642 color_write_helper_.Validate(helper);
643 blending_helper_.Validate(helper); 643 blending_helper_.Validate(helper);
644 } 644 }
645 645
646 } // namespace o3d 646 } // namespace o3d
OLDNEW
« no previous file with comments | « core/cross/command_buffer/states_cb.h ('k') | core/cross/command_buffer/stream_bank_cb.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698