42 static void ClearBuffers(
const StateTable& st, StateTable* save_state,
43 GraphicsManager* gm) {
46 const math::Vector4f& color = st.GetClearColor();
47 if (st.AreSettingsEnforced() || color != save_state->GetClearColor()) {
48 save_state->SetClearColor(color);
49 gm->ClearColor(color[0], color[1], color[2], color[3]);
51 mask |= GL_COLOR_BUFFER_BIT;
54 const float value = st.GetClearDepthValue();
55 if (st.AreSettingsEnforced() || value != save_state->GetClearDepthValue()) {
56 save_state->SetClearDepthValue(value);
57 gm->ClearDepthf(value);
59 mask |= GL_DEPTH_BUFFER_BIT;
62 const int value = st.GetClearStencilValue();
63 if (st.AreSettingsEnforced() ||
64 value != save_state->GetClearStencilValue()) {
65 save_state->SetClearStencilValue(value);
66 gm->ClearStencil(value);
68 mask |= GL_STENCIL_BUFFER_BIT;
78 const StateTable& new_state,
79 StateTable* save_state,
80 GraphicsManager* gm) {
82 if (!gm->IsValidStateTableCapability(cap)) {
85 const base::IndexMap<StateTable::Capability, GLenum> capability_map =
86 base::EnumHelper::GetIndexMap<StateTable::Capability>();
87 if (new_state.IsCapabilitySet(cap)) {
88 const bool enabled = new_state.IsEnabled(cap);
89 if (new_state.AreSettingsEnforced() ||
90 enabled != save_state->IsEnabled(cap)) {
91 const GLenum value = capability_map.GetUnorderedIndex(cap);
96 save_state->Enable(cap, enabled);
104 static void UpdateCapabilities(
const StateTable& st0,
const StateTable& st1,
105 const StateTable& state_to_test,
106 GraphicsManager* gm) {
107 const base::IndexMap<StateTable::Capability, GLenum> capability_map =
108 base::EnumHelper::GetIndexMap<StateTable::Capability>();
109 const size_t num_capabilities = capability_map.GetCount();
110 for (
size_t i = 0; i < num_capabilities; ++i) {
114 if (!gm->IsValidStateTableCapability(st_cap)) {
117 if (state_to_test.IsCapabilitySet(st_cap)) {
118 const bool enabled = st1.IsEnabled(st_cap);
119 if (state_to_test.AreSettingsEnforced() ||
120 enabled != st0.IsEnabled(st_cap)) {
121 const GLenum gl_cap = capability_map.GetUnorderedIndex(st_cap);
136 static void UpdateBlendColor(
137 const StateTable& st0,
const StateTable& st1, GraphicsManager* gm) {
138 const math::Vector4f& color = st1.GetBlendColor();
139 if (st1.AreSettingsEnforced() || color != st0.GetBlendColor())
140 gm->BlendColor(color[0], color[1], color[2], color[3]);
143 static void UpdateBlendEquations(
144 const StateTable& st0,
const StateTable& st1, GraphicsManager* gm) {
147 if (st1.AreSettingsEnforced() || rgb != st0.GetRgbBlendEquation() ||
148 alpha != st0.GetAlphaBlendEquation()) {
154 static void UpdateBlendFunctions(
155 const StateTable& st0,
const StateTable& st1, GraphicsManager* gm) {
158 const Factor rgb_src = st1.GetRgbBlendFunctionSourceFactor();
159 const Factor rgb_dst = st1.GetRgbBlendFunctionDestinationFactor();
160 const Factor alpha_src = st1.GetAlphaBlendFunctionSourceFactor();
161 const Factor alpha_dst = st1.GetAlphaBlendFunctionDestinationFactor();
162 if (st1.AreSettingsEnforced() ||
163 rgb_src != st0.GetRgbBlendFunctionSourceFactor() ||
164 rgb_dst != st0.GetRgbBlendFunctionDestinationFactor() ||
165 alpha_src != st0.GetAlphaBlendFunctionSourceFactor() ||
166 alpha_dst != st0.GetAlphaBlendFunctionDestinationFactor()) {
174 static void UpdateColorWriteMasks(
175 StateTable* st0,
const StateTable& st1, GraphicsManager* gm) {
176 const bool red = st1.GetRedColorWriteMask();
177 const bool green = st1.GetGreenColorWriteMask();
178 const bool blue = st1.GetBlueColorWriteMask();
179 const bool alpha = st1.GetAlphaColorWriteMask();
180 if (st1.AreSettingsEnforced() || red != st0->GetRedColorWriteMask() ||
181 green != st0->GetGreenColorWriteMask() ||
182 blue != st0->GetBlueColorWriteMask() ||
183 alpha != st0->GetAlphaColorWriteMask()) {
184 gm->ColorMask(red, green, blue, alpha);
185 st0->SetColorWriteMasks(red, green, blue, alpha);
189 static void UpdateCullFaceMode(
190 const StateTable& st0,
const StateTable& st1, GraphicsManager* gm) {
192 if (st1.AreSettingsEnforced() || mode != st0.GetCullFaceMode())
196 static void UpdateFrontFaceMode(
197 const StateTable& st0,
const StateTable& st1, GraphicsManager* gm) {
199 if (st1.AreSettingsEnforced() || mode != st0.GetFrontFaceMode())
203 static void UpdateDepthFunction(
204 const StateTable& st0,
const StateTable& st1, GraphicsManager* gm) {
206 if (st1.AreSettingsEnforced() || func != st0.GetDepthFunction())
210 static void UpdateDepthRange(
211 const StateTable& st0,
const StateTable& st1, GraphicsManager* gm) {
213 if (st1.AreSettingsEnforced() || range != st0.GetDepthRange())
214 gm->DepthRangef(range.GetMinPoint(), range.GetMaxPoint());
217 static void UpdateDepthWriteMask(
218 StateTable* st0,
const StateTable& st1, GraphicsManager* gm) {
219 const bool mask = st1.GetDepthWriteMask();
220 if (st1.AreSettingsEnforced() || mask != st0->GetDepthWriteMask()) {
222 st0->SetDepthWriteMask(mask);
226 static void UpdateDrawBuffer(
const StateTable& st0,
const StateTable& st1,
227 GraphicsManager* gm) {
230 (st1.AreSettingsEnforced() || buf != st0.GetDrawBuffer())) {
235 static void UpdateHints(
236 const StateTable& st0,
const StateTable& st1, GraphicsManager* gm) {
239 if (st1.AreSettingsEnforced() ||
245 static void UpdateLineWidth(
246 const StateTable& st0,
const StateTable& st1, GraphicsManager* gm) {
247 const float width = st1.GetLineWidth();
248 if (st1.AreSettingsEnforced() || width != st0.GetLineWidth())
249 gm->LineWidth(width);
252 static void UpdatePolygonOffset(
253 const StateTable& st0,
const StateTable& st1, GraphicsManager* gm) {
254 const float factor = st1.GetPolygonOffsetFactor();
255 const float units = st1.GetPolygonOffsetUnits();
256 if (st1.AreSettingsEnforced() || factor != st0.GetPolygonOffsetFactor() ||
257 units != st0.GetPolygonOffsetUnits()) {
258 gm->PolygonOffset(factor, units);
262 static void UpdateSampleCoverage(
263 const StateTable& st0,
const StateTable& st1, GraphicsManager* gm) {
264 const float value = st1.GetSampleCoverageValue();
265 const bool is_inverted = st1.IsSampleCoverageInverted();
266 if (st1.AreSettingsEnforced() || value != st0.GetSampleCoverageValue() ||
267 is_inverted != st0.IsSampleCoverageInverted()) {
268 gm->SampleCoverage(value, is_inverted);
272 static void UpdateScissorBox(
273 StateTable* st0,
const StateTable& st1, GraphicsManager* gm) {
275 if (st1.AreSettingsEnforced() || box != st0->GetScissorBox()) {
276 const math::Point2i& min_point = box.GetMinPoint();
277 const math::Vector2i size = box.GetSize();
278 gm->Scissor(min_point[0], min_point[1], size[0], size[1]);
279 st0->SetScissorBox(box);
283 static void UpdateStencilFunctions(
284 const StateTable& st0,
const StateTable& st1, GraphicsManager* gm) {
286 const int front_ref = st1.GetFrontStencilReferenceValue();
287 const uint32 front_mask = st1.GetFrontStencilMask();
288 if (st1.AreSettingsEnforced() ||
289 front_func != st0.GetFrontStencilFunction() ||
290 front_ref != st0.GetFrontStencilReferenceValue() ||
291 front_mask != st0.GetFrontStencilMask()) {
292 gm->StencilFuncSeparate(GL_FRONT,
294 front_ref, front_mask);
298 const int back_ref = st1.GetBackStencilReferenceValue();
299 const uint32 back_mask = st1.GetBackStencilMask();
300 if (st1.AreSettingsEnforced() || back_func != st0.GetBackStencilFunction() ||
301 back_ref != st0.GetBackStencilReferenceValue() ||
302 back_mask != st0.GetBackStencilMask()) {
303 gm->StencilFuncSeparate(GL_BACK,
305 back_ref, back_mask);
309 static void UpdateStencilOperations(
310 const StateTable& st0,
const StateTable& st1, GraphicsManager* gm) {
314 const Op front_fail = st1.GetFrontStencilFailOperation();
315 const Op front_depth_fail = st1.GetFrontStencilDepthFailOperation();
316 const Op front_pass = st1.GetFrontStencilPassOperation();
317 if (st1.AreSettingsEnforced() ||
318 front_fail != st0.GetFrontStencilFailOperation() ||
319 front_depth_fail != st0.GetFrontStencilDepthFailOperation() ||
320 front_pass != st0.GetFrontStencilPassOperation()) {
321 gm->StencilOpSeparate(GL_FRONT,
327 const Op back_fail = st1.GetBackStencilFailOperation();
328 const Op back_depth_fail = st1.GetBackStencilDepthFailOperation();
329 const Op back_pass = st1.GetBackStencilPassOperation();
330 if (st1.AreSettingsEnforced() ||
331 back_fail != st0.GetBackStencilFailOperation() ||
332 back_depth_fail != st0.GetBackStencilDepthFailOperation() ||
333 back_pass != st0.GetBackStencilPassOperation()) {
340 static void UpdateStencilWriteMasks(
341 StateTable* st0,
const StateTable& st1, GraphicsManager* gm) {
342 const uint32 front_mask = st1.GetFrontStencilWriteMask();
344 if (st1.AreSettingsEnforced() ||
345 front_mask != st0->GetFrontStencilWriteMask()) {
346 gm->StencilMaskSeparate(GL_FRONT, front_mask);
350 const uint32 back_mask = st1.GetBackStencilWriteMask();
351 if (st1.AreSettingsEnforced() ||
352 back_mask != st0->GetBackStencilWriteMask()) {
353 gm->StencilMaskSeparate(GL_BACK, back_mask);
358 st0->SetStencilWriteMasks(front_mask, back_mask);
361 static void UpdateViewport(
362 const StateTable& st0,
const StateTable& st1, GraphicsManager* gm) {
364 if (st1.AreSettingsEnforced() || viewport != st0.GetViewport()) {
365 const math::Point2i& min_point = viewport.GetMinPoint();
366 const math::Vector2i size = viewport.GetSize();
367 gm->Viewport(min_point[0], min_point[1], size[0], size[1]);
379 static GLint GetInt(GraphicsManager* gm, GLenum what) {
381 gm->GetIntegerv(what, &i);
385 static GLfloat GetFloat(GraphicsManager* gm, GLenum what) {
387 gm->GetFloatv(what, &f);
391 static bool GetBool(GraphicsManager* gm, GLenum what) {
392 return GetInt(gm, what) != 0;
395 template <
typename EnumType>
396 static EnumType GetEnum(GraphicsManager* gm, GLenum what) {
397 return base::EnumHelper::GetEnum<EnumType>(GetInt(gm, what));
400 static const math::Vector4f GetColor(GraphicsManager* gm, GLenum what) {
401 math::Vector4f color;
402 gm->GetFloatv(what, color.Data());
417 static void CopyCapabilities(GraphicsManager* gm, StateTable* st) {
418 const base::IndexMap<StateTable::Capability, GLenum> capability_map =
419 base::EnumHelper::GetIndexMap<StateTable::Capability>();
421 const size_t num_capabilities = capability_map.GetCount();
422 for (
size_t i = 0; i < num_capabilities; ++i) {
425 if (gm->IsValidStateTableCapability(st_cap)) {
426 const GLenum gl_cap = capability_map.GetUnorderedIndex(st_cap);
427 const bool gl_state = gm->IsEnabled(gl_cap);
428 if (st->IsEnabled(st_cap) != gl_state)
429 st->Enable(st_cap, gl_state);
436 static void CopySetCapabilities(GraphicsManager* gm, StateTable* st) {
437 const base::IndexMap<StateTable::Capability, GLenum> capability_map =
438 base::EnumHelper::GetIndexMap<StateTable::Capability>();
440 const size_t num_capabilities = capability_map.GetCount();
441 for (
size_t i = 0; i < num_capabilities; ++i) {
444 if (st->IsCapabilitySet(st_cap)) {
445 const GLenum gl_cap = capability_map.GetUnorderedIndex(st_cap);
446 if (gm->IsValidStateTableCapability(st_cap)) {
447 const bool gl_state = gm->IsEnabled(gl_cap);
448 if (st->IsEnabled(st_cap) != gl_state)
449 st->Enable(st_cap, gl_state);
456 #define ION_GET_ENUM(st_type, gl_enum) GetEnum<StateTable::st_type>(gm, gl_enum)
459 static void CopyValues(GraphicsManager* gm, StateTable* st) {
460 st->SetBlendColor(GetColor(gm, GL_BLEND_COLOR));
461 st->SetBlendEquations(
ION_GET_ENUM(BlendEquation, GL_BLEND_EQUATION_RGB),
463 st->SetBlendFunctions(
ION_GET_ENUM(BlendFunctionFactor, GL_BLEND_SRC_RGB),
467 st->SetClearColor(GetColor(gm, GL_COLOR_CLEAR_VALUE));
470 gm->GetIntegerv(GL_COLOR_WRITEMASK, mask);
471 st->SetColorWriteMasks(mask[0], mask[1], mask[2], mask[3]);
473 st->SetCullFaceMode(
ION_GET_ENUM(CullFaceMode, GL_CULL_FACE_MODE));
474 st->SetFrontFaceMode(
ION_GET_ENUM(FrontFaceMode, GL_FRONT_FACE));
475 st->SetClearDepthValue(GetFloat(gm, GL_DEPTH_CLEAR_VALUE));
476 st->SetDepthFunction(
ION_GET_ENUM(DepthFunction, GL_DEPTH_FUNC));
479 gm->GetFloatv(GL_DEPTH_RANGE, range);
482 st->SetDepthWriteMask(GetBool(gm, GL_DEPTH_WRITEMASK));
484 st->SetDrawBuffer(
ION_GET_ENUM(DrawBuffer, GL_DRAW_BUFFER));
487 st->SetLineWidth(GetFloat(gm, GL_LINE_WIDTH));
488 st->SetPolygonOffset(GetFloat(gm, GL_POLYGON_OFFSET_FACTOR),
489 GetFloat(gm, GL_POLYGON_OFFSET_UNITS));
490 st->SetSampleCoverage(GetFloat(gm, GL_SAMPLE_COVERAGE_VALUE),
491 GetBool(gm, GL_SAMPLE_COVERAGE_INVERT));
494 gm->GetIntegerv(GL_SCISSOR_BOX, box);
496 math::Range2i::BuildWithSize(math::Point2i(box[0], box[1]),
497 math::Vector2i(box[2], box[3])));
499 st->SetStencilFunctions(
ION_GET_ENUM(StencilFunction, GL_STENCIL_FUNC),
500 GetInt(gm, GL_STENCIL_REF),
501 GetInt(gm, GL_STENCIL_VALUE_MASK),
503 GetInt(gm, GL_STENCIL_BACK_REF),
504 GetInt(gm, GL_STENCIL_BACK_VALUE_MASK));
505 st->SetStencilOperations(
507 ION_GET_ENUM(StencilOperation, GL_STENCIL_PASS_DEPTH_FAIL),
508 ION_GET_ENUM(StencilOperation, GL_STENCIL_PASS_DEPTH_PASS),
510 ION_GET_ENUM(StencilOperation, GL_STENCIL_BACK_PASS_DEPTH_FAIL),
511 ION_GET_ENUM(StencilOperation, GL_STENCIL_BACK_PASS_DEPTH_PASS));
512 st->SetClearStencilValue(GetInt(gm, GL_STENCIL_CLEAR_VALUE));
513 st->SetStencilWriteMasks(GetInt(gm, GL_STENCIL_WRITEMASK),
514 GetInt(gm, GL_STENCIL_BACK_WRITEMASK));
517 gm->GetIntegerv(GL_VIEWPORT, viewport);
519 math::Range2i::BuildWithSize(math::Point2i(viewport[0], viewport[1]),
520 math::Vector2i(viewport[2], viewport[3])));
526 static void CopySetValues(GraphicsManager* gm, StateTable* st) {
528 st->SetBlendColor(GetColor(gm, GL_BLEND_COLOR));
530 st->SetBlendEquations(
ION_GET_ENUM(BlendEquation, GL_BLEND_EQUATION_RGB),
533 st->SetBlendFunctions(
539 st->SetClearColor(GetColor(gm, GL_COLOR_CLEAR_VALUE));
542 gm->GetIntegerv(GL_COLOR_WRITEMASK, mask);
543 st->SetColorWriteMasks(mask[0], mask[1], mask[2], mask[3]);
546 st->SetCullFaceMode(
ION_GET_ENUM(CullFaceMode, GL_CULL_FACE_MODE));
548 st->SetFrontFaceMode(
ION_GET_ENUM(FrontFaceMode, GL_FRONT_FACE));
550 st->SetClearDepthValue(GetFloat(gm, GL_DEPTH_CLEAR_VALUE));
552 st->SetDepthFunction(
ION_GET_ENUM(DepthFunction, GL_DEPTH_FUNC));
555 gm->GetFloatv(GL_DEPTH_RANGE, range);
559 st->SetDepthWriteMask(GetBool(gm, GL_DEPTH_WRITEMASK));
562 st->SetDrawBuffer(
ION_GET_ENUM(DrawBuffer, GL_DRAW_BUFFER));
564 st->SetLineWidth(GetFloat(gm, GL_LINE_WIDTH));
566 st->SetPolygonOffset(GetFloat(gm, GL_POLYGON_OFFSET_FACTOR),
567 GetFloat(gm, GL_POLYGON_OFFSET_UNITS));
569 st->SetSampleCoverage(GetFloat(gm, GL_SAMPLE_COVERAGE_VALUE),
570 GetBool(gm, GL_SAMPLE_COVERAGE_INVERT));
573 gm->GetIntegerv(GL_SCISSOR_BOX, box);
574 st->SetScissorBox(math::Range2i::BuildWithSize(
575 math::Point2i(box[0], box[1]), math::Vector2i(box[2], box[3])));
578 st->SetStencilFunctions(
ION_GET_ENUM(StencilFunction, GL_STENCIL_FUNC),
579 GetInt(gm, GL_STENCIL_REF),
580 GetInt(gm, GL_STENCIL_VALUE_MASK),
582 GetInt(gm, GL_STENCIL_BACK_REF),
583 GetInt(gm, GL_STENCIL_BACK_VALUE_MASK));
585 st->SetStencilOperations(
587 ION_GET_ENUM(StencilOperation, GL_STENCIL_PASS_DEPTH_FAIL),
588 ION_GET_ENUM(StencilOperation, GL_STENCIL_PASS_DEPTH_PASS),
590 ION_GET_ENUM(StencilOperation, GL_STENCIL_BACK_PASS_DEPTH_FAIL),
591 ION_GET_ENUM(StencilOperation, GL_STENCIL_BACK_PASS_DEPTH_PASS));
593 st->SetClearStencilValue(GetInt(gm, GL_STENCIL_CLEAR_VALUE));
595 st->SetStencilWriteMasks(GetInt(gm, GL_STENCIL_WRITEMASK),
596 GetInt(gm, GL_STENCIL_BACK_WRITEMASK));
599 gm->GetIntegerv(GL_VIEWPORT, viewport);
601 math::Range2i::BuildWithSize(math::Point2i(viewport[0], viewport[1]),
602 math::Vector2i(viewport[2], viewport[3])));
608 static void ResetValues(
const StateTable& default_st, StateTable* st) {
609 #define ION_IS_SAME(func) st->func == default_st.func
610 #define ION_RESET(condition, value_enum) \
612 st->ResetValue(StateTable::value_enum)
613 #define ION_RESET1(value_enum, func) \
614 ION_RESET(ION_IS_SAME(func), value_enum)
615 #define ION_RESET2(value_enum, func1, func2) \
616 ION_RESET(ION_IS_SAME(func1) && ION_IS_SAME(func2), value_enum)
617 #define ION_RESET4(value_enum, func1, func2, func3, func4) \
618 ION_RESET(ION_IS_SAME(func1) && ION_IS_SAME(func2) && \
619 ION_IS_SAME(func3) && ION_IS_SAME(func4), value_enum)
620 #define ION_RESET6(value_enum, func1, func2, func3, func4, func5, func6) \
621 ION_RESET(ION_IS_SAME(func1) && ION_IS_SAME(func2) && \
622 ION_IS_SAME(func3) && ION_IS_SAME(func4) && \
623 ION_IS_SAME(func5) && ION_IS_SAME(func6), value_enum)
625 ION_RESET1(kBlendColorValue, GetBlendColor());
627 GetRgbBlendEquation(), GetAlphaBlendEquation());
629 GetRgbBlendFunctionSourceFactor(),
630 GetAlphaBlendFunctionSourceFactor(),
631 GetRgbBlendFunctionDestinationFactor(),
632 GetAlphaBlendFunctionDestinationFactor());
633 ION_RESET1(kClearColorValue, GetClearColor());
635 GetRedColorWriteMask(), GetBlueColorWriteMask(),
636 GetGreenColorWriteMask(), GetAlphaColorWriteMask());
637 ION_RESET1(kCullFaceModeValue, GetCullFaceMode());
638 ION_RESET1(kFrontFaceModeValue, GetFrontFaceMode());
639 ION_RESET1(kFrontFaceModeValue, GetFrontFaceMode());
640 ION_RESET1(kClearDepthValue, GetClearDepthValue());
641 ION_RESET1(kDepthFunctionValue, GetDepthFunction());
642 ION_RESET1(kDepthRangeValue, GetDepthRange());
643 ION_RESET1(kDepthWriteMaskValue, GetDepthWriteMask());
644 ION_RESET1(kDrawBufferValue, GetDrawBuffer());
648 GetPolygonOffsetFactor(), GetPolygonOffsetUnits());
650 GetSampleCoverageValue(), IsSampleCoverageInverted());
651 ION_RESET1(kScissorBoxValue, GetScissorBox());
653 GetFrontStencilFunction(), GetBackStencilFunction(),
654 GetFrontStencilReferenceValue(), GetBackStencilReferenceValue(),
655 GetFrontStencilMask(), GetBackStencilMask());
657 GetFrontStencilFailOperation(), GetBackStencilFailOperation(),
658 GetFrontStencilDepthFailOperation(),
659 GetBackStencilDepthFailOperation(),
660 GetFrontStencilPassOperation(), GetBackStencilPassOperation());
661 ION_RESET1(kClearStencilValue, GetClearStencilValue());
663 GetFrontStencilWriteMask(), GetBackStencilWriteMask());
693 CopyCapabilities(gm, st);
700 ResetValues(*default_st, st);
703 #define ION_UPDATE_CLEAR_VALUE(enum_name, update_func) \
704 if (new_state.IsValueSet(StateTable::enum_name)) \
705 update_func(save_state, new_state, gm)
706 #define ION_UPDATE_CLEAR_ONLY_VALUE(enum_name, clear_enum_name, update_func) \
707 if (new_state.IsValueSet(StateTable::enum_name) && \
708 new_state.IsValueSet(StateTable::clear_enum_name)) \
709 update_func(save_state, new_state, gm)
710 #define ION_UPDATE_VALUE(enum_name, update_func) \
711 if (new_state.IsValueSet(StateTable::enum_name)) \
712 update_func(*save_state, new_state, gm)
727 UpdateColorWriteMasks);
729 UpdateDepthWriteMask);
731 UpdateStencilWriteMasks);
732 ClearBuffers(new_state, save_state, gm);
740 CopySetCapabilities(gm, st);
741 CopySetValues(gm, st);
754 UpdateCapabilities(*save_state, new_state, new_state, gm);
780 #undef ION_UPDATE_CLEAR_VALUE
781 #undef ION_UPDATE_CLEAR_ONLY_VALUE
782 #undef ION_UPDATE_VALUE
void UpdateSettingsInStateTable(StateTable *st, GraphicsManager *gm)
This internal function can be used to update a StateTable instance to match the current OpenGL settin...
GraphicsManager manages the graphics library for an application.
kShortTerm is used for objects that are very transient in nature, such as scratch memory used to comp...
static uint32 GetConstant(EnumType e)
Returns the constant value corresponding to an enum.
#define ION_RESET2(value_enum, func1, func2)
void ClearFromStateTable(const StateTable &new_state, StateTable *save_state, GraphicsManager *gm)
This internal function can be used to update the Clear()-related OpenGL state (dithering, scissor test, write masks, scissor box, and clear values) managed by a GraphicsManager to match a StateTable, and updates save_state to contain the new state.
StencilFunction
OpenGL stencil functions.
FrontFaceMode
OpenGL front face modes.
CullFaceMode
OpenGL cull face modes.
size_t GetSetCapabilityCount() const
Returns the number of capabilities that are set in the instance.
HintMode
OpenGL hint modes.
Capability
Enumerated types for StateTable items.
Range< 2, int32 > Range2i
DepthFunction
OpenGL depth test functions.
#define ION_UPDATE_CLEAR_ONLY_VALUE(enum_name, clear_enum_name, update_func)
static bool AreCapabilitiesSame(const StateTable &st0, const StateTable &st1)
Returns true if the capabilities set in two instances are the same.
const AllocatorPtr & GetAllocatorForLifetime(AllocationLifetime lifetime) const
Convenience function that returns the Allocator to use to allocate an object with a specific lifetime...
#define ION_UPDATE_CLEAR_VALUE(enum_name, update_func)
void UpdateStateTable(int default_width, int default_height, GraphicsManager *gm, StateTable *st)
Public functions.
DrawBuffer
OpenGL draw buffers.
BlendFunctionFactor
OpenGL blend function factors.
void Reset()
Resets all items to their default values.
Copyright 2016 Google Inc.
BlendEquation
Other enumerated types.
void UpdateFromStateTable(const StateTable &new_state, StateTable *save_state, GraphicsManager *gm)
This internal function can be used to update the OpenGL state managed by a GraphicsManager to match a...
#define ION_UPDATE_VALUE(enum_name, update_func)
#define ION_RESET1(value_enum, func)
bool AreSettingsEnforced() const
StencilOperation
OpenGL stencil operations.
size_t GetSetValueCount() const
Returns the number of values that are set in the instance.
A StateTable represents a collection of graphical state items that affect OpenGL rendering.
#define ION_RESET4(value_enum, func1, func2, func3, func4)
A SharedPtr is a smart shared pointer to an instance of some class that implements reference counting...
#define ION_RESET6(value_enum, func1, func2, func3, func4, func5, func6)
Range< 1, float > Range1f
#define ION_GET_ENUM(st_type, gl_enum)
For brevity and clarity in the below functions.