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

Unified Diff: gpu/command_buffer/service/context_state_impl_autogen.h

Issue 458333003: Work around NVIDIA driver issue with glLineWidth(NaN) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 6 years, 4 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/service/context_state.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/context_state_impl_autogen.h
diff --git a/gpu/command_buffer/service/context_state_impl_autogen.h b/gpu/command_buffer/service/context_state_impl_autogen.h
index 056a382d24db13b6734dc6766778fb234aa5c886..ee061b1157bc086633e8cf0b0c344c816d217997 100644
--- a/gpu/command_buffer/service/context_state_impl_autogen.h
+++ b/gpu/command_buffer/service/context_state_impl_autogen.h
@@ -149,52 +149,64 @@ void ContextState::InitState(const ContextState* prev_state) const {
if ((blend_color_red != prev_state->blend_color_red) ||
(blend_color_green != prev_state->blend_color_green) ||
(blend_color_blue != prev_state->blend_color_blue) ||
- (blend_color_alpha != prev_state->blend_color_alpha))
+ (blend_color_alpha != prev_state->blend_color_alpha)) {
glBlendColor(blend_color_red,
blend_color_green,
blend_color_blue,
blend_color_alpha);
+ }
if ((blend_equation_rgb != prev_state->blend_equation_rgb) ||
- (blend_equation_alpha != prev_state->blend_equation_alpha))
+ (blend_equation_alpha != prev_state->blend_equation_alpha)) {
glBlendEquationSeparate(blend_equation_rgb, blend_equation_alpha);
+ }
if ((blend_source_rgb != prev_state->blend_source_rgb) ||
(blend_dest_rgb != prev_state->blend_dest_rgb) ||
(blend_source_alpha != prev_state->blend_source_alpha) ||
- (blend_dest_alpha != prev_state->blend_dest_alpha))
+ (blend_dest_alpha != prev_state->blend_dest_alpha)) {
glBlendFuncSeparate(blend_source_rgb,
blend_dest_rgb,
blend_source_alpha,
blend_dest_alpha);
+ }
if ((color_clear_red != prev_state->color_clear_red) ||
(color_clear_green != prev_state->color_clear_green) ||
(color_clear_blue != prev_state->color_clear_blue) ||
- (color_clear_alpha != prev_state->color_clear_alpha))
+ (color_clear_alpha != prev_state->color_clear_alpha)) {
glClearColor(color_clear_red,
color_clear_green,
color_clear_blue,
color_clear_alpha);
- if ((depth_clear != prev_state->depth_clear))
+ }
+ if ((depth_clear != prev_state->depth_clear)) {
glClearDepth(depth_clear);
- if ((stencil_clear != prev_state->stencil_clear))
+ }
+ if ((stencil_clear != prev_state->stencil_clear)) {
glClearStencil(stencil_clear);
+ }
if ((cached_color_mask_red != prev_state->cached_color_mask_red) ||
(cached_color_mask_green != prev_state->cached_color_mask_green) ||
(cached_color_mask_blue != prev_state->cached_color_mask_blue) ||
- (cached_color_mask_alpha != prev_state->cached_color_mask_alpha))
+ (cached_color_mask_alpha != prev_state->cached_color_mask_alpha)) {
glColorMask(cached_color_mask_red,
cached_color_mask_green,
cached_color_mask_blue,
cached_color_mask_alpha);
- if ((cull_mode != prev_state->cull_mode))
+ }
+ if ((cull_mode != prev_state->cull_mode)) {
glCullFace(cull_mode);
- if ((depth_func != prev_state->depth_func))
+ }
+ if ((depth_func != prev_state->depth_func)) {
glDepthFunc(depth_func);
- if ((cached_depth_mask != prev_state->cached_depth_mask))
+ }
+ if ((cached_depth_mask != prev_state->cached_depth_mask)) {
glDepthMask(cached_depth_mask);
- if ((z_near != prev_state->z_near) || (z_far != prev_state->z_far))
+ }
+ if ((z_near != prev_state->z_near) || (z_far != prev_state->z_far)) {
glDepthRange(z_near, z_far);
- if ((front_face != prev_state->front_face))
+ }
+ if ((front_face != prev_state->front_face)) {
glFrontFace(front_face);
+ }
if (prev_state->hint_generate_mipmap != hint_generate_mipmap)
glHint(GL_GENERATE_MIPMAP_HINT, hint_generate_mipmap);
if (feature_info_->feature_flags().oes_standard_derivatives)
@@ -202,23 +214,30 @@ void ContextState::InitState(const ContextState* prev_state) const {
hint_fragment_shader_derivative)
glHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES,
hint_fragment_shader_derivative);
- if ((line_width != prev_state->line_width))
- glLineWidth(line_width);
+ if ((line_width != prev_state->line_width)) {
+ GLfloat sanitized_line_width = line_width;
+ if (base::IsNaN(line_width))
+ sanitized_line_width = 1.0f;
+ glLineWidth(sanitized_line_width);
+ }
if (prev_state->pack_alignment != pack_alignment)
glPixelStorei(GL_PACK_ALIGNMENT, pack_alignment);
if (prev_state->unpack_alignment != unpack_alignment)
glPixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment);
if ((polygon_offset_factor != prev_state->polygon_offset_factor) ||
- (polygon_offset_units != prev_state->polygon_offset_units))
+ (polygon_offset_units != prev_state->polygon_offset_units)) {
glPolygonOffset(polygon_offset_factor, polygon_offset_units);
+ }
if ((sample_coverage_value != prev_state->sample_coverage_value) ||
- (sample_coverage_invert != prev_state->sample_coverage_invert))
+ (sample_coverage_invert != prev_state->sample_coverage_invert)) {
glSampleCoverage(sample_coverage_value, sample_coverage_invert);
+ }
if ((scissor_x != prev_state->scissor_x) ||
(scissor_y != prev_state->scissor_y) ||
(scissor_width != prev_state->scissor_width) ||
- (scissor_height != prev_state->scissor_height))
+ (scissor_height != prev_state->scissor_height)) {
glScissor(scissor_x, scissor_y, scissor_width, scissor_height);
+ }
if ((stencil_front_func != prev_state->stencil_front_func) ||
(stencil_front_ref != prev_state->stencil_front_ref) ||
(stencil_front_mask != prev_state->stencil_front_mask))
@@ -252,8 +271,9 @@ void ContextState::InitState(const ContextState* prev_state) const {
if ((viewport_x != prev_state->viewport_x) ||
(viewport_y != prev_state->viewport_y) ||
(viewport_width != prev_state->viewport_width) ||
- (viewport_height != prev_state->viewport_height))
+ (viewport_height != prev_state->viewport_height)) {
glViewport(viewport_x, viewport_y, viewport_width, viewport_height);
+ }
} else {
glBlendColor(blend_color_red,
blend_color_green,
@@ -281,7 +301,10 @@ void ContextState::InitState(const ContextState* prev_state) const {
if (feature_info_->feature_flags().oes_standard_derivatives)
glHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES,
hint_fragment_shader_derivative);
- glLineWidth(line_width);
+ GLfloat sanitized_line_width = line_width;
+ if (base::IsNaN(line_width))
+ sanitized_line_width = 1.0f;
+ glLineWidth(sanitized_line_width);
glPixelStorei(GL_PACK_ALIGNMENT, pack_alignment);
glPixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment);
glPolygonOffset(polygon_offset_factor, polygon_offset_units);
« no previous file with comments | « gpu/command_buffer/service/context_state.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698