Home | History | Annotate | Download | only in service
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 // This file is auto-generated from
      6 // gpu/command_buffer/build_gles2_cmd_buffer.py
      7 // DO NOT EDIT!
      8 
      9 // It is included by context_state.cc
     10 #ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_IMPL_AUTOGEN_H_
     11 #define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_IMPL_AUTOGEN_H_
     12 
     13 ContextState::EnableFlags::EnableFlags()
     14     : blend(false),
     15       cull_face(false),
     16       depth_test(false),
     17       dither(true),
     18       polygon_offset_fill(false),
     19       sample_alpha_to_coverage(false),
     20       sample_coverage(false),
     21       scissor_test(false),
     22       stencil_test(false) {
     23 }
     24 
     25 void ContextState::Initialize() {
     26   blend_color_red = 0.0f;
     27   blend_color_green = 0.0f;
     28   blend_color_blue = 0.0f;
     29   blend_color_alpha = 0.0f;
     30   blend_equation_rgb = GL_FUNC_ADD;
     31   blend_equation_alpha = GL_FUNC_ADD;
     32   blend_source_rgb = GL_ONE;
     33   blend_dest_rgb = GL_ZERO;
     34   blend_source_alpha = GL_ONE;
     35   blend_dest_alpha = GL_ZERO;
     36   color_clear_red = 0.0f;
     37   color_clear_green = 0.0f;
     38   color_clear_blue = 0.0f;
     39   color_clear_alpha = 0.0f;
     40   depth_clear = 1.0f;
     41   stencil_clear = 0;
     42   color_mask_red = true;
     43   color_mask_green = true;
     44   color_mask_blue = true;
     45   color_mask_alpha = true;
     46   cull_mode = GL_BACK;
     47   depth_func = GL_LESS;
     48   depth_mask = true;
     49   z_near = 0.0f;
     50   z_far = 1.0f;
     51   front_face = GL_CCW;
     52   hint_generate_mipmap = GL_DONT_CARE;
     53   hint_fragment_shader_derivative = GL_DONT_CARE;
     54   line_width = 1.0f;
     55   pack_alignment = 4;
     56   unpack_alignment = 4;
     57   polygon_offset_factor = 0.0f;
     58   polygon_offset_units = 0.0f;
     59   sample_coverage_value = 1.0f;
     60   sample_coverage_invert = false;
     61   scissor_x = 0;
     62   scissor_y = 0;
     63   scissor_width = 1;
     64   scissor_height = 1;
     65   stencil_front_func = GL_ALWAYS;
     66   stencil_front_ref = 0;
     67   stencil_front_mask = 0xFFFFFFFFU;
     68   stencil_back_func = GL_ALWAYS;
     69   stencil_back_ref = 0;
     70   stencil_back_mask = 0xFFFFFFFFU;
     71   stencil_front_writemask = 0xFFFFFFFFU;
     72   stencil_back_writemask = 0xFFFFFFFFU;
     73   stencil_front_fail_op = GL_KEEP;
     74   stencil_front_z_fail_op = GL_KEEP;
     75   stencil_front_z_pass_op = GL_KEEP;
     76   stencil_back_fail_op = GL_KEEP;
     77   stencil_back_z_fail_op = GL_KEEP;
     78   stencil_back_z_pass_op = GL_KEEP;
     79   viewport_x = 0;
     80   viewport_y = 0;
     81   viewport_width = 1;
     82   viewport_height = 1;
     83 }
     84 
     85 void ContextState::InitCapabilities() const {
     86   EnableDisable(GL_BLEND, enable_flags.blend);
     87   EnableDisable(GL_CULL_FACE, enable_flags.cull_face);
     88   EnableDisable(GL_DEPTH_TEST, enable_flags.depth_test);
     89   EnableDisable(GL_DITHER, enable_flags.dither);
     90   EnableDisable(GL_POLYGON_OFFSET_FILL, enable_flags.polygon_offset_fill);
     91   EnableDisable(
     92       GL_SAMPLE_ALPHA_TO_COVERAGE, enable_flags.sample_alpha_to_coverage);
     93   EnableDisable(GL_SAMPLE_COVERAGE, enable_flags.sample_coverage);
     94   EnableDisable(GL_SCISSOR_TEST, enable_flags.scissor_test);
     95   EnableDisable(GL_STENCIL_TEST, enable_flags.stencil_test);
     96 }
     97 
     98 void ContextState::InitState() const {
     99   glBlendColor(
    100       blend_color_red, blend_color_green, blend_color_blue, blend_color_alpha);
    101   glBlendEquationSeparate(blend_equation_rgb, blend_equation_alpha);
    102   glBlendFuncSeparate(
    103       blend_source_rgb, blend_dest_rgb, blend_source_alpha, blend_dest_alpha);
    104   glClearColor(
    105       color_clear_red, color_clear_green, color_clear_blue, color_clear_alpha);
    106   glClearDepth(depth_clear);
    107   glClearStencil(stencil_clear);
    108   glColorMask(
    109       color_mask_red, color_mask_green, color_mask_blue, color_mask_alpha);
    110   glCullFace(cull_mode);
    111   glDepthFunc(depth_func);
    112   glDepthMask(depth_mask);
    113   glDepthRange(z_near, z_far);
    114   glFrontFace(front_face);
    115   glHint(GL_GENERATE_MIPMAP_HINT, hint_generate_mipmap);
    116   if (feature_info_->feature_flags().oes_standard_derivatives)
    117     glHint(
    118       GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES, hint_fragment_shader_derivative);
    119   glLineWidth(line_width);
    120   glPixelStorei(GL_PACK_ALIGNMENT, pack_alignment);
    121   glPixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment);
    122   glPolygonOffset(polygon_offset_factor, polygon_offset_units);
    123   glSampleCoverage(sample_coverage_value, sample_coverage_invert);
    124   glScissor(scissor_x, scissor_y, scissor_width, scissor_height);
    125   glStencilFuncSeparate(
    126       GL_FRONT, stencil_front_func, stencil_front_ref, stencil_front_mask);
    127   glStencilFuncSeparate(
    128       GL_BACK, stencil_back_func, stencil_back_ref, stencil_back_mask);
    129   glStencilMaskSeparate(GL_FRONT, stencil_front_writemask);
    130   glStencilMaskSeparate(GL_BACK, stencil_back_writemask);
    131   glStencilOpSeparate(
    132       GL_FRONT, stencil_front_fail_op, stencil_front_z_fail_op,
    133       stencil_front_z_pass_op);
    134   glStencilOpSeparate(
    135       GL_BACK, stencil_back_fail_op, stencil_back_z_fail_op,
    136       stencil_back_z_pass_op);
    137   glViewport(viewport_x, viewport_y, viewport_width, viewport_height);
    138 }
    139 bool ContextState::GetEnabled(GLenum cap) const {
    140   switch (cap) {
    141     case GL_BLEND:
    142       return enable_flags.blend;
    143     case GL_CULL_FACE:
    144       return enable_flags.cull_face;
    145     case GL_DEPTH_TEST:
    146       return enable_flags.depth_test;
    147     case GL_DITHER:
    148       return enable_flags.dither;
    149     case GL_POLYGON_OFFSET_FILL:
    150       return enable_flags.polygon_offset_fill;
    151     case GL_SAMPLE_ALPHA_TO_COVERAGE:
    152       return enable_flags.sample_alpha_to_coverage;
    153     case GL_SAMPLE_COVERAGE:
    154       return enable_flags.sample_coverage;
    155     case GL_SCISSOR_TEST:
    156       return enable_flags.scissor_test;
    157     case GL_STENCIL_TEST:
    158       return enable_flags.stencil_test;
    159     default:
    160       NOTREACHED();
    161       return false;
    162   }
    163 }
    164 
    165 bool ContextState::GetStateAsGLint(
    166     GLenum pname, GLint* params, GLsizei* num_written) const {
    167   switch (pname) {
    168     case GL_BLEND_COLOR:
    169       *num_written = 4;
    170       if (params) {
    171         params[0] = static_cast<GLint>(blend_color_red);
    172         params[1] = static_cast<GLint>(blend_color_green);
    173         params[2] = static_cast<GLint>(blend_color_blue);
    174         params[3] = static_cast<GLint>(blend_color_alpha);
    175       }
    176       return true;
    177     case GL_BLEND_EQUATION_RGB:
    178       *num_written = 1;
    179       if (params) {
    180         params[0] = static_cast<GLint>(blend_equation_rgb);
    181       }
    182       return true;
    183     case GL_BLEND_EQUATION_ALPHA:
    184       *num_written = 1;
    185       if (params) {
    186         params[0] = static_cast<GLint>(blend_equation_alpha);
    187       }
    188       return true;
    189     case GL_BLEND_SRC_RGB:
    190       *num_written = 1;
    191       if (params) {
    192         params[0] = static_cast<GLint>(blend_source_rgb);
    193       }
    194       return true;
    195     case GL_BLEND_DST_RGB:
    196       *num_written = 1;
    197       if (params) {
    198         params[0] = static_cast<GLint>(blend_dest_rgb);
    199       }
    200       return true;
    201     case GL_BLEND_SRC_ALPHA:
    202       *num_written = 1;
    203       if (params) {
    204         params[0] = static_cast<GLint>(blend_source_alpha);
    205       }
    206       return true;
    207     case GL_BLEND_DST_ALPHA:
    208       *num_written = 1;
    209       if (params) {
    210         params[0] = static_cast<GLint>(blend_dest_alpha);
    211       }
    212       return true;
    213     case GL_COLOR_CLEAR_VALUE:
    214       *num_written = 4;
    215       if (params) {
    216         params[0] = static_cast<GLint>(color_clear_red);
    217         params[1] = static_cast<GLint>(color_clear_green);
    218         params[2] = static_cast<GLint>(color_clear_blue);
    219         params[3] = static_cast<GLint>(color_clear_alpha);
    220       }
    221       return true;
    222     case GL_DEPTH_CLEAR_VALUE:
    223       *num_written = 1;
    224       if (params) {
    225         params[0] = static_cast<GLint>(depth_clear);
    226       }
    227       return true;
    228     case GL_STENCIL_CLEAR_VALUE:
    229       *num_written = 1;
    230       if (params) {
    231         params[0] = static_cast<GLint>(stencil_clear);
    232       }
    233       return true;
    234     case GL_COLOR_WRITEMASK:
    235       *num_written = 4;
    236       if (params) {
    237         params[0] = static_cast<GLint>(color_mask_red);
    238         params[1] = static_cast<GLint>(color_mask_green);
    239         params[2] = static_cast<GLint>(color_mask_blue);
    240         params[3] = static_cast<GLint>(color_mask_alpha);
    241       }
    242       return true;
    243     case GL_CULL_FACE_MODE:
    244       *num_written = 1;
    245       if (params) {
    246         params[0] = static_cast<GLint>(cull_mode);
    247       }
    248       return true;
    249     case GL_DEPTH_FUNC:
    250       *num_written = 1;
    251       if (params) {
    252         params[0] = static_cast<GLint>(depth_func);
    253       }
    254       return true;
    255     case GL_DEPTH_WRITEMASK:
    256       *num_written = 1;
    257       if (params) {
    258         params[0] = static_cast<GLint>(depth_mask);
    259       }
    260       return true;
    261     case GL_DEPTH_RANGE:
    262       *num_written = 2;
    263       if (params) {
    264         params[0] = static_cast<GLint>(z_near);
    265         params[1] = static_cast<GLint>(z_far);
    266       }
    267       return true;
    268     case GL_FRONT_FACE:
    269       *num_written = 1;
    270       if (params) {
    271         params[0] = static_cast<GLint>(front_face);
    272       }
    273       return true;
    274     case GL_GENERATE_MIPMAP_HINT:
    275       *num_written = 1;
    276       if (params) {
    277         params[0] = static_cast<GLint>(hint_generate_mipmap);
    278       }
    279       return true;
    280     case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
    281       *num_written = 1;
    282       if (params) {
    283         params[0] = static_cast<GLint>(hint_fragment_shader_derivative);
    284       }
    285       return true;
    286     case GL_LINE_WIDTH:
    287       *num_written = 1;
    288       if (params) {
    289         params[0] = static_cast<GLint>(line_width);
    290       }
    291       return true;
    292     case GL_PACK_ALIGNMENT:
    293       *num_written = 1;
    294       if (params) {
    295         params[0] = static_cast<GLint>(pack_alignment);
    296       }
    297       return true;
    298     case GL_UNPACK_ALIGNMENT:
    299       *num_written = 1;
    300       if (params) {
    301         params[0] = static_cast<GLint>(unpack_alignment);
    302       }
    303       return true;
    304     case GL_POLYGON_OFFSET_FACTOR:
    305       *num_written = 1;
    306       if (params) {
    307         params[0] = static_cast<GLint>(polygon_offset_factor);
    308       }
    309       return true;
    310     case GL_POLYGON_OFFSET_UNITS:
    311       *num_written = 1;
    312       if (params) {
    313         params[0] = static_cast<GLint>(polygon_offset_units);
    314       }
    315       return true;
    316     case GL_SAMPLE_COVERAGE_VALUE:
    317       *num_written = 1;
    318       if (params) {
    319         params[0] = static_cast<GLint>(sample_coverage_value);
    320       }
    321       return true;
    322     case GL_SAMPLE_COVERAGE_INVERT:
    323       *num_written = 1;
    324       if (params) {
    325         params[0] = static_cast<GLint>(sample_coverage_invert);
    326       }
    327       return true;
    328     case GL_SCISSOR_BOX:
    329       *num_written = 4;
    330       if (params) {
    331         params[0] = static_cast<GLint>(scissor_x);
    332         params[1] = static_cast<GLint>(scissor_y);
    333         params[2] = static_cast<GLint>(scissor_width);
    334         params[3] = static_cast<GLint>(scissor_height);
    335       }
    336       return true;
    337     case GL_STENCIL_FUNC:
    338       *num_written = 1;
    339       if (params) {
    340         params[0] = static_cast<GLint>(stencil_front_func);
    341       }
    342       return true;
    343     case GL_STENCIL_REF:
    344       *num_written = 1;
    345       if (params) {
    346         params[0] = static_cast<GLint>(stencil_front_ref);
    347       }
    348       return true;
    349     case GL_STENCIL_VALUE_MASK:
    350       *num_written = 1;
    351       if (params) {
    352         params[0] = static_cast<GLint>(stencil_front_mask);
    353       }
    354       return true;
    355     case GL_STENCIL_BACK_FUNC:
    356       *num_written = 1;
    357       if (params) {
    358         params[0] = static_cast<GLint>(stencil_back_func);
    359       }
    360       return true;
    361     case GL_STENCIL_BACK_REF:
    362       *num_written = 1;
    363       if (params) {
    364         params[0] = static_cast<GLint>(stencil_back_ref);
    365       }
    366       return true;
    367     case GL_STENCIL_BACK_VALUE_MASK:
    368       *num_written = 1;
    369       if (params) {
    370         params[0] = static_cast<GLint>(stencil_back_mask);
    371       }
    372       return true;
    373     case GL_STENCIL_WRITEMASK:
    374       *num_written = 1;
    375       if (params) {
    376         params[0] = static_cast<GLint>(stencil_front_writemask);
    377       }
    378       return true;
    379     case GL_STENCIL_BACK_WRITEMASK:
    380       *num_written = 1;
    381       if (params) {
    382         params[0] = static_cast<GLint>(stencil_back_writemask);
    383       }
    384       return true;
    385     case GL_STENCIL_FAIL:
    386       *num_written = 1;
    387       if (params) {
    388         params[0] = static_cast<GLint>(stencil_front_fail_op);
    389       }
    390       return true;
    391     case GL_STENCIL_PASS_DEPTH_FAIL:
    392       *num_written = 1;
    393       if (params) {
    394         params[0] = static_cast<GLint>(stencil_front_z_fail_op);
    395       }
    396       return true;
    397     case GL_STENCIL_PASS_DEPTH_PASS:
    398       *num_written = 1;
    399       if (params) {
    400         params[0] = static_cast<GLint>(stencil_front_z_pass_op);
    401       }
    402       return true;
    403     case GL_STENCIL_BACK_FAIL:
    404       *num_written = 1;
    405       if (params) {
    406         params[0] = static_cast<GLint>(stencil_back_fail_op);
    407       }
    408       return true;
    409     case GL_STENCIL_BACK_PASS_DEPTH_FAIL:
    410       *num_written = 1;
    411       if (params) {
    412         params[0] = static_cast<GLint>(stencil_back_z_fail_op);
    413       }
    414       return true;
    415     case GL_STENCIL_BACK_PASS_DEPTH_PASS:
    416       *num_written = 1;
    417       if (params) {
    418         params[0] = static_cast<GLint>(stencil_back_z_pass_op);
    419       }
    420       return true;
    421     case GL_VIEWPORT:
    422       *num_written = 4;
    423       if (params) {
    424         params[0] = static_cast<GLint>(viewport_x);
    425         params[1] = static_cast<GLint>(viewport_y);
    426         params[2] = static_cast<GLint>(viewport_width);
    427         params[3] = static_cast<GLint>(viewport_height);
    428       }
    429       return true;
    430     case GL_BLEND:
    431       *num_written = 1;
    432       if (params) {
    433         params[0] = static_cast<GLint>(enable_flags.blend);
    434       }
    435       return true;
    436     case GL_CULL_FACE:
    437       *num_written = 1;
    438       if (params) {
    439         params[0] = static_cast<GLint>(enable_flags.cull_face);
    440       }
    441       return true;
    442     case GL_DEPTH_TEST:
    443       *num_written = 1;
    444       if (params) {
    445         params[0] = static_cast<GLint>(enable_flags.depth_test);
    446       }
    447       return true;
    448     case GL_DITHER:
    449       *num_written = 1;
    450       if (params) {
    451         params[0] = static_cast<GLint>(enable_flags.dither);
    452       }
    453       return true;
    454     case GL_POLYGON_OFFSET_FILL:
    455       *num_written = 1;
    456       if (params) {
    457         params[0] = static_cast<GLint>(enable_flags.polygon_offset_fill);
    458       }
    459       return true;
    460     case GL_SAMPLE_ALPHA_TO_COVERAGE:
    461       *num_written = 1;
    462       if (params) {
    463         params[0] = static_cast<GLint>(enable_flags.sample_alpha_to_coverage);
    464       }
    465       return true;
    466     case GL_SAMPLE_COVERAGE:
    467       *num_written = 1;
    468       if (params) {
    469         params[0] = static_cast<GLint>(enable_flags.sample_coverage);
    470       }
    471       return true;
    472     case GL_SCISSOR_TEST:
    473       *num_written = 1;
    474       if (params) {
    475         params[0] = static_cast<GLint>(enable_flags.scissor_test);
    476       }
    477       return true;
    478     case GL_STENCIL_TEST:
    479       *num_written = 1;
    480       if (params) {
    481         params[0] = static_cast<GLint>(enable_flags.stencil_test);
    482       }
    483       return true;
    484     default:
    485       return false;
    486   }
    487 }
    488 
    489 bool ContextState::GetStateAsGLfloat(
    490     GLenum pname, GLfloat* params, GLsizei* num_written) const {
    491   switch (pname) {
    492     case GL_BLEND_COLOR:
    493       *num_written = 4;
    494       if (params) {
    495         params[0] = static_cast<GLfloat>(blend_color_red);
    496         params[1] = static_cast<GLfloat>(blend_color_green);
    497         params[2] = static_cast<GLfloat>(blend_color_blue);
    498         params[3] = static_cast<GLfloat>(blend_color_alpha);
    499       }
    500       return true;
    501     case GL_BLEND_EQUATION_RGB:
    502       *num_written = 1;
    503       if (params) {
    504         params[0] = static_cast<GLfloat>(blend_equation_rgb);
    505       }
    506       return true;
    507     case GL_BLEND_EQUATION_ALPHA:
    508       *num_written = 1;
    509       if (params) {
    510         params[0] = static_cast<GLfloat>(blend_equation_alpha);
    511       }
    512       return true;
    513     case GL_BLEND_SRC_RGB:
    514       *num_written = 1;
    515       if (params) {
    516         params[0] = static_cast<GLfloat>(blend_source_rgb);
    517       }
    518       return true;
    519     case GL_BLEND_DST_RGB:
    520       *num_written = 1;
    521       if (params) {
    522         params[0] = static_cast<GLfloat>(blend_dest_rgb);
    523       }
    524       return true;
    525     case GL_BLEND_SRC_ALPHA:
    526       *num_written = 1;
    527       if (params) {
    528         params[0] = static_cast<GLfloat>(blend_source_alpha);
    529       }
    530       return true;
    531     case GL_BLEND_DST_ALPHA:
    532       *num_written = 1;
    533       if (params) {
    534         params[0] = static_cast<GLfloat>(blend_dest_alpha);
    535       }
    536       return true;
    537     case GL_COLOR_CLEAR_VALUE:
    538       *num_written = 4;
    539       if (params) {
    540         params[0] = static_cast<GLfloat>(color_clear_red);
    541         params[1] = static_cast<GLfloat>(color_clear_green);
    542         params[2] = static_cast<GLfloat>(color_clear_blue);
    543         params[3] = static_cast<GLfloat>(color_clear_alpha);
    544       }
    545       return true;
    546     case GL_DEPTH_CLEAR_VALUE:
    547       *num_written = 1;
    548       if (params) {
    549         params[0] = static_cast<GLfloat>(depth_clear);
    550       }
    551       return true;
    552     case GL_STENCIL_CLEAR_VALUE:
    553       *num_written = 1;
    554       if (params) {
    555         params[0] = static_cast<GLfloat>(stencil_clear);
    556       }
    557       return true;
    558     case GL_COLOR_WRITEMASK:
    559       *num_written = 4;
    560       if (params) {
    561         params[0] = static_cast<GLfloat>(color_mask_red);
    562         params[1] = static_cast<GLfloat>(color_mask_green);
    563         params[2] = static_cast<GLfloat>(color_mask_blue);
    564         params[3] = static_cast<GLfloat>(color_mask_alpha);
    565       }
    566       return true;
    567     case GL_CULL_FACE_MODE:
    568       *num_written = 1;
    569       if (params) {
    570         params[0] = static_cast<GLfloat>(cull_mode);
    571       }
    572       return true;
    573     case GL_DEPTH_FUNC:
    574       *num_written = 1;
    575       if (params) {
    576         params[0] = static_cast<GLfloat>(depth_func);
    577       }
    578       return true;
    579     case GL_DEPTH_WRITEMASK:
    580       *num_written = 1;
    581       if (params) {
    582         params[0] = static_cast<GLfloat>(depth_mask);
    583       }
    584       return true;
    585     case GL_DEPTH_RANGE:
    586       *num_written = 2;
    587       if (params) {
    588         params[0] = static_cast<GLfloat>(z_near);
    589         params[1] = static_cast<GLfloat>(z_far);
    590       }
    591       return true;
    592     case GL_FRONT_FACE:
    593       *num_written = 1;
    594       if (params) {
    595         params[0] = static_cast<GLfloat>(front_face);
    596       }
    597       return true;
    598     case GL_GENERATE_MIPMAP_HINT:
    599       *num_written = 1;
    600       if (params) {
    601         params[0] = static_cast<GLfloat>(hint_generate_mipmap);
    602       }
    603       return true;
    604     case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
    605       *num_written = 1;
    606       if (params) {
    607         params[0] = static_cast<GLfloat>(hint_fragment_shader_derivative);
    608       }
    609       return true;
    610     case GL_LINE_WIDTH:
    611       *num_written = 1;
    612       if (params) {
    613         params[0] = static_cast<GLfloat>(line_width);
    614       }
    615       return true;
    616     case GL_PACK_ALIGNMENT:
    617       *num_written = 1;
    618       if (params) {
    619         params[0] = static_cast<GLfloat>(pack_alignment);
    620       }
    621       return true;
    622     case GL_UNPACK_ALIGNMENT:
    623       *num_written = 1;
    624       if (params) {
    625         params[0] = static_cast<GLfloat>(unpack_alignment);
    626       }
    627       return true;
    628     case GL_POLYGON_OFFSET_FACTOR:
    629       *num_written = 1;
    630       if (params) {
    631         params[0] = static_cast<GLfloat>(polygon_offset_factor);
    632       }
    633       return true;
    634     case GL_POLYGON_OFFSET_UNITS:
    635       *num_written = 1;
    636       if (params) {
    637         params[0] = static_cast<GLfloat>(polygon_offset_units);
    638       }
    639       return true;
    640     case GL_SAMPLE_COVERAGE_VALUE:
    641       *num_written = 1;
    642       if (params) {
    643         params[0] = static_cast<GLfloat>(sample_coverage_value);
    644       }
    645       return true;
    646     case GL_SAMPLE_COVERAGE_INVERT:
    647       *num_written = 1;
    648       if (params) {
    649         params[0] = static_cast<GLfloat>(sample_coverage_invert);
    650       }
    651       return true;
    652     case GL_SCISSOR_BOX:
    653       *num_written = 4;
    654       if (params) {
    655         params[0] = static_cast<GLfloat>(scissor_x);
    656         params[1] = static_cast<GLfloat>(scissor_y);
    657         params[2] = static_cast<GLfloat>(scissor_width);
    658         params[3] = static_cast<GLfloat>(scissor_height);
    659       }
    660       return true;
    661     case GL_STENCIL_FUNC:
    662       *num_written = 1;
    663       if (params) {
    664         params[0] = static_cast<GLfloat>(stencil_front_func);
    665       }
    666       return true;
    667     case GL_STENCIL_REF:
    668       *num_written = 1;
    669       if (params) {
    670         params[0] = static_cast<GLfloat>(stencil_front_ref);
    671       }
    672       return true;
    673     case GL_STENCIL_VALUE_MASK:
    674       *num_written = 1;
    675       if (params) {
    676         params[0] = static_cast<GLfloat>(stencil_front_mask);
    677       }
    678       return true;
    679     case GL_STENCIL_BACK_FUNC:
    680       *num_written = 1;
    681       if (params) {
    682         params[0] = static_cast<GLfloat>(stencil_back_func);
    683       }
    684       return true;
    685     case GL_STENCIL_BACK_REF:
    686       *num_written = 1;
    687       if (params) {
    688         params[0] = static_cast<GLfloat>(stencil_back_ref);
    689       }
    690       return true;
    691     case GL_STENCIL_BACK_VALUE_MASK:
    692       *num_written = 1;
    693       if (params) {
    694         params[0] = static_cast<GLfloat>(stencil_back_mask);
    695       }
    696       return true;
    697     case GL_STENCIL_WRITEMASK:
    698       *num_written = 1;
    699       if (params) {
    700         params[0] = static_cast<GLfloat>(stencil_front_writemask);
    701       }
    702       return true;
    703     case GL_STENCIL_BACK_WRITEMASK:
    704       *num_written = 1;
    705       if (params) {
    706         params[0] = static_cast<GLfloat>(stencil_back_writemask);
    707       }
    708       return true;
    709     case GL_STENCIL_FAIL:
    710       *num_written = 1;
    711       if (params) {
    712         params[0] = static_cast<GLfloat>(stencil_front_fail_op);
    713       }
    714       return true;
    715     case GL_STENCIL_PASS_DEPTH_FAIL:
    716       *num_written = 1;
    717       if (params) {
    718         params[0] = static_cast<GLfloat>(stencil_front_z_fail_op);
    719       }
    720       return true;
    721     case GL_STENCIL_PASS_DEPTH_PASS:
    722       *num_written = 1;
    723       if (params) {
    724         params[0] = static_cast<GLfloat>(stencil_front_z_pass_op);
    725       }
    726       return true;
    727     case GL_STENCIL_BACK_FAIL:
    728       *num_written = 1;
    729       if (params) {
    730         params[0] = static_cast<GLfloat>(stencil_back_fail_op);
    731       }
    732       return true;
    733     case GL_STENCIL_BACK_PASS_DEPTH_FAIL:
    734       *num_written = 1;
    735       if (params) {
    736         params[0] = static_cast<GLfloat>(stencil_back_z_fail_op);
    737       }
    738       return true;
    739     case GL_STENCIL_BACK_PASS_DEPTH_PASS:
    740       *num_written = 1;
    741       if (params) {
    742         params[0] = static_cast<GLfloat>(stencil_back_z_pass_op);
    743       }
    744       return true;
    745     case GL_VIEWPORT:
    746       *num_written = 4;
    747       if (params) {
    748         params[0] = static_cast<GLfloat>(viewport_x);
    749         params[1] = static_cast<GLfloat>(viewport_y);
    750         params[2] = static_cast<GLfloat>(viewport_width);
    751         params[3] = static_cast<GLfloat>(viewport_height);
    752       }
    753       return true;
    754     case GL_BLEND:
    755       *num_written = 1;
    756       if (params) {
    757         params[0] = static_cast<GLfloat>(enable_flags.blend);
    758       }
    759       return true;
    760     case GL_CULL_FACE:
    761       *num_written = 1;
    762       if (params) {
    763         params[0] = static_cast<GLfloat>(enable_flags.cull_face);
    764       }
    765       return true;
    766     case GL_DEPTH_TEST:
    767       *num_written = 1;
    768       if (params) {
    769         params[0] = static_cast<GLfloat>(enable_flags.depth_test);
    770       }
    771       return true;
    772     case GL_DITHER:
    773       *num_written = 1;
    774       if (params) {
    775         params[0] = static_cast<GLfloat>(enable_flags.dither);
    776       }
    777       return true;
    778     case GL_POLYGON_OFFSET_FILL:
    779       *num_written = 1;
    780       if (params) {
    781         params[0] = static_cast<GLfloat>(enable_flags.polygon_offset_fill);
    782       }
    783       return true;
    784     case GL_SAMPLE_ALPHA_TO_COVERAGE:
    785       *num_written = 1;
    786       if (params) {
    787         params[0] =
    788             static_cast<GLfloat>(enable_flags.sample_alpha_to_coverage);
    789       }
    790       return true;
    791     case GL_SAMPLE_COVERAGE:
    792       *num_written = 1;
    793       if (params) {
    794         params[0] = static_cast<GLfloat>(enable_flags.sample_coverage);
    795       }
    796       return true;
    797     case GL_SCISSOR_TEST:
    798       *num_written = 1;
    799       if (params) {
    800         params[0] = static_cast<GLfloat>(enable_flags.scissor_test);
    801       }
    802       return true;
    803     case GL_STENCIL_TEST:
    804       *num_written = 1;
    805       if (params) {
    806         params[0] = static_cast<GLfloat>(enable_flags.stencil_test);
    807       }
    808       return true;
    809     default:
    810       return false;
    811   }
    812 }
    813 #endif  // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_IMPL_AUTOGEN_H_
    814 
    815