summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorskyostil@chromium.org <skyostil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-04 17:12:02 +0000
committerskyostil@chromium.org <skyostil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-04 17:12:02 +0000
commitfcf1e7bef3c4c727998ee7e058a2d9b4249f5c70 (patch)
treea493b4c7a9c1b6158630311f8e005ea5c5065ff0 /gpu
parent1dd8c4036c596bc9ad7c45a6f16d9c1f1a8bdff4 (diff)
downloadchromium_src-fcf1e7bef3c4c727998ee7e058a2d9b4249f5c70.zip
chromium_src-fcf1e7bef3c4c727998ee7e058a2d9b4249f5c70.tar.gz
chromium_src-fcf1e7bef3c4c727998ee7e058a2d9b4249f5c70.tar.bz2
gpu: Make pack/unpack alignment part of autogenerated state
This patch makes GL_PACK_ALIGNMENT and GL_UNPACK_ALIGNMENT part of the autogenerated GL state. Review URL: https://chromiumcodereview.appspot.com/16240016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203990 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rwxr-xr-xgpu/command_buffer/build_gles2_cmd_buffer.py24
-rw-r--r--gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h2
-rw-r--r--gpu/command_buffer/service/context_state.cc7
-rw-r--r--gpu/command_buffer/service/context_state.h6
-rw-r--r--gpu/command_buffer/service/context_state_autogen.h2
-rw-r--r--gpu/command_buffer/service/context_state_impl_autogen.h372
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc3
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h6
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc9
-rw-r--r--gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h2
10 files changed, 233 insertions, 200 deletions
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py
index 9bc5823..ba91dc0 100755
--- a/gpu/command_buffer/build_gles2_cmd_buffer.py
+++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
@@ -361,10 +361,26 @@ _STATES = {
}
],
},
+ 'PixelStore': {
+ 'type': 'NamedParameter',
+ 'func': 'PixelStorei',
+ 'states': [
+ {
+ 'name': 'pack_alignment',
+ 'type': 'GLint',
+ 'enum': 'GL_PACK_ALIGNMENT',
+ 'default': '4'
+ },
+ {
+ 'name': 'unpack_alignment',
+ 'type': 'GLint',
+ 'enum': 'GL_UNPACK_ALIGNMENT',
+ 'default': '4'
+ }
+ ],
+ },
# TODO: Consider implemenenting these states
- # GL_ACTIVE_TEXTURE,
- # GL_PACK_ALIGNMENT,
- # GL_UNPACK_ALIGNMENT
+ # GL_ACTIVE_TEXTURE
'LineWidth': {
'type': 'Normal',
'func': 'LineWidth',
@@ -7031,7 +7047,7 @@ bool %s::GetStateAs%s(
GLenum pname, %s* params, GLsizei* num_written) const {
switch (pname) {
""" % (class_name, gl_type, gl_type))
- for state_name in _STATES.keys():
+ for state_name in sorted(_STATES.keys()):
state = _STATES[state_name]
if 'enum' in state:
file.Write(" case %s:\n" % state['enum'])
diff --git a/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h b/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h
index 8957701..36975dd 100644
--- a/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h
+++ b/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h
@@ -930,6 +930,8 @@ std::string GLES2Util::GetStringGLState(uint32 value) {
{ GL_FRONT_FACE, "GL_FRONT_FACE" },
{ GL_GENERATE_MIPMAP_HINT, "GL_GENERATE_MIPMAP_HINT" },
{ GL_LINE_WIDTH, "GL_LINE_WIDTH" },
+ { GL_PACK_ALIGNMENT, "GL_PACK_ALIGNMENT" },
+ { GL_UNPACK_ALIGNMENT, "GL_UNPACK_ALIGNMENT" },
{ GL_POLYGON_OFFSET_FACTOR, "GL_POLYGON_OFFSET_FACTOR" },
{ GL_POLYGON_OFFSET_UNITS, "GL_POLYGON_OFFSET_UNITS" },
{ GL_SAMPLE_COVERAGE_VALUE, "GL_SAMPLE_COVERAGE_VALUE" },
diff --git a/gpu/command_buffer/service/context_state.cc b/gpu/command_buffer/service/context_state.cc
index 7c09786..e8912cf 100644
--- a/gpu/command_buffer/service/context_state.cc
+++ b/gpu/command_buffer/service/context_state.cc
@@ -36,9 +36,7 @@ TextureUnit::~TextureUnit() {
}
ContextState::ContextState(FeatureInfo* feature_info, Logger* logger)
- : pack_alignment(4),
- unpack_alignment(4),
- active_texture_unit(0),
+ : active_texture_unit(0),
pack_reverse_row_order(false),
fbo_binding_for_scissor_workaround_dirty_(false),
feature_info_(feature_info),
@@ -139,9 +137,6 @@ void ContextState::RestoreAttribute(GLuint attrib_index) const {
void ContextState::RestoreGlobalState() const {
InitCapabilities();
InitState();
-
- glPixelStorei(GL_PACK_ALIGNMENT, pack_alignment);
- glPixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment);
}
void ContextState::RestoreState() const {
diff --git a/gpu/command_buffer/service/context_state.h b/gpu/command_buffer/service/context_state.h
index 14a6d41..4e5b2da 100644
--- a/gpu/command_buffer/service/context_state.h
+++ b/gpu/command_buffer/service/context_state.h
@@ -124,12 +124,6 @@ struct GPU_EXPORT ContextState {
EnableFlags enable_flags;
- // pack alignment as last set by glPixelStorei
- GLint pack_alignment;
-
- // unpack alignment as last set by glPixelStorei
- GLint unpack_alignment;
-
// Current active texture by 0 - n index.
// In other words, if we call glActiveTexture(GL_TEXTURE2) this value would
// be 2.
diff --git a/gpu/command_buffer/service/context_state_autogen.h b/gpu/command_buffer/service/context_state_autogen.h
index ea9cce1..a76aabc 100644
--- a/gpu/command_buffer/service/context_state_autogen.h
+++ b/gpu/command_buffer/service/context_state_autogen.h
@@ -52,6 +52,8 @@ GLenum front_face;
GLenum hint_generate_mipmap;
GLenum hint_fragment_shader_derivative;
GLfloat line_width;
+GLint pack_alignment;
+GLint unpack_alignment;
GLfloat polygon_offset_factor;
GLfloat polygon_offset_units;
GLclampf sample_coverage_value;
diff --git a/gpu/command_buffer/service/context_state_impl_autogen.h b/gpu/command_buffer/service/context_state_impl_autogen.h
index bd71bdd..65bc118 100644
--- a/gpu/command_buffer/service/context_state_impl_autogen.h
+++ b/gpu/command_buffer/service/context_state_impl_autogen.h
@@ -52,6 +52,8 @@ void ContextState::Initialize() {
hint_generate_mipmap = GL_DONT_CARE;
hint_fragment_shader_derivative = GL_DONT_CARE;
line_width = 1.0f;
+ pack_alignment = 4;
+ unpack_alignment = 4;
polygon_offset_factor = 0.0f;
polygon_offset_units = 0.0f;
sample_coverage_value = 1.0f;
@@ -115,6 +117,8 @@ void ContextState::InitState() const {
glHint(
GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES, hint_fragment_shader_derivative);
glLineWidth(line_width);
+ glPixelStorei(GL_PACK_ALIGNMENT, pack_alignment);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment);
glPolygonOffset(polygon_offset_factor, polygon_offset_units);
glSampleCoverage(sample_coverage_value, sample_coverage_invert);
glScissor(scissor_x, scissor_y, scissor_width, scissor_height);
@@ -161,13 +165,25 @@ bool ContextState::GetEnabled(GLenum cap) const {
bool ContextState::GetStateAsGLint(
GLenum pname, GLint* params, GLsizei* num_written) const {
switch (pname) {
- case GL_VIEWPORT:
+ case GL_BLEND_COLOR:
*num_written = 4;
if (params) {
- params[0] = static_cast<GLint>(viewport_x);
- params[1] = static_cast<GLint>(viewport_y);
- params[2] = static_cast<GLint>(viewport_width);
- params[3] = static_cast<GLint>(viewport_height);
+ params[0] = static_cast<GLint>(blend_color_red);
+ params[1] = static_cast<GLint>(blend_color_green);
+ params[2] = static_cast<GLint>(blend_color_blue);
+ params[3] = static_cast<GLint>(blend_color_alpha);
+ }
+ return true;
+ case GL_BLEND_EQUATION_RGB:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(blend_equation_rgb);
+ }
+ return true;
+ case GL_BLEND_EQUATION_ALPHA:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(blend_equation_alpha);
}
return true;
case GL_BLEND_SRC_RGB:
@@ -194,37 +210,25 @@ bool ContextState::GetStateAsGLint(
params[0] = static_cast<GLint>(blend_dest_alpha);
}
return true;
- case GL_LINE_WIDTH:
- *num_written = 1;
- if (params) {
- params[0] = static_cast<GLint>(line_width);
- }
- return true;
- case GL_BLEND_COLOR:
+ case GL_COLOR_CLEAR_VALUE:
*num_written = 4;
if (params) {
- params[0] = static_cast<GLint>(blend_color_red);
- params[1] = static_cast<GLint>(blend_color_green);
- params[2] = static_cast<GLint>(blend_color_blue);
- params[3] = static_cast<GLint>(blend_color_alpha);
- }
- return true;
- case GL_STENCIL_CLEAR_VALUE:
- *num_written = 1;
- if (params) {
- params[0] = static_cast<GLint>(stencil_clear);
+ params[0] = static_cast<GLint>(color_clear_red);
+ params[1] = static_cast<GLint>(color_clear_green);
+ params[2] = static_cast<GLint>(color_clear_blue);
+ params[3] = static_cast<GLint>(color_clear_alpha);
}
return true;
- case GL_GENERATE_MIPMAP_HINT:
+ case GL_DEPTH_CLEAR_VALUE:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLint>(hint_generate_mipmap);
+ params[0] = static_cast<GLint>(depth_clear);
}
return true;
- case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
+ case GL_STENCIL_CLEAR_VALUE:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLint>(hint_fragment_shader_derivative);
+ params[0] = static_cast<GLint>(stencil_clear);
}
return true;
case GL_COLOR_WRITEMASK:
@@ -236,89 +240,65 @@ bool ContextState::GetStateAsGLint(
params[3] = static_cast<GLint>(color_mask_alpha);
}
return true;
- case GL_COLOR_CLEAR_VALUE:
- *num_written = 4;
- if (params) {
- params[0] = static_cast<GLint>(color_clear_red);
- params[1] = static_cast<GLint>(color_clear_green);
- params[2] = static_cast<GLint>(color_clear_blue);
- params[3] = static_cast<GLint>(color_clear_alpha);
- }
- return true;
- case GL_DEPTH_RANGE:
- *num_written = 2;
- if (params) {
- params[0] = static_cast<GLint>(z_near);
- params[1] = static_cast<GLint>(z_far);
- }
- return true;
- case GL_DEPTH_CLEAR_VALUE:
+ case GL_CULL_FACE_MODE:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLint>(depth_clear);
+ params[0] = static_cast<GLint>(cull_mode);
}
return true;
- case GL_STENCIL_FAIL:
+ case GL_DEPTH_FUNC:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLint>(stencil_front_fail_op);
+ params[0] = static_cast<GLint>(depth_func);
}
return true;
- case GL_STENCIL_PASS_DEPTH_FAIL:
+ case GL_DEPTH_WRITEMASK:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLint>(stencil_front_z_fail_op);
+ params[0] = static_cast<GLint>(depth_mask);
}
return true;
- case GL_STENCIL_PASS_DEPTH_PASS:
- *num_written = 1;
+ case GL_DEPTH_RANGE:
+ *num_written = 2;
if (params) {
- params[0] = static_cast<GLint>(stencil_front_z_pass_op);
+ params[0] = static_cast<GLint>(z_near);
+ params[1] = static_cast<GLint>(z_far);
}
return true;
- case GL_STENCIL_BACK_FAIL:
+ case GL_FRONT_FACE:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLint>(stencil_back_fail_op);
+ params[0] = static_cast<GLint>(front_face);
}
return true;
- case GL_STENCIL_BACK_PASS_DEPTH_FAIL:
+ case GL_GENERATE_MIPMAP_HINT:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLint>(stencil_back_z_fail_op);
+ params[0] = static_cast<GLint>(hint_generate_mipmap);
}
return true;
- case GL_STENCIL_BACK_PASS_DEPTH_PASS:
+ case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLint>(stencil_back_z_pass_op);
- }
- return true;
- case GL_SCISSOR_BOX:
- *num_written = 4;
- if (params) {
- params[0] = static_cast<GLint>(scissor_x);
- params[1] = static_cast<GLint>(scissor_y);
- params[2] = static_cast<GLint>(scissor_width);
- params[3] = static_cast<GLint>(scissor_height);
+ params[0] = static_cast<GLint>(hint_fragment_shader_derivative);
}
return true;
- case GL_FRONT_FACE:
+ case GL_LINE_WIDTH:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLint>(front_face);
+ params[0] = static_cast<GLint>(line_width);
}
return true;
- case GL_SAMPLE_COVERAGE_VALUE:
+ case GL_PACK_ALIGNMENT:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLint>(sample_coverage_value);
+ params[0] = static_cast<GLint>(pack_alignment);
}
return true;
- case GL_SAMPLE_COVERAGE_INVERT:
+ case GL_UNPACK_ALIGNMENT:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLint>(sample_coverage_invert);
+ params[0] = static_cast<GLint>(unpack_alignment);
}
return true;
case GL_POLYGON_OFFSET_FACTOR:
@@ -333,16 +313,25 @@ bool ContextState::GetStateAsGLint(
params[0] = static_cast<GLint>(polygon_offset_units);
}
return true;
- case GL_CULL_FACE_MODE:
+ case GL_SAMPLE_COVERAGE_VALUE:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLint>(cull_mode);
+ params[0] = static_cast<GLint>(sample_coverage_value);
}
return true;
- case GL_DEPTH_FUNC:
+ case GL_SAMPLE_COVERAGE_INVERT:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLint>(depth_func);
+ params[0] = static_cast<GLint>(sample_coverage_invert);
+ }
+ return true;
+ case GL_SCISSOR_BOX:
+ *num_written = 4;
+ if (params) {
+ params[0] = static_cast<GLint>(scissor_x);
+ params[1] = static_cast<GLint>(scissor_y);
+ params[2] = static_cast<GLint>(scissor_width);
+ params[3] = static_cast<GLint>(scissor_height);
}
return true;
case GL_STENCIL_FUNC:
@@ -381,34 +370,61 @@ bool ContextState::GetStateAsGLint(
params[0] = static_cast<GLint>(stencil_back_mask);
}
return true;
- case GL_DEPTH_WRITEMASK:
+ case GL_STENCIL_WRITEMASK:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLint>(depth_mask);
+ params[0] = static_cast<GLint>(stencil_front_writemask);
}
return true;
- case GL_BLEND_EQUATION_RGB:
+ case GL_STENCIL_BACK_WRITEMASK:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLint>(blend_equation_rgb);
+ params[0] = static_cast<GLint>(stencil_back_writemask);
}
return true;
- case GL_BLEND_EQUATION_ALPHA:
+ case GL_STENCIL_FAIL:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLint>(blend_equation_alpha);
+ params[0] = static_cast<GLint>(stencil_front_fail_op);
}
return true;
- case GL_STENCIL_WRITEMASK:
+ case GL_STENCIL_PASS_DEPTH_FAIL:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLint>(stencil_front_writemask);
+ params[0] = static_cast<GLint>(stencil_front_z_fail_op);
}
return true;
- case GL_STENCIL_BACK_WRITEMASK:
+ case GL_STENCIL_PASS_DEPTH_PASS:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLint>(stencil_back_writemask);
+ params[0] = static_cast<GLint>(stencil_front_z_pass_op);
+ }
+ return true;
+ case GL_STENCIL_BACK_FAIL:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(stencil_back_fail_op);
+ }
+ return true;
+ case GL_STENCIL_BACK_PASS_DEPTH_FAIL:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(stencil_back_z_fail_op);
+ }
+ return true;
+ case GL_STENCIL_BACK_PASS_DEPTH_PASS:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLint>(stencil_back_z_pass_op);
+ }
+ return true;
+ case GL_VIEWPORT:
+ *num_written = 4;
+ if (params) {
+ params[0] = static_cast<GLint>(viewport_x);
+ params[1] = static_cast<GLint>(viewport_y);
+ params[2] = static_cast<GLint>(viewport_width);
+ params[3] = static_cast<GLint>(viewport_height);
}
return true;
case GL_BLEND:
@@ -473,13 +489,25 @@ bool ContextState::GetStateAsGLint(
bool ContextState::GetStateAsGLfloat(
GLenum pname, GLfloat* params, GLsizei* num_written) const {
switch (pname) {
- case GL_VIEWPORT:
+ case GL_BLEND_COLOR:
*num_written = 4;
if (params) {
- params[0] = static_cast<GLfloat>(viewport_x);
- params[1] = static_cast<GLfloat>(viewport_y);
- params[2] = static_cast<GLfloat>(viewport_width);
- params[3] = static_cast<GLfloat>(viewport_height);
+ params[0] = static_cast<GLfloat>(blend_color_red);
+ params[1] = static_cast<GLfloat>(blend_color_green);
+ params[2] = static_cast<GLfloat>(blend_color_blue);
+ params[3] = static_cast<GLfloat>(blend_color_alpha);
+ }
+ return true;
+ case GL_BLEND_EQUATION_RGB:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(blend_equation_rgb);
+ }
+ return true;
+ case GL_BLEND_EQUATION_ALPHA:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(blend_equation_alpha);
}
return true;
case GL_BLEND_SRC_RGB:
@@ -506,37 +534,25 @@ bool ContextState::GetStateAsGLfloat(
params[0] = static_cast<GLfloat>(blend_dest_alpha);
}
return true;
- case GL_LINE_WIDTH:
- *num_written = 1;
- if (params) {
- params[0] = static_cast<GLfloat>(line_width);
- }
- return true;
- case GL_BLEND_COLOR:
+ case GL_COLOR_CLEAR_VALUE:
*num_written = 4;
if (params) {
- params[0] = static_cast<GLfloat>(blend_color_red);
- params[1] = static_cast<GLfloat>(blend_color_green);
- params[2] = static_cast<GLfloat>(blend_color_blue);
- params[3] = static_cast<GLfloat>(blend_color_alpha);
- }
- return true;
- case GL_STENCIL_CLEAR_VALUE:
- *num_written = 1;
- if (params) {
- params[0] = static_cast<GLfloat>(stencil_clear);
+ params[0] = static_cast<GLfloat>(color_clear_red);
+ params[1] = static_cast<GLfloat>(color_clear_green);
+ params[2] = static_cast<GLfloat>(color_clear_blue);
+ params[3] = static_cast<GLfloat>(color_clear_alpha);
}
return true;
- case GL_GENERATE_MIPMAP_HINT:
+ case GL_DEPTH_CLEAR_VALUE:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLfloat>(hint_generate_mipmap);
+ params[0] = static_cast<GLfloat>(depth_clear);
}
return true;
- case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
+ case GL_STENCIL_CLEAR_VALUE:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLfloat>(hint_fragment_shader_derivative);
+ params[0] = static_cast<GLfloat>(stencil_clear);
}
return true;
case GL_COLOR_WRITEMASK:
@@ -548,89 +564,65 @@ bool ContextState::GetStateAsGLfloat(
params[3] = static_cast<GLfloat>(color_mask_alpha);
}
return true;
- case GL_COLOR_CLEAR_VALUE:
- *num_written = 4;
- if (params) {
- params[0] = static_cast<GLfloat>(color_clear_red);
- params[1] = static_cast<GLfloat>(color_clear_green);
- params[2] = static_cast<GLfloat>(color_clear_blue);
- params[3] = static_cast<GLfloat>(color_clear_alpha);
- }
- return true;
- case GL_DEPTH_RANGE:
- *num_written = 2;
- if (params) {
- params[0] = static_cast<GLfloat>(z_near);
- params[1] = static_cast<GLfloat>(z_far);
- }
- return true;
- case GL_DEPTH_CLEAR_VALUE:
+ case GL_CULL_FACE_MODE:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLfloat>(depth_clear);
+ params[0] = static_cast<GLfloat>(cull_mode);
}
return true;
- case GL_STENCIL_FAIL:
+ case GL_DEPTH_FUNC:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLfloat>(stencil_front_fail_op);
+ params[0] = static_cast<GLfloat>(depth_func);
}
return true;
- case GL_STENCIL_PASS_DEPTH_FAIL:
+ case GL_DEPTH_WRITEMASK:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLfloat>(stencil_front_z_fail_op);
+ params[0] = static_cast<GLfloat>(depth_mask);
}
return true;
- case GL_STENCIL_PASS_DEPTH_PASS:
- *num_written = 1;
+ case GL_DEPTH_RANGE:
+ *num_written = 2;
if (params) {
- params[0] = static_cast<GLfloat>(stencil_front_z_pass_op);
+ params[0] = static_cast<GLfloat>(z_near);
+ params[1] = static_cast<GLfloat>(z_far);
}
return true;
- case GL_STENCIL_BACK_FAIL:
+ case GL_FRONT_FACE:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLfloat>(stencil_back_fail_op);
+ params[0] = static_cast<GLfloat>(front_face);
}
return true;
- case GL_STENCIL_BACK_PASS_DEPTH_FAIL:
+ case GL_GENERATE_MIPMAP_HINT:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLfloat>(stencil_back_z_fail_op);
+ params[0] = static_cast<GLfloat>(hint_generate_mipmap);
}
return true;
- case GL_STENCIL_BACK_PASS_DEPTH_PASS:
+ case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLfloat>(stencil_back_z_pass_op);
- }
- return true;
- case GL_SCISSOR_BOX:
- *num_written = 4;
- if (params) {
- params[0] = static_cast<GLfloat>(scissor_x);
- params[1] = static_cast<GLfloat>(scissor_y);
- params[2] = static_cast<GLfloat>(scissor_width);
- params[3] = static_cast<GLfloat>(scissor_height);
+ params[0] = static_cast<GLfloat>(hint_fragment_shader_derivative);
}
return true;
- case GL_FRONT_FACE:
+ case GL_LINE_WIDTH:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLfloat>(front_face);
+ params[0] = static_cast<GLfloat>(line_width);
}
return true;
- case GL_SAMPLE_COVERAGE_VALUE:
+ case GL_PACK_ALIGNMENT:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLfloat>(sample_coverage_value);
+ params[0] = static_cast<GLfloat>(pack_alignment);
}
return true;
- case GL_SAMPLE_COVERAGE_INVERT:
+ case GL_UNPACK_ALIGNMENT:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLfloat>(sample_coverage_invert);
+ params[0] = static_cast<GLfloat>(unpack_alignment);
}
return true;
case GL_POLYGON_OFFSET_FACTOR:
@@ -645,16 +637,25 @@ bool ContextState::GetStateAsGLfloat(
params[0] = static_cast<GLfloat>(polygon_offset_units);
}
return true;
- case GL_CULL_FACE_MODE:
+ case GL_SAMPLE_COVERAGE_VALUE:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLfloat>(cull_mode);
+ params[0] = static_cast<GLfloat>(sample_coverage_value);
}
return true;
- case GL_DEPTH_FUNC:
+ case GL_SAMPLE_COVERAGE_INVERT:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLfloat>(depth_func);
+ params[0] = static_cast<GLfloat>(sample_coverage_invert);
+ }
+ return true;
+ case GL_SCISSOR_BOX:
+ *num_written = 4;
+ if (params) {
+ params[0] = static_cast<GLfloat>(scissor_x);
+ params[1] = static_cast<GLfloat>(scissor_y);
+ params[2] = static_cast<GLfloat>(scissor_width);
+ params[3] = static_cast<GLfloat>(scissor_height);
}
return true;
case GL_STENCIL_FUNC:
@@ -693,34 +694,61 @@ bool ContextState::GetStateAsGLfloat(
params[0] = static_cast<GLfloat>(stencil_back_mask);
}
return true;
- case GL_DEPTH_WRITEMASK:
+ case GL_STENCIL_WRITEMASK:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLfloat>(depth_mask);
+ params[0] = static_cast<GLfloat>(stencil_front_writemask);
}
return true;
- case GL_BLEND_EQUATION_RGB:
+ case GL_STENCIL_BACK_WRITEMASK:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLfloat>(blend_equation_rgb);
+ params[0] = static_cast<GLfloat>(stencil_back_writemask);
}
return true;
- case GL_BLEND_EQUATION_ALPHA:
+ case GL_STENCIL_FAIL:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLfloat>(blend_equation_alpha);
+ params[0] = static_cast<GLfloat>(stencil_front_fail_op);
}
return true;
- case GL_STENCIL_WRITEMASK:
+ case GL_STENCIL_PASS_DEPTH_FAIL:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLfloat>(stencil_front_writemask);
+ params[0] = static_cast<GLfloat>(stencil_front_z_fail_op);
}
return true;
- case GL_STENCIL_BACK_WRITEMASK:
+ case GL_STENCIL_PASS_DEPTH_PASS:
*num_written = 1;
if (params) {
- params[0] = static_cast<GLfloat>(stencil_back_writemask);
+ params[0] = static_cast<GLfloat>(stencil_front_z_pass_op);
+ }
+ return true;
+ case GL_STENCIL_BACK_FAIL:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(stencil_back_fail_op);
+ }
+ return true;
+ case GL_STENCIL_BACK_PASS_DEPTH_FAIL:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(stencil_back_z_fail_op);
+ }
+ return true;
+ case GL_STENCIL_BACK_PASS_DEPTH_PASS:
+ *num_written = 1;
+ if (params) {
+ params[0] = static_cast<GLfloat>(stencil_back_z_pass_op);
+ }
+ return true;
+ case GL_VIEWPORT:
+ *num_written = 4;
+ if (params) {
+ params[0] = static_cast<GLfloat>(viewport_x);
+ params[1] = static_cast<GLfloat>(viewport_y);
+ params[2] = static_cast<GLfloat>(viewport_width);
+ params[3] = static_cast<GLfloat>(viewport_height);
}
return true;
case GL_BLEND:
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 234d8d8..2f1b8c6 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -2450,9 +2450,6 @@ bool GLES2DecoderImpl::Initialize(
state_.InitCapabilities();
state_.InitState();
glActiveTexture(GL_TEXTURE0 + state_.active_texture_unit);
- glHint(GL_GENERATE_MIPMAP_HINT, state_.hint_generate_mipmap);
- glPixelStorei(GL_PACK_ALIGNMENT, state_.pack_alignment);
- glPixelStorei(GL_UNPACK_ALIGNMENT, state_.unpack_alignment);
DoBindBuffer(GL_ARRAY_BUFFER, 0);
DoBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h
index 9f88f1f..ac8a8f20 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h
@@ -65,6 +65,12 @@ void GLES2DecoderTestBase::SetupInitStateExpectations() {
EXPECT_CALL(*gl_, LineWidth(1.0f))
.Times(1)
.RetiresOnSaturation();
+ EXPECT_CALL(*gl_, PixelStorei(GL_PACK_ALIGNMENT, 4))
+ .Times(1)
+ .RetiresOnSaturation();
+ EXPECT_CALL(*gl_, PixelStorei(GL_UNPACK_ALIGNMENT, 4))
+ .Times(1)
+ .RetiresOnSaturation();
EXPECT_CALL(*gl_, PolygonOffset(0.0f, 0.0f))
.Times(1)
.RetiresOnSaturation();
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
index 3b6c2f9..8b743b6 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
@@ -211,15 +211,6 @@ void GLES2DecoderTestBase::InitDecoder(
EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0))
.Times(1)
.RetiresOnSaturation();
- EXPECT_CALL(*gl_, Hint(GL_GENERATE_MIPMAP_HINT, GL_DONT_CARE))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, PixelStorei(GL_PACK_ALIGNMENT, 4))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, PixelStorei(GL_UNPACK_ALIGNMENT, 4))
- .Times(1)
- .RetiresOnSaturation();
EXPECT_CALL(*gl_, BindBuffer(GL_ARRAY_BUFFER, 0))
.Times(1)
diff --git a/gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h b/gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h
index 88d7677..ebe7e07 100644
--- a/gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h
+++ b/gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h
@@ -192,6 +192,8 @@ static GLenum valid_g_l_state_table[] = {
GL_FRONT_FACE,
GL_GENERATE_MIPMAP_HINT,
GL_LINE_WIDTH,
+ GL_PACK_ALIGNMENT,
+ GL_UNPACK_ALIGNMENT,
GL_POLYGON_OFFSET_FACTOR,
GL_POLYGON_OFFSET_UNITS,
GL_SAMPLE_COVERAGE_VALUE,