case PIPE_CAP_FLATSHADE:
case PIPE_CAP_ALPHA_TEST:
case PIPE_CAP_POINT_SIZE_FIXED:
+ case PIPE_CAP_TWO_SIDED_COLOR:
return 1;
default:
* ``PIPE_CAP_ALPHA_TEST``: Driver supports alpha-testing.
* ``PIPE_CAP_POINT_SIZE_FIXED``: Driver supports point-sizes that are fixed,
as opposed to writing gl_PointSize for every point.
+* ``PIPE_CAP_TWO_SIDED_COLOR``: Driver supports two-sided coloring.
.. _pipe_capf:
PIPE_CAP_FLATSHADE,
PIPE_CAP_ALPHA_TEST,
PIPE_CAP_POINT_SIZE_FIXED,
+ PIPE_CAP_TWO_SIDED_COLOR,
};
/**
GL_FIRST_VERTEX_CONVENTION_EXT;
/* _NEW_LIGHT | _NEW_PROGRAM */
- raster->light_twoside = _mesa_vertex_program_two_side_enabled(ctx);
+ if (!st->lower_two_sided_color)
+ raster->light_twoside = _mesa_vertex_program_two_side_enabled(ctx);
/*_NEW_LIGHT | _NEW_BUFFERS */
raster->clamp_vertex_color = !st->clamp_vert_color_in_shader &&
#include "main/imports.h"
#include "main/mtypes.h"
#include "main/framebuffer.h"
+#include "main/state.h"
#include "main/texobj.h"
#include "main/texstate.h"
#include "program/program.h"
if (st->lower_alpha_test && _mesa_is_alpha_test_enabled(st->ctx))
key.lower_alpha_func = st->ctx->Color.AlphaFunc;
+ /* _NEW_LIGHT | _NEW_PROGRAM */
+ key.lower_two_sided_color = st->lower_two_sided_color &&
+ _mesa_vertex_program_two_side_enabled(st->ctx);
+
/* _NEW_FRAG_CLAMP */
key.clamp_color = st->clamp_frag_color_in_shader &&
st->ctx->Color._ClampFragmentColor;
st->dirty |= ST_NEW_RASTERIZER;
if ((new_state & _NEW_LIGHT) &&
- st->lower_flatshade)
+ (st->lower_flatshade || st->lower_two_sided_color))
st->dirty |= ST_NEW_FS_STATE;
if (new_state & _NEW_PROJECTION &&
!screen->get_param(screen, PIPE_CAP_ALPHA_TEST);
st->lower_point_size =
!screen->get_param(screen, PIPE_CAP_POINT_SIZE_FIXED);
+ st->lower_two_sided_color =
+ !screen->get_param(screen, PIPE_CAP_TWO_SIDED_COLOR);
st->has_hw_atomics =
screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT,
!st->lower_alpha_test &&
!st->clamp_frag_color_in_shader &&
!st->clamp_frag_depth_in_shader &&
- !st->force_persample_in_shader;
+ !st->force_persample_in_shader &&
+ !st->lower_two_sided_color;
st->shader_has_one_variant[MESA_SHADER_TESS_CTRL] = st->has_shareable_shaders;
st->shader_has_one_variant[MESA_SHADER_TESS_EVAL] =
boolean lower_flatshade;
boolean lower_alpha_test;
boolean lower_point_size;
+ boolean lower_two_sided_color;
/**
* If a shader can be created when we get its source.
false, alpha_ref_state);
}
+ if (key->lower_two_sided_color)
+ NIR_PASS_V(tgsi.ir.nir, nir_lower_two_sided_color);
+
if (key->persample_shading) {
nir_shader *shader = tgsi.ir.nir;
nir_foreach_variable(var, &shader->inputs)
/** for ARB_depth_clamp */
GLuint lower_depth_clamp:1;
+ /** for OpenGL 1.0 on modern hardware */
+ GLuint lower_two_sided_color:1;
+
/** needed for ATI_fragment_shader */
char texture_targets[MAX_NUM_FRAGMENT_REGISTERS_ATI];