mesa: use bitset for driver states tracker
We are going to add 16 mesh shader states, but existing states run out of all bits of uint64_t. So use bitset to extend the capacity. Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36976>
This commit is contained in:
@@ -48,18 +48,15 @@
|
||||
static void
|
||||
flush_vertices_for_program_constants(struct gl_context *ctx, GLenum target)
|
||||
{
|
||||
uint64_t new_driver_state;
|
||||
unsigned stage = target == GL_FRAGMENT_PROGRAM_ARB ?
|
||||
MESA_SHADER_FRAGMENT : MESA_SHADER_VERTEX;
|
||||
|
||||
if (target == GL_FRAGMENT_PROGRAM_ARB) {
|
||||
new_driver_state =
|
||||
ctx->DriverFlags.NewShaderConstants[MESA_SHADER_FRAGMENT];
|
||||
} else {
|
||||
new_driver_state =
|
||||
ctx->DriverFlags.NewShaderConstants[MESA_SHADER_VERTEX];
|
||||
}
|
||||
GLbitfield new_state =
|
||||
BITSET_IS_EMPTY(ctx->DriverFlags.NewShaderConstants[stage]) ?
|
||||
_NEW_PROGRAM_CONSTANTS : 0;
|
||||
|
||||
FLUSH_VERTICES(ctx, new_driver_state ? 0 : _NEW_PROGRAM_CONSTANTS, 0);
|
||||
ctx->NewDriverState |= new_driver_state;
|
||||
FLUSH_VERTICES(ctx, new_state, 0);
|
||||
ST_SET_STATES(ctx->NewDriverState, ctx->DriverFlags.NewShaderConstants[stage]);
|
||||
}
|
||||
|
||||
static struct gl_program*
|
||||
|
||||
@@ -851,7 +851,7 @@ _mesa_SetFragmentShaderConstantATI(GLuint dst, const GLfloat * value)
|
||||
}
|
||||
else {
|
||||
FLUSH_VERTICES(ctx, 0, 0);
|
||||
ctx->NewDriverState |= ST_NEW_FS_CONSTANTS;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_FS_CONSTANTS);
|
||||
COPY_4V(ctx->ATIFragmentShader.GlobalConstants[dstindex], value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -976,7 +976,7 @@ _mesa_PopAttrib(void)
|
||||
if (mask & GL_POLYGON_STIPPLE_BIT) {
|
||||
memcpy(ctx->PolygonStipple, attr->PolygonStipple, 32*sizeof(GLuint));
|
||||
|
||||
ctx->NewDriverState |= ST_NEW_POLY_STIPPLE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_POLY_STIPPLE);
|
||||
}
|
||||
|
||||
if (mask & GL_SCISSOR_BIT) {
|
||||
@@ -1037,7 +1037,7 @@ _mesa_PopAttrib(void)
|
||||
_math_matrix_analyse(ctx->ProjectionMatrixStack.Top);
|
||||
|
||||
ctx->NewState |= _NEW_TRANSFORM;
|
||||
ctx->NewDriverState |= ST_NEW_CLIP_STATE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_CLIP_STATE);
|
||||
|
||||
/* restore clip planes */
|
||||
for (i = 0; i < ctx->Const.MaxClipPlanes; i++) {
|
||||
@@ -1088,7 +1088,7 @@ _mesa_PopAttrib(void)
|
||||
|
||||
if (memcmp(&ctx->ViewportArray[i].X, &vp->X, sizeof(float) * 6)) {
|
||||
ctx->NewState |= _NEW_VIEWPORT;
|
||||
ctx->NewDriverState |= ST_NEW_VIEWPORT;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_VIEWPORT);
|
||||
|
||||
memcpy(&ctx->ViewportArray[i].X, &vp->X, sizeof(float) * 6);
|
||||
|
||||
|
||||
@@ -241,7 +241,7 @@ blend_func_separate(struct gl_context *ctx,
|
||||
GLenum sfactorA, GLenum dfactorA)
|
||||
{
|
||||
FLUSH_VERTICES(ctx, 0, GL_COLOR_BUFFER_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_BLEND;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_BLEND);
|
||||
|
||||
const unsigned numBuffers = num_buffers(ctx);
|
||||
for (unsigned buf = 0; buf < numBuffers; buf++) {
|
||||
@@ -402,7 +402,7 @@ blend_func_separatei(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB,
|
||||
}
|
||||
|
||||
FLUSH_VERTICES(ctx, 0, GL_COLOR_BUFFER_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_BLEND;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_BLEND);
|
||||
|
||||
ctx->Color.Blend[buf].SrcRGB = sfactorRGB;
|
||||
ctx->Color.Blend[buf].DstRGB = dfactorRGB;
|
||||
@@ -808,7 +808,7 @@ _mesa_BlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, 0, GL_COLOR_BUFFER_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_BLEND_COLOR;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_BLEND_COLOR);
|
||||
COPY_4FV( ctx->Color.BlendColorUnclamped, tmp );
|
||||
|
||||
ctx->Color.BlendColor[0] = CLAMP(tmp[0], 0.0F, 1.0F);
|
||||
@@ -850,7 +850,7 @@ _mesa_AlphaFunc( GLenum func, GLclampf ref )
|
||||
case GL_GEQUAL:
|
||||
case GL_ALWAYS:
|
||||
FLUSH_VERTICES(ctx, 0, GL_COLOR_BUFFER_BIT);
|
||||
ctx->NewDriverState |= ctx->DriverFlags.NewAlphaTest;
|
||||
ST_SET_STATES(ctx->NewDriverState, ctx->DriverFlags.NewAlphaTest);
|
||||
ctx->Color.AlphaFunc = func;
|
||||
ctx->Color.AlphaRefUnclamped = ref;
|
||||
ctx->Color.AlphaRef = CLAMP(ref, 0.0F, 1.0F);
|
||||
@@ -913,7 +913,7 @@ logic_op(struct gl_context *ctx, GLenum opcode, bool no_error)
|
||||
}
|
||||
|
||||
FLUSH_VERTICES(ctx, 0, GL_COLOR_BUFFER_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_BLEND;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_BLEND);
|
||||
ctx->Color.LogicOp = opcode;
|
||||
ctx->Color._LogicOp = color_logicop_mapping[opcode & 0x0f];
|
||||
_mesa_update_allow_draw_out_of_order(ctx);
|
||||
@@ -959,7 +959,7 @@ _mesa_IndexMask( GLuint mask )
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, 0, GL_COLOR_BUFFER_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_BLEND;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_BLEND);
|
||||
ctx->Color.IndexMask = mask;
|
||||
}
|
||||
|
||||
@@ -998,7 +998,7 @@ _mesa_ColorMask( GLboolean red, GLboolean green,
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, 0, GL_COLOR_BUFFER_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_BLEND;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_BLEND);
|
||||
ctx->Color.ColorMask = mask;
|
||||
_mesa_update_allow_draw_out_of_order(ctx);
|
||||
}
|
||||
@@ -1031,7 +1031,7 @@ _mesa_ColorMaski(GLuint buf, GLboolean red, GLboolean green,
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, 0, GL_COLOR_BUFFER_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_BLEND;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_BLEND);
|
||||
ctx->Color.ColorMask &= ~(0xfu << (4 * buf));
|
||||
ctx->Color.ColorMask |= mask << (4 * buf);
|
||||
_mesa_update_allow_draw_out_of_order(ctx);
|
||||
@@ -1145,7 +1145,7 @@ _mesa_update_clamp_fragment_color(struct gl_context *ctx,
|
||||
return;
|
||||
|
||||
ctx->NewState |= _NEW_FRAG_CLAMP; /* for state constants */
|
||||
ctx->NewDriverState |= ctx->DriverFlags.NewFragClamp;
|
||||
ST_SET_STATES(ctx->NewDriverState, ctx->DriverFlags.NewFragClamp);
|
||||
ctx->Color._ClampFragmentColor = clamp;
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ static inline void
|
||||
_mesa_flush_vertices_for_blend_state(struct gl_context *ctx)
|
||||
{
|
||||
FLUSH_VERTICES(ctx, 0, GL_COLOR_BUFFER_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_BLEND;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_BLEND);
|
||||
}
|
||||
|
||||
static inline void
|
||||
@@ -101,7 +101,7 @@ _mesa_flush_vertices_for_blend_adv(struct gl_context *ctx,
|
||||
_mesa_advanded_blend_sh_constant_changed(ctx, new_blend_enabled,
|
||||
new_mode)) {
|
||||
FLUSH_VERTICES(ctx, _NEW_COLOR, GL_COLOR_BUFFER_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_BLEND;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_BLEND);
|
||||
return;
|
||||
}
|
||||
_mesa_flush_vertices_for_blend_state(ctx);
|
||||
|
||||
+25
-14
@@ -387,15 +387,17 @@ bufferobj_data(struct gl_context *ctx,
|
||||
* might be using it.
|
||||
*/
|
||||
if (obj->UsageHistory & USAGE_ARRAY_BUFFER)
|
||||
ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_VERTEX_ARRAYS);
|
||||
if (obj->UsageHistory & USAGE_UNIFORM_BUFFER)
|
||||
ctx->NewDriverState |= ST_NEW_UNIFORM_BUFFER;
|
||||
ST_SET_SHADER_STATES(ctx->NewDriverState, UBOS);
|
||||
if (obj->UsageHistory & USAGE_SHADER_STORAGE_BUFFER)
|
||||
ctx->NewDriverState |= ST_NEW_STORAGE_BUFFER;
|
||||
if (obj->UsageHistory & USAGE_TEXTURE_BUFFER)
|
||||
ctx->NewDriverState |= ST_NEW_SAMPLER_VIEWS | ST_NEW_IMAGE_UNITS;
|
||||
ST_SET_SHADER_STATES(ctx->NewDriverState, SSBOS);
|
||||
if (obj->UsageHistory & USAGE_TEXTURE_BUFFER) {
|
||||
ST_SET_SHADER_STATES(ctx->NewDriverState, SAMPLER_VIEWS);
|
||||
ST_SET_SHADER_STATES(ctx->NewDriverState, IMAGES);
|
||||
}
|
||||
if (obj->UsageHistory & USAGE_ATOMIC_COUNTER_BUFFER)
|
||||
ctx->NewDriverState |= ctx->DriverFlags.NewAtomicBuffer;
|
||||
ST_SET_STATES(ctx->NewDriverState, ctx->DriverFlags.NewAtomicBuffer);
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
@@ -1609,7 +1611,6 @@ bind_buffer(struct gl_context *ctx,
|
||||
GLintptr offset,
|
||||
GLsizeiptr size,
|
||||
GLboolean autoSize,
|
||||
uint64_t driver_state,
|
||||
gl_buffer_usage usage)
|
||||
{
|
||||
if (binding->BufferObject == bufObj &&
|
||||
@@ -1620,7 +1621,20 @@ bind_buffer(struct gl_context *ctx,
|
||||
}
|
||||
|
||||
FLUSH_VERTICES(ctx, 0, 0);
|
||||
ctx->NewDriverState |= driver_state;
|
||||
|
||||
switch (usage) {
|
||||
case USAGE_UNIFORM_BUFFER:
|
||||
ST_SET_SHADER_STATES(ctx->NewDriverState, UBOS);
|
||||
break;
|
||||
case USAGE_SHADER_STORAGE_BUFFER:
|
||||
ST_SET_SHADER_STATES(ctx->NewDriverState, SSBOS);
|
||||
break;
|
||||
case USAGE_ATOMIC_COUNTER_BUFFER:
|
||||
ST_SET_STATES(ctx->NewDriverState, ctx->DriverFlags.NewAtomicBuffer);
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("invalid usage");
|
||||
}
|
||||
|
||||
set_buffer_binding(ctx, binding, bufObj, offset, size, autoSize, usage);
|
||||
}
|
||||
@@ -1642,7 +1656,6 @@ bind_uniform_buffer(struct gl_context *ctx,
|
||||
{
|
||||
bind_buffer(ctx, &ctx->UniformBufferBindings[index],
|
||||
bufObj, offset, size, autoSize,
|
||||
ST_NEW_UNIFORM_BUFFER,
|
||||
USAGE_UNIFORM_BUFFER);
|
||||
}
|
||||
|
||||
@@ -1663,7 +1676,6 @@ bind_shader_storage_buffer(struct gl_context *ctx,
|
||||
{
|
||||
bind_buffer(ctx, &ctx->ShaderStorageBufferBindings[index],
|
||||
bufObj, offset, size, autoSize,
|
||||
ST_NEW_STORAGE_BUFFER,
|
||||
USAGE_SHADER_STORAGE_BUFFER);
|
||||
}
|
||||
|
||||
@@ -1681,7 +1693,6 @@ bind_atomic_buffer(struct gl_context *ctx, unsigned index,
|
||||
{
|
||||
bind_buffer(ctx, &ctx->AtomicBufferBindings[index],
|
||||
bufObj, offset, size, autoSize,
|
||||
ctx->DriverFlags.NewAtomicBuffer,
|
||||
USAGE_ATOMIC_COUNTER_BUFFER);
|
||||
}
|
||||
|
||||
@@ -4348,7 +4359,7 @@ bind_uniform_buffers(struct gl_context *ctx, GLuint first, GLsizei count,
|
||||
|
||||
/* Assume that at least one binding will be changed */
|
||||
FLUSH_VERTICES(ctx, 0, 0);
|
||||
ctx->NewDriverState |= ST_NEW_UNIFORM_BUFFER;
|
||||
ST_SET_SHADER_STATES(ctx->NewDriverState, UBOS);
|
||||
|
||||
if (!buffers) {
|
||||
/* The ARB_multi_bind spec says:
|
||||
@@ -4451,7 +4462,7 @@ bind_shader_storage_buffers(struct gl_context *ctx, GLuint first,
|
||||
|
||||
/* Assume that at least one binding will be changed */
|
||||
FLUSH_VERTICES(ctx, 0, 0);
|
||||
ctx->NewDriverState |= ST_NEW_STORAGE_BUFFER;
|
||||
ST_SET_SHADER_STATES(ctx->NewDriverState, SSBOS);
|
||||
|
||||
if (!buffers) {
|
||||
/* The ARB_multi_bind spec says:
|
||||
@@ -4779,7 +4790,7 @@ bind_atomic_buffers(struct gl_context *ctx,
|
||||
|
||||
/* Assume that at least one binding will be changed */
|
||||
FLUSH_VERTICES(ctx, 0, 0);
|
||||
ctx->NewDriverState |= ctx->DriverFlags.NewAtomicBuffer;
|
||||
ST_SET_STATES(ctx->NewDriverState, ctx->DriverFlags.NewAtomicBuffer);
|
||||
|
||||
if (!buffers) {
|
||||
/* The ARB_multi_bind spec says:
|
||||
|
||||
@@ -983,7 +983,9 @@ read_buffer(struct gl_context *ctx, struct gl_framebuffer *fb,
|
||||
/* add the buffer */
|
||||
st_manager_add_color_renderbuffer(ctx, fb, fb->_ColorReadBufferIndex);
|
||||
_mesa_update_state(ctx);
|
||||
st_validate_state(st_context(ctx), ST_PIPELINE_UPDATE_FB_STATE_MASK);
|
||||
|
||||
ST_PIPELINE_UPDATE_FB_STATE_MASK(mask);
|
||||
st_validate_state(st_context(ctx), mask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ _mesa_ClipPlane( GLenum plane, const GLdouble *eq )
|
||||
|
||||
/* EyeUserPlane is used by program state constants. */
|
||||
FLUSH_VERTICES(ctx, _NEW_TRANSFORM, GL_TRANSFORM_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_CLIP_STATE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_CLIP_STATE);
|
||||
COPY_4FV(ctx->Transform.EyeUserPlane[p], equation);
|
||||
|
||||
if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
|
||||
|
||||
@@ -295,7 +295,8 @@ prepare_compute(struct gl_context *ctx)
|
||||
if (ctx->NewState)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
st_validate_state(st, ST_PIPELINE_COMPUTE_STATE_MASK);
|
||||
ST_PIPELINE_COMPUTE_STATE_MASK(mask);
|
||||
st_validate_state(st, mask);
|
||||
st_context_add_work(st);
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ conservative_raster_parameter(GLenum pname, GLfloat param,
|
||||
}
|
||||
|
||||
FLUSH_VERTICES(ctx, 0, 0);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
|
||||
ctx->ConservativeRasterDilate =
|
||||
CLAMP(param,
|
||||
@@ -83,7 +83,7 @@ conservative_raster_parameter(GLenum pname, GLfloat param,
|
||||
}
|
||||
|
||||
FLUSH_VERTICES(ctx, 0, 0);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->ConservativeRasterMode = param;
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -697,7 +697,7 @@ init_attrib_groups(struct gl_context *ctx)
|
||||
ctx->TileRasterOrderIncreasingX = GL_TRUE;
|
||||
ctx->TileRasterOrderIncreasingY = GL_TRUE;
|
||||
ctx->NewState = _NEW_ALL;
|
||||
ctx->NewDriverState = ST_ALL_STATES_MASK;
|
||||
ST_SET_ALL_STATES(ctx->NewDriverState);
|
||||
ctx->ErrorValue = GL_NO_ERROR;
|
||||
ctx->ShareGroupReset = false;
|
||||
ctx->IntelBlackholeRender = debug_get_bool_option("INTEL_BLACKHOLE_DEFAULT", false);
|
||||
@@ -1255,7 +1255,7 @@ _mesa_copy_context( const struct gl_context *src, struct gl_context *dst,
|
||||
/* XXX FIXME: Call callbacks?
|
||||
*/
|
||||
dst->NewState = _NEW_ALL;
|
||||
dst->NewDriverState = ST_ALL_STATES_MASK;
|
||||
ST_SET_ALL_STATES(dst->NewDriverState);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ depth_func(struct gl_context *ctx, GLenum func, bool no_error)
|
||||
}
|
||||
|
||||
FLUSH_VERTICES(ctx, 0, GL_DEPTH_BUFFER_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_DSA;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_DSA);
|
||||
ctx->Depth.Func = func;
|
||||
_mesa_update_allow_draw_out_of_order(ctx);
|
||||
}
|
||||
@@ -128,7 +128,7 @@ _mesa_DepthMask( GLboolean flag )
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, 0, GL_DEPTH_BUFFER_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_DSA;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_DSA);
|
||||
ctx->Depth.Mask = flag;
|
||||
_mesa_update_allow_draw_out_of_order(ctx);
|
||||
}
|
||||
@@ -158,7 +158,7 @@ _mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax )
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, 0, GL_DEPTH_BUFFER_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_DSA;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_DSA);
|
||||
ctx->Depth.BoundsMin = zmin;
|
||||
ctx->Depth.BoundsMax = zmax;
|
||||
}
|
||||
|
||||
+18
-10
@@ -115,7 +115,7 @@ _mesa_set_draw_vao(struct gl_context *ctx, struct gl_vertex_array_object *vao)
|
||||
if (*ptr != vao) {
|
||||
_mesa_reference_vao_(ctx, ptr, vao);
|
||||
_mesa_update_edgeflag_state_vao(ctx);
|
||||
ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_VERTEX_ARRAYS);
|
||||
ctx->Array.NewVertexElements = true;
|
||||
}
|
||||
}
|
||||
@@ -163,7 +163,7 @@ _mesa_restore_draw_vao(struct gl_context *ctx,
|
||||
ctx->VertexProgram._VPModeInputFilter = saved_vp_input_filter;
|
||||
|
||||
/* Update states. */
|
||||
ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_VERTEX_ARRAYS);
|
||||
ctx->Array.NewVertexElements = true;
|
||||
|
||||
/* Restore original states. */
|
||||
@@ -1173,7 +1173,8 @@ _mesa_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
|
||||
draw.start = start;
|
||||
draw.count = count;
|
||||
|
||||
st_prepare_draw(ctx, ST_PIPELINE_RENDER_STATE_MASK);
|
||||
ST_PIPELINE_RENDER_STATE_MASK(mask);
|
||||
st_prepare_draw(ctx, mask);
|
||||
|
||||
ctx->Driver.DrawGallium(ctx, &info, ctx->DrawID, NULL, &draw, 1);
|
||||
|
||||
@@ -1479,7 +1480,8 @@ _mesa_MultiDrawArrays(GLenum mode, const GLint *first,
|
||||
draw[i].count = count[i];
|
||||
}
|
||||
|
||||
st_prepare_draw(ctx, ST_PIPELINE_RENDER_STATE_MASK);
|
||||
ST_PIPELINE_RENDER_STATE_MASK(mask);
|
||||
st_prepare_draw(ctx, mask);
|
||||
|
||||
ctx->Driver.DrawGallium(ctx, &info, 0, NULL, draw, primcount);
|
||||
|
||||
@@ -1611,7 +1613,8 @@ _mesa_validated_drawrangeelements(struct gl_context *ctx,
|
||||
}
|
||||
}
|
||||
|
||||
st_prepare_draw(ctx, ST_PIPELINE_RENDER_STATE_MASK);
|
||||
ST_PIPELINE_RENDER_STATE_MASK(mask);
|
||||
st_prepare_draw(ctx, mask);
|
||||
|
||||
/* Fast path for a very common DrawElements case:
|
||||
* - there are no user indices here (always true with glthread)
|
||||
@@ -2115,7 +2118,8 @@ _mesa_validated_multidrawelements(struct gl_context *ctx,
|
||||
}
|
||||
}
|
||||
|
||||
st_prepare_draw(ctx, ST_PIPELINE_RENDER_STATE_MASK);
|
||||
ST_PIPELINE_RENDER_STATE_MASK(mask);
|
||||
st_prepare_draw(ctx, mask);
|
||||
if (!validate_index_bounds(ctx, &info, draw, primcount))
|
||||
return;
|
||||
|
||||
@@ -2125,7 +2129,8 @@ _mesa_validated_multidrawelements(struct gl_context *ctx,
|
||||
assert(info.has_user_indices);
|
||||
info.increment_draw_id = false;
|
||||
|
||||
st_prepare_draw(ctx, ST_PIPELINE_RENDER_STATE_MASK);
|
||||
ST_PIPELINE_RENDER_STATE_MASK(mask);
|
||||
st_prepare_draw(ctx, mask);
|
||||
|
||||
for (int i = 0; i < primcount; i++) {
|
||||
struct pipe_draw_start_count_bias draw;
|
||||
@@ -2288,7 +2293,8 @@ _mesa_DrawTransformFeedbackStreamInstanced(GLenum mode, GLuint name,
|
||||
primcount))
|
||||
return;
|
||||
|
||||
st_prepare_draw(ctx, ST_PIPELINE_RENDER_STATE_MASK);
|
||||
ST_PIPELINE_RENDER_STATE_MASK(mask);
|
||||
st_prepare_draw(ctx, mask);
|
||||
|
||||
struct pipe_draw_indirect_info indirect;
|
||||
memset(&indirect, 0, sizeof(indirect));
|
||||
@@ -2455,7 +2461,8 @@ _mesa_MultiDrawArraysIndirect(GLenum mode, const GLvoid *indirect,
|
||||
info.index_bias_varies = false;
|
||||
/* Packed section end. */
|
||||
|
||||
st_prepare_draw(ctx, ST_PIPELINE_RENDER_STATE_MASK);
|
||||
ST_PIPELINE_RENDER_STATE_MASK(mask);
|
||||
st_prepare_draw(ctx, mask);
|
||||
|
||||
const uint8_t *ptr = (const uint8_t *) indirect;
|
||||
for (unsigned i = 0; i < primcount; i++) {
|
||||
@@ -2569,7 +2576,8 @@ _mesa_MultiDrawElementsIndirect(GLenum mode, GLenum type,
|
||||
if (!info.index.resource)
|
||||
return;
|
||||
|
||||
st_prepare_draw(ctx, ST_PIPELINE_RENDER_STATE_MASK);
|
||||
ST_PIPELINE_RENDER_STATE_MASK(mask);
|
||||
st_prepare_draw(ctx, mask);
|
||||
|
||||
const uint8_t *ptr = (const uint8_t *) indirect;
|
||||
for (unsigned i = 0; i < primcount; i++) {
|
||||
|
||||
+43
-44
@@ -130,7 +130,7 @@ client_state(struct gl_context *ctx, struct gl_vertex_array_object* vao,
|
||||
if (ctx->VertexProgram.PointSizeEnabled != state) {
|
||||
FLUSH_VERTICES(ctx, ctx->st->lower_point_size ? _NEW_PROGRAM : 0,
|
||||
0);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->VertexProgram.PointSizeEnabled = state;
|
||||
}
|
||||
vao_state(ctx, vao, VERT_ATTRIB_POINT_SIZE, state);
|
||||
@@ -359,7 +359,7 @@ _mesa_set_multisample(struct gl_context *ctx, GLboolean state)
|
||||
FLUSH_VERTICES(ctx, 0, GL_MULTISAMPLE_BIT | GL_ENABLE_BIT);
|
||||
}
|
||||
|
||||
ctx->NewDriverState |= ctx->DriverFlags.NewMultisampleEnable;
|
||||
ST_SET_STATES(ctx->NewDriverState, ctx->DriverFlags.NewMultisampleEnable);
|
||||
ctx->Multisample.Enabled = state;
|
||||
}
|
||||
|
||||
@@ -376,7 +376,7 @@ _mesa_set_framebuffer_srgb(struct gl_context *ctx, GLboolean state)
|
||||
/* TODO: Switch i965 to the new flag and remove the conditional */
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_FB_STATE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_FB_STATE);
|
||||
ctx->Color.sRGBEnabled = state;
|
||||
}
|
||||
|
||||
@@ -410,7 +410,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
/* AlphaEnabled is used by the fixed-func fragment program */
|
||||
FLUSH_VERTICES(ctx, _NEW_COLOR | _NEW_FF_FRAG_PROGRAM,
|
||||
GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ctx->DriverFlags.NewAlphaTest;
|
||||
ST_SET_STATES(ctx->NewDriverState, ctx->DriverFlags.NewAlphaTest);
|
||||
ctx->Color.AlphaEnabled = state;
|
||||
break;
|
||||
case GL_AUTO_NORMAL:
|
||||
@@ -463,7 +463,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
} else {
|
||||
FLUSH_VERTICES(ctx, 0, GL_TRANSFORM_BIT | GL_ENABLE_BIT);
|
||||
}
|
||||
ctx->NewDriverState |= ctx->DriverFlags.NewClipPlaneEnable;
|
||||
ST_SET_STATES(ctx->NewDriverState, ctx->DriverFlags.NewClipPlaneEnable);
|
||||
|
||||
if (state) {
|
||||
ctx->Transform.ClipPlanesEnabled |= (1 << p);
|
||||
@@ -472,7 +472,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
/* TODO: glEnable might not be the best place to do it. */
|
||||
if (_mesa_is_desktop_gl_compat(ctx) || _mesa_is_gles1(ctx)) {
|
||||
_mesa_update_clip_plane(ctx, p);
|
||||
ctx->NewDriverState |= ST_NEW_CLIP_STATE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_CLIP_STATE);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -499,7 +499,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_POLYGON_BIT | GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->Polygon.CullFlag = state;
|
||||
_mesa_update_edgeflag_state_vao(ctx);
|
||||
break;
|
||||
@@ -508,7 +508,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_DSA;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_DSA);
|
||||
ctx->Depth.Test = state;
|
||||
_mesa_update_allow_draw_out_of_order(ctx);
|
||||
break;
|
||||
@@ -522,7 +522,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_BLEND;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_BLEND);
|
||||
ctx->Color.DitherFlag = state;
|
||||
break;
|
||||
case GL_FOG:
|
||||
@@ -574,7 +574,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_LINE_BIT | GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->Line.SmoothFlag = state;
|
||||
break;
|
||||
case GL_LINE_STIPPLE:
|
||||
@@ -584,7 +584,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_LINE_BIT | GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->Line.StippleFlag = state;
|
||||
break;
|
||||
case GL_INDEX_LOGIC_OP:
|
||||
@@ -594,7 +594,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_BLEND;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_BLEND);
|
||||
ctx->Color.IndexLogicOpEnabled = state;
|
||||
break;
|
||||
case GL_CONSERVATIVE_RASTERIZATION_INTEL:
|
||||
@@ -603,7 +603,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
if (ctx->IntelConservativeRasterization == state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0, 0);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->IntelConservativeRasterization = state;
|
||||
_mesa_update_valid_to_render_state(ctx);
|
||||
break;
|
||||
@@ -613,7 +613,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
if (ctx->ConservativeRasterization == state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0, GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->ConservativeRasterization = state;
|
||||
break;
|
||||
case GL_COLOR_LOGIC_OP:
|
||||
@@ -623,7 +623,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_BLEND;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_BLEND);
|
||||
ctx->Color.ColorLogicOpEnabled = state;
|
||||
_mesa_update_allow_draw_out_of_order(ctx);
|
||||
break;
|
||||
@@ -813,7 +813,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_POLYGON_BIT | GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->Polygon.SmoothFlag = state;
|
||||
break;
|
||||
case GL_POLYGON_STIPPLE:
|
||||
@@ -823,7 +823,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_POLYGON_BIT | GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->Polygon.StippleFlag = state;
|
||||
break;
|
||||
case GL_POLYGON_OFFSET_POINT:
|
||||
@@ -833,7 +833,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_POLYGON_BIT | GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->Polygon.OffsetPoint = state;
|
||||
break;
|
||||
case GL_POLYGON_OFFSET_LINE:
|
||||
@@ -843,7 +843,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_POLYGON_BIT | GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->Polygon.OffsetLine = state;
|
||||
break;
|
||||
case GL_POLYGON_OFFSET_FILL:
|
||||
@@ -851,7 +851,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_POLYGON_BIT | GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->Polygon.OffsetFill = state;
|
||||
break;
|
||||
case GL_RESCALE_NORMAL_EXT:
|
||||
@@ -871,7 +871,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
if (newEnabled != ctx->Scissor.EnableFlags) {
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_SCISSOR_BIT | GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_SCISSOR | ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE2(ctx->NewDriverState, ST_NEW_SCISSOR, ST_NEW_RASTERIZER);
|
||||
ctx->Scissor.EnableFlags = newEnabled;
|
||||
}
|
||||
}
|
||||
@@ -881,7 +881,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_STENCIL_BUFFER_BIT | GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_DSA;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_DSA);
|
||||
ctx->Stencil.Enabled = state;
|
||||
_mesa_update_allow_draw_out_of_order(ctx);
|
||||
break;
|
||||
@@ -1007,7 +1007,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_MULTISAMPLE_BIT | GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_BLEND;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_BLEND);
|
||||
ctx->Multisample.SampleAlphaToCoverage = state;
|
||||
break;
|
||||
case GL_SAMPLE_ALPHA_TO_ONE_ARB:
|
||||
@@ -1017,7 +1017,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_MULTISAMPLE_BIT | GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_BLEND;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_BLEND);
|
||||
ctx->Multisample.SampleAlphaToOne = state;
|
||||
break;
|
||||
case GL_SAMPLE_COVERAGE_ARB:
|
||||
@@ -1025,7 +1025,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_MULTISAMPLE_BIT | GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_SAMPLE_STATE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_SAMPLE_STATE);
|
||||
ctx->Multisample.SampleCoverage = state;
|
||||
break;
|
||||
case GL_SAMPLE_COVERAGE_INVERT_ARB:
|
||||
@@ -1034,7 +1034,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
if (ctx->Multisample.SampleCoverageInvert == state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0, GL_MULTISAMPLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_SAMPLE_STATE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_SAMPLE_STATE);
|
||||
ctx->Multisample.SampleCoverageInvert = state;
|
||||
break;
|
||||
|
||||
@@ -1046,7 +1046,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_MULTISAMPLE_BIT | GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ctx->DriverFlags.NewSampleShading;
|
||||
ST_SET_STATES(ctx->NewDriverState, ctx->DriverFlags.NewSampleShading);
|
||||
ctx->Multisample.SampleShading = state;
|
||||
break;
|
||||
|
||||
@@ -1094,7 +1094,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, ctx->st->lower_point_size ? _NEW_PROGRAM : 0,
|
||||
GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->VertexProgram.PointSizeEnabled = state;
|
||||
break;
|
||||
case GL_VERTEX_PROGRAM_TWO_SIDE_ARB:
|
||||
@@ -1105,11 +1105,10 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
FLUSH_VERTICES(ctx, 0, GL_ENABLE_BIT);
|
||||
if (ctx->st->lower_two_sided_color) {
|
||||
/* TODO: this could be smaller, but most drivers don't get here */
|
||||
ctx->NewDriverState |= ST_NEW_VS_STATE |
|
||||
ST_NEW_TES_STATE |
|
||||
ST_NEW_GS_STATE;
|
||||
ST_SET_STATE3(ctx->NewDriverState, ST_NEW_VS_STATE,
|
||||
ST_NEW_TES_STATE, ST_NEW_GS_STATE);
|
||||
}
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->VertexProgram.TwoSideEnabled = state;
|
||||
break;
|
||||
|
||||
@@ -1130,7 +1129,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_STENCIL_BUFFER_BIT | GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_DSA;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_DSA);
|
||||
ctx->Stencil.TestTwoSide = state;
|
||||
if (state) {
|
||||
ctx->Stencil._BackFace = 2;
|
||||
@@ -1156,7 +1155,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
if (ctx->Depth.BoundsTest == state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0, GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_DSA;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_DSA);
|
||||
ctx->Depth.BoundsTest = state;
|
||||
break;
|
||||
|
||||
@@ -1169,7 +1168,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_TRANSFORM_BIT | GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->Transform.DepthClampNear = state;
|
||||
ctx->Transform.DepthClampFar = state;
|
||||
break;
|
||||
@@ -1181,7 +1180,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_TRANSFORM_BIT | GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->Transform.DepthClampNear = state;
|
||||
break;
|
||||
|
||||
@@ -1192,7 +1191,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_TRANSFORM_BIT | GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->Transform.DepthClampFar = state;
|
||||
break;
|
||||
|
||||
@@ -1219,7 +1218,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
goto invalid_enum_error;
|
||||
if (ctx->RasterDiscard != state) {
|
||||
FLUSH_VERTICES(ctx, 0, 0);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->RasterDiscard = state;
|
||||
}
|
||||
break;
|
||||
@@ -1229,7 +1228,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
goto invalid_enum_error;
|
||||
if (ctx->TileRasterOrderFixed != state) {
|
||||
FLUSH_VERTICES(ctx, 0, GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->TileRasterOrderFixed = state;
|
||||
}
|
||||
break;
|
||||
@@ -1239,7 +1238,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
goto invalid_enum_error;
|
||||
if (ctx->TileRasterOrderIncreasingX != state) {
|
||||
FLUSH_VERTICES(ctx, 0, GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->TileRasterOrderIncreasingX = state;
|
||||
}
|
||||
break;
|
||||
@@ -1249,7 +1248,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
goto invalid_enum_error;
|
||||
if (ctx->TileRasterOrderIncreasingY != state) {
|
||||
FLUSH_VERTICES(ctx, 0, GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->TileRasterOrderIncreasingY = state;
|
||||
}
|
||||
break;
|
||||
@@ -1300,7 +1299,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
if (ctx->Multisample.SampleMask == state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0, 0);
|
||||
ctx->NewDriverState |= ST_NEW_SAMPLE_STATE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_SAMPLE_STATE);
|
||||
ctx->Multisample.SampleMask = state;
|
||||
break;
|
||||
|
||||
@@ -1310,7 +1309,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
if (ctx->Color.BlendCoherent == state)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0, GL_COLOR_BUFFER_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_BLEND;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_BLEND);
|
||||
ctx->Color.BlendCoherent = state;
|
||||
break;
|
||||
|
||||
@@ -1405,7 +1404,7 @@ _mesa_set_enablei(struct gl_context *ctx, GLenum cap,
|
||||
if (((ctx->Scissor.EnableFlags >> index) & 1) != state) {
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_SCISSOR_BIT | GL_ENABLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_SCISSOR | ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE2(ctx->NewDriverState, ST_NEW_SCISSOR, ST_NEW_RASTERIZER);
|
||||
if (state)
|
||||
ctx->Scissor.EnableFlags |= (1 << index);
|
||||
else
|
||||
|
||||
@@ -1967,7 +1967,7 @@ framebuffer_parameteri(struct gl_context *ctx, struct gl_framebuffer *fb,
|
||||
case GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_ARB:
|
||||
case GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_ARB:
|
||||
if (fb == ctx->DrawBuffer)
|
||||
ctx->NewDriverState |= ST_NEW_SAMPLE_STATE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_SAMPLE_STATE);
|
||||
break;
|
||||
default:
|
||||
invalidate_framebuffer(fb);
|
||||
@@ -3440,7 +3440,7 @@ _mesa_bind_framebuffers(struct gl_context *ctx,
|
||||
|
||||
if (bindDrawBuf) {
|
||||
FLUSH_VERTICES(ctx, _NEW_BUFFERS, 0);
|
||||
ctx->NewDriverState |= ST_NEW_SAMPLE_STATE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_SAMPLE_STATE);
|
||||
|
||||
/* check if old framebuffer had any texture attachments */
|
||||
if (oldDrawFb)
|
||||
@@ -5985,7 +5985,7 @@ sample_locations(struct gl_context *ctx, struct gl_framebuffer *fb,
|
||||
}
|
||||
|
||||
if (fb == ctx->DrawBuffer)
|
||||
ctx->NewDriverState |= ST_NEW_SAMPLE_STATE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_SAMPLE_STATE);
|
||||
}
|
||||
|
||||
void GLAPIENTRY
|
||||
@@ -6060,7 +6060,8 @@ _mesa_EvaluateDepthValuesARB(void)
|
||||
return;
|
||||
}
|
||||
|
||||
st_validate_state(st_context(ctx), ST_PIPELINE_UPDATE_FB_STATE_MASK);
|
||||
ST_PIPELINE_UPDATE_FB_STATE_MASK(mask);
|
||||
st_validate_state(st_context(ctx), mask);
|
||||
|
||||
ctx->pipe->evaluate_depth_buffer(ctx->pipe);
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ line_width(struct gl_context *ctx, GLfloat width, bool no_error)
|
||||
}
|
||||
|
||||
FLUSH_VERTICES(ctx, 0, GL_LINE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->Line.Width = width;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ _mesa_LineStipple( GLint factor, GLushort pattern )
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, 0, GL_LINE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->Line.StippleFactor = factor;
|
||||
ctx->Line.StipplePattern = pattern;
|
||||
}
|
||||
|
||||
+10
-9
@@ -54,6 +54,7 @@
|
||||
#include "util/simple_mtx.h"
|
||||
#include "util/u_dynarray.h"
|
||||
#include "vbo/vbo.h"
|
||||
#include "state_tracker/st_atom.h"
|
||||
|
||||
#include "pipe/p_state.h"
|
||||
|
||||
@@ -2890,28 +2891,28 @@ struct gl_driver_flags
|
||||
/**
|
||||
* gl_context::AtomicBufferBindings
|
||||
*/
|
||||
uint64_t NewAtomicBuffer;
|
||||
st_state_bitset NewAtomicBuffer;
|
||||
|
||||
/** gl_context::Color::Alpha* */
|
||||
uint64_t NewAlphaTest;
|
||||
st_state_bitset NewAlphaTest;
|
||||
|
||||
/** gl_context::Multisample::Enabled */
|
||||
uint64_t NewMultisampleEnable;
|
||||
st_state_bitset NewMultisampleEnable;
|
||||
|
||||
/** gl_context::Multisample::(Min)SampleShading */
|
||||
uint64_t NewSampleShading;
|
||||
st_state_bitset NewSampleShading;
|
||||
|
||||
/** gl_context::Transform::ClipPlanesEnabled */
|
||||
uint64_t NewClipPlaneEnable;
|
||||
st_state_bitset NewClipPlaneEnable;
|
||||
|
||||
/** gl_context::Color::ClampFragmentColor */
|
||||
uint64_t NewFragClamp;
|
||||
st_state_bitset NewFragClamp;
|
||||
|
||||
/** Shader constants (uniforms, program parameters, state constants) */
|
||||
uint64_t NewShaderConstants[MESA_SHADER_MESH_STAGES];
|
||||
st_state_bitset NewShaderConstants[MESA_SHADER_MESH_STAGES];
|
||||
|
||||
/** For GL_CLAMP emulation */
|
||||
uint64_t NewSamplersWithClamp;
|
||||
st_state_bitset NewSamplersWithClamp;
|
||||
};
|
||||
|
||||
struct gl_buffer_binding
|
||||
@@ -3534,7 +3535,7 @@ struct gl_context
|
||||
GLenum16 RenderMode; /**< either GL_RENDER, GL_SELECT, GL_FEEDBACK */
|
||||
GLbitfield NewState; /**< bitwise-or of _NEW_* flags */
|
||||
GLbitfield PopAttribState; /**< Updated state since glPushAttrib */
|
||||
uint64_t NewDriverState; /**< bitwise-or of flags from DriverFlags */
|
||||
st_state_bitset NewDriverState; /**< bitwise-or of flags from DriverFlags */
|
||||
|
||||
struct gl_driver_flags DriverFlags;
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ _mesa_SampleCoverage(GLclampf value, GLboolean invert)
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, 0, GL_MULTISAMPLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_SAMPLE_STATE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_SAMPLE_STATE);
|
||||
ctx->Multisample.SampleCoverageValue = value;
|
||||
ctx->Multisample.SampleCoverageInvert = invert;
|
||||
}
|
||||
@@ -89,7 +89,8 @@ get_sample_position(struct gl_context *ctx,
|
||||
{
|
||||
struct st_context *st = st_context(ctx);
|
||||
|
||||
st_validate_state(st, ST_PIPELINE_UPDATE_FB_STATE_MASK);
|
||||
ST_PIPELINE_UPDATE_FB_STATE_MASK(mask);
|
||||
st_validate_state(st, mask);
|
||||
|
||||
if (ctx->pipe->get_sample_position)
|
||||
ctx->pipe->get_sample_position(ctx->pipe,
|
||||
@@ -155,7 +156,7 @@ sample_maski(struct gl_context *ctx, GLuint index, GLbitfield mask)
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, 0, 0);
|
||||
ctx->NewDriverState |= ST_NEW_SAMPLE_STATE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_SAMPLE_STATE);
|
||||
ctx->Multisample.SampleMaskValue = mask;
|
||||
}
|
||||
|
||||
@@ -193,7 +194,7 @@ min_sample_shading(struct gl_context *ctx, GLclampf value)
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, 0, GL_MULTISAMPLE_BIT);
|
||||
ctx->NewDriverState |= ctx->DriverFlags.NewSampleShading;
|
||||
ST_SET_STATES(ctx->NewDriverState, ctx->DriverFlags.NewSampleShading);
|
||||
ctx->Multisample.MinSampleShadingValue = value;
|
||||
}
|
||||
|
||||
@@ -388,7 +389,7 @@ _mesa_AlphaToCoverageDitherControlNV_no_error(GLenum mode)
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
FLUSH_VERTICES(ctx, 0, GL_MULTISAMPLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_BLEND;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_BLEND);
|
||||
ctx->Multisample.SampleAlphaToCoverageDitherControl = mode;
|
||||
}
|
||||
|
||||
@@ -398,7 +399,7 @@ _mesa_AlphaToCoverageDitherControlNV(GLenum mode)
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
FLUSH_VERTICES(ctx, 0, GL_MULTISAMPLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_BLEND;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_BLEND);
|
||||
switch (mode) {
|
||||
case GL_ALPHA_TO_COVERAGE_DITHER_DEFAULT_NV:
|
||||
case GL_ALPHA_TO_COVERAGE_DITHER_ENABLE_NV:
|
||||
@@ -417,7 +418,8 @@ _mesa_GetProgrammableSampleCaps(struct gl_context *ctx, const struct gl_framebuf
|
||||
struct st_context *st = st_context(ctx);
|
||||
struct pipe_screen *screen = ctx->pipe->screen;
|
||||
|
||||
st_validate_state(st, ST_PIPELINE_UPDATE_FB_STATE_MASK);
|
||||
ST_PIPELINE_UPDATE_FB_STATE_MASK(mask);
|
||||
st_validate_state(st, mask);
|
||||
|
||||
*outBits = 4;
|
||||
*outWidth = 1;
|
||||
|
||||
@@ -68,7 +68,7 @@ cull_face(struct gl_context *ctx, GLenum mode, bool no_error)
|
||||
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_POLYGON_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->Polygon.CullFaceMode = mode;
|
||||
_mesa_update_edgeflag_state_vao(ctx);
|
||||
}
|
||||
@@ -118,7 +118,7 @@ front_face(struct gl_context *ctx, GLenum mode, bool no_error)
|
||||
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_POLYGON_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->Polygon.FrontFace = mode;
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ polygon_mode(struct gl_context *ctx, GLenum face, GLenum mode, bool no_error)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_POLYGON_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->Polygon.FrontMode = mode;
|
||||
_mesa_update_edgeflag_state_vao(ctx);
|
||||
break;
|
||||
@@ -202,7 +202,7 @@ polygon_mode(struct gl_context *ctx, GLenum face, GLenum mode, bool no_error)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_POLYGON_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->Polygon.FrontMode = mode;
|
||||
ctx->Polygon.BackMode = mode;
|
||||
_mesa_update_edgeflag_state_vao(ctx);
|
||||
@@ -216,7 +216,7 @@ polygon_mode(struct gl_context *ctx, GLenum face, GLenum mode, bool no_error)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_POLYGON_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->Polygon.BackMode = mode;
|
||||
_mesa_update_edgeflag_state_vao(ctx);
|
||||
break;
|
||||
@@ -260,7 +260,7 @@ _mesa_PolygonStipple(const GLubyte *pattern)
|
||||
_mesa_debug(ctx, "glPolygonStipple\n");
|
||||
|
||||
FLUSH_VERTICES(ctx, 0, GL_POLYGON_STIPPLE_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_POLY_STIPPLE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_POLY_STIPPLE);
|
||||
|
||||
pattern = _mesa_map_validate_pbo_source(ctx, 2,
|
||||
&ctx->Unpack, 32, 32, 1,
|
||||
@@ -320,7 +320,7 @@ _mesa_polygon_offset_clamp(struct gl_context *ctx,
|
||||
|
||||
FLUSH_VERTICES(ctx, 0,
|
||||
GL_POLYGON_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
ctx->Polygon.OffsetFactor = factor;
|
||||
ctx->Polygon.OffsetUnits = units;
|
||||
ctx->Polygon.OffsetClamp = clamp;
|
||||
|
||||
@@ -169,7 +169,7 @@ lower_gl_clamp(enum pipe_tex_wrap old_wrap, GLenum wrap, bool clamp_to_border)
|
||||
static inline void
|
||||
_mesa_lower_gl_clamp(struct gl_context *ctx, struct gl_sampler_object *samp)
|
||||
{
|
||||
if (ctx->DriverFlags.NewSamplersWithClamp) {
|
||||
if (!BITSET_IS_EMPTY(ctx->DriverFlags.NewSamplersWithClamp)) {
|
||||
struct pipe_sampler_state *s = &samp->Attrib.state;
|
||||
bool clamp_to_border = s->min_img_filter != PIPE_TEX_FILTER_NEAREST &&
|
||||
s->mag_img_filter != PIPE_TEX_FILTER_NEAREST;
|
||||
@@ -194,7 +194,7 @@ update_sampler_gl_clamp(struct gl_context *ctx, struct gl_sampler_object *samp,
|
||||
{
|
||||
if (cur_state == new_state)
|
||||
return;
|
||||
ctx->NewDriverState |= ctx->DriverFlags.NewSamplersWithClamp;
|
||||
ST_SET_STATES(ctx->NewDriverState, ctx->DriverFlags.NewSamplersWithClamp);
|
||||
uint8_t old_mask = samp->glclamp_mask;
|
||||
if (new_state)
|
||||
samp->glclamp_mask |= wrap;
|
||||
|
||||
@@ -52,7 +52,7 @@ set_scissor_no_notify(struct gl_context *ctx, unsigned idx,
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, 0, GL_SCISSOR_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_SCISSOR;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_SCISSOR);
|
||||
|
||||
ctx->Scissor.ScissorArray[idx].X = x;
|
||||
ctx->Scissor.ScissorArray[idx].Y = y;
|
||||
@@ -298,7 +298,7 @@ _mesa_WindowRectanglesEXT(GLenum mode, GLsizei count, const GLint *box)
|
||||
st_flush_bitmap_cache(st_context(ctx));
|
||||
|
||||
FLUSH_VERTICES(ctx, 0, GL_SCISSOR_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_WINDOW_RECTANGLES;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_WINDOW_RECTANGLES);
|
||||
|
||||
memcpy(ctx->Scissor.WindowRects, newval,
|
||||
sizeof(struct gl_scissor_rect) * count);
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "compiler/shader_info.h"
|
||||
#include "compiler/list.h"
|
||||
#include "compiler/glsl/ir_list.h"
|
||||
#include "state_tracker/st_atom.h"
|
||||
|
||||
#include "pipe/p_state.h"
|
||||
|
||||
@@ -530,7 +531,7 @@ struct gl_program
|
||||
|
||||
struct pipe_shader_state state;
|
||||
struct ati_fragment_shader *ati_fs;
|
||||
uint64_t affected_states; /**< ST_NEW_* flags to mark dirty when binding */
|
||||
st_state_bitset affected_states; /**< ST_NEW_* flags to mark dirty when binding */
|
||||
|
||||
void *serialized_nir;
|
||||
unsigned serialized_nir_size;
|
||||
|
||||
@@ -2745,7 +2745,7 @@ set_patch_vertices(struct gl_context *ctx, GLint value)
|
||||
{
|
||||
if (ctx->TessCtrlProgram.patch_vertices != value) {
|
||||
FLUSH_VERTICES(ctx, 0, GL_CURRENT_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_TESS_STATE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_TESS_STATE);
|
||||
ctx->TessCtrlProgram.patch_vertices = value;
|
||||
}
|
||||
}
|
||||
@@ -2801,13 +2801,13 @@ _mesa_PatchParameterfv(GLenum pname, const GLfloat *values)
|
||||
FLUSH_VERTICES(ctx, 0, 0);
|
||||
memcpy(ctx->TessCtrlProgram.patch_default_outer_level, values,
|
||||
4 * sizeof(GLfloat));
|
||||
ctx->NewDriverState |= ST_NEW_TESS_STATE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_TESS_STATE);
|
||||
return;
|
||||
case GL_PATCH_DEFAULT_INNER_LEVEL:
|
||||
FLUSH_VERTICES(ctx, 0, 0);
|
||||
memcpy(ctx->TessCtrlProgram.patch_default_inner_level, values,
|
||||
2 * sizeof(GLfloat));
|
||||
ctx->NewDriverState |= ST_NEW_TESS_STATE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_TESS_STATE);
|
||||
return;
|
||||
default:
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glPatchParameterfv");
|
||||
|
||||
@@ -663,7 +663,7 @@ bind_image_texture(struct gl_context *ctx, struct gl_texture_object *texObj,
|
||||
u = &ctx->ImageUnits[unit];
|
||||
|
||||
FLUSH_VERTICES(ctx, 0, 0);
|
||||
ctx->NewDriverState |= ST_NEW_IMAGE_UNITS;
|
||||
ST_SET_SHADER_STATES(ctx->NewDriverState, IMAGES);
|
||||
|
||||
set_image_binding(u, texObj, level, layered, layer, access, format);
|
||||
}
|
||||
@@ -761,7 +761,7 @@ bind_image_textures(struct gl_context *ctx, GLuint first, GLuint count,
|
||||
|
||||
/* Assume that at least one binding will be changed */
|
||||
FLUSH_VERTICES(ctx, 0, 0);
|
||||
ctx->NewDriverState |= ST_NEW_IMAGE_UNITS;
|
||||
ST_SET_SHADER_STATES(ctx->NewDriverState, IMAGES);
|
||||
|
||||
/* Note that the error semantics for multi-bind commands differ from
|
||||
* those of other GL commands.
|
||||
|
||||
+62
-47
@@ -150,8 +150,8 @@ _mesa_update_allow_draw_out_of_order(struct gl_context *ctx)
|
||||
FLUSH_VERTICES(ctx, 0, 0);
|
||||
}
|
||||
|
||||
uint64_t
|
||||
_mesa_get_active_states(struct gl_context *ctx)
|
||||
void
|
||||
_mesa_set_active_states(struct gl_context *ctx)
|
||||
{
|
||||
struct gl_program *vp = ctx->VertexProgram._Current;
|
||||
struct gl_program *tcp = ctx->TessCtrlProgram._Current;
|
||||
@@ -159,23 +159,31 @@ _mesa_get_active_states(struct gl_context *ctx)
|
||||
struct gl_program *gp = ctx->GeometryProgram._Current;
|
||||
struct gl_program *fp = ctx->FragmentProgram._Current;
|
||||
struct gl_program *cp = ctx->ComputeProgram._Current;
|
||||
uint64_t active_shader_states = 0;
|
||||
|
||||
if (vp)
|
||||
active_shader_states |= vp->affected_states;
|
||||
if (tcp)
|
||||
active_shader_states |= tcp->affected_states;
|
||||
if (tep)
|
||||
active_shader_states |= tep->affected_states;
|
||||
if (gp)
|
||||
active_shader_states |= gp->affected_states;
|
||||
if (fp)
|
||||
active_shader_states |= fp->affected_states;
|
||||
if (cp)
|
||||
active_shader_states |= cp->affected_states;
|
||||
BITSET_ZERO(ctx->st->active_states);
|
||||
|
||||
ST_SET_SHADER_STATES(ctx->st->active_states, SAMPLER_VIEWS);
|
||||
ST_SET_SHADER_STATES(ctx->st->active_states, SAMPLERS);
|
||||
ST_SET_SHADER_STATES(ctx->st->active_states, UBOS);
|
||||
ST_SET_SHADER_STATES(ctx->st->active_states, ATOMICS);
|
||||
ST_SET_SHADER_STATES(ctx->st->active_states, SSBOS);
|
||||
ST_SET_SHADER_STATES(ctx->st->active_states, IMAGES);
|
||||
|
||||
/* Mark non-shader-resource shader states as "always active". */
|
||||
return active_shader_states | ~ST_ALL_SHADER_RESOURCES;
|
||||
BITSET_NOT(ctx->st->active_states);
|
||||
|
||||
if (vp)
|
||||
ST_SET_STATES(ctx->st->active_states, vp->affected_states);
|
||||
if (tcp)
|
||||
ST_SET_STATES(ctx->st->active_states, tcp->affected_states);
|
||||
if (tep)
|
||||
ST_SET_STATES(ctx->st->active_states, tep->affected_states);
|
||||
if (gp)
|
||||
ST_SET_STATES(ctx->st->active_states, gp->affected_states);
|
||||
if (fp)
|
||||
ST_SET_STATES(ctx->st->active_states, fp->affected_states);
|
||||
if (cp)
|
||||
ST_SET_STATES(ctx->st->active_states, cp->affected_states);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -212,12 +220,18 @@ update_program(struct gl_context *ctx)
|
||||
const struct gl_program *prevTCP = ctx->TessCtrlProgram._Current;
|
||||
const struct gl_program *prevTEP = ctx->TessEvalProgram._Current;
|
||||
const struct gl_program *prevCP = ctx->ComputeProgram._Current;
|
||||
uint64_t prev_vp_affected_states = prevVP ? prevVP->affected_states : 0;
|
||||
uint64_t prev_tcp_affected_states = prevTCP ? prevTCP->affected_states : 0;
|
||||
uint64_t prev_tep_affected_states = prevTEP ? prevTEP->affected_states : 0;
|
||||
uint64_t prev_gp_affected_states = prevGP ? prevGP->affected_states : 0;
|
||||
uint64_t prev_fp_affected_states = prevFP ? prevFP->affected_states : 0;
|
||||
uint64_t prev_cp_affected_states = prevCP ? prevCP->affected_states : 0;
|
||||
st_state_bitset prev_vp_affected_states = {0};
|
||||
if (prevVP) BITSET_COPY(prev_vp_affected_states, prevVP->affected_states);
|
||||
st_state_bitset prev_tcp_affected_states = {0};
|
||||
if (prevTCP) BITSET_COPY(prev_tcp_affected_states, prevTCP->affected_states);
|
||||
st_state_bitset prev_tep_affected_states = {0};
|
||||
if (prevTEP) BITSET_COPY(prev_tep_affected_states, prevTEP->affected_states);
|
||||
st_state_bitset prev_gp_affected_states = {0};
|
||||
if (prevGP) BITSET_COPY(prev_gp_affected_states, prevGP->affected_states);
|
||||
st_state_bitset prev_fp_affected_states = {0};
|
||||
if (prevFP) BITSET_COPY(prev_fp_affected_states, prevFP->affected_states);
|
||||
st_state_bitset prev_cp_affected_states = {0};
|
||||
if (prevCP) BITSET_COPY(prev_cp_affected_states, prevCP->affected_states);
|
||||
|
||||
/*
|
||||
* Set the ctx->VertexProgram._Current and ctx->FragmentProgram._Current
|
||||
@@ -298,7 +312,7 @@ update_program(struct gl_context *ctx)
|
||||
bool cp_changed = ctx->ComputeProgram._Current != prevCP;
|
||||
|
||||
/* Set NewDriverState depending on which shaders have changed. */
|
||||
uint64_t dirty = 0;
|
||||
st_state_bitset dirty = {0};
|
||||
|
||||
/* Flag states used by both new and old shaders to rebind shader resources
|
||||
* (because shaders pack them and reorder them) and to unbind shader
|
||||
@@ -306,42 +320,42 @@ update_program(struct gl_context *ctx)
|
||||
*/
|
||||
if (vp_changed) {
|
||||
ctx->Array.NewVertexElements = true;
|
||||
dirty |= prev_vp_affected_states;
|
||||
ST_SET_STATES(dirty, prev_vp_affected_states);
|
||||
if (ctx->VertexProgram._Current)
|
||||
dirty |= ST_NEW_VERTEX_PROGRAM(ctx, ctx->VertexProgram._Current);
|
||||
ST_SET_VERTEX_PROGRAM_STATES(dirty, ctx, ctx->VertexProgram._Current);
|
||||
}
|
||||
|
||||
if (tcp_changed) {
|
||||
dirty |= prev_tcp_affected_states;
|
||||
ST_SET_STATES(dirty, prev_tcp_affected_states);
|
||||
if (ctx->TessCtrlProgram._Current)
|
||||
dirty |= ctx->TessCtrlProgram._Current->affected_states;
|
||||
ST_SET_STATES(dirty, ctx->TessCtrlProgram._Current->affected_states);
|
||||
}
|
||||
|
||||
if (tep_changed) {
|
||||
dirty |= prev_tep_affected_states;
|
||||
ST_SET_STATES(dirty, prev_tep_affected_states);
|
||||
if (ctx->TessEvalProgram._Current)
|
||||
dirty |= ctx->TessEvalProgram._Current->affected_states;
|
||||
ST_SET_STATES(dirty, ctx->TessEvalProgram._Current->affected_states);
|
||||
}
|
||||
|
||||
if (gp_changed) {
|
||||
dirty |= prev_gp_affected_states;
|
||||
ST_SET_STATES(dirty, prev_gp_affected_states);
|
||||
if (ctx->GeometryProgram._Current)
|
||||
dirty |= ctx->GeometryProgram._Current->affected_states;
|
||||
ST_SET_STATES(dirty, ctx->GeometryProgram._Current->affected_states);
|
||||
}
|
||||
|
||||
if (fp_changed) {
|
||||
dirty |= prev_fp_affected_states;
|
||||
ST_SET_STATES(dirty, prev_fp_affected_states);
|
||||
if (ctx->FragmentProgram._Current)
|
||||
dirty |= ctx->FragmentProgram._Current->affected_states;
|
||||
ST_SET_STATES(dirty, ctx->FragmentProgram._Current->affected_states);
|
||||
|
||||
if (!ctx->st->needs_texcoord_semantic)
|
||||
dirty |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(dirty, ST_NEW_RASTERIZER);
|
||||
}
|
||||
|
||||
if (cp_changed) {
|
||||
dirty |= prev_cp_affected_states;
|
||||
ST_SET_STATES(dirty, prev_cp_affected_states);
|
||||
if (ctx->ComputeProgram._Current)
|
||||
dirty |= ctx->ComputeProgram._Current->affected_states;
|
||||
ST_SET_STATES(dirty, ctx->ComputeProgram._Current->affected_states);
|
||||
}
|
||||
|
||||
struct gl_program *last_vertex_stage;
|
||||
@@ -371,34 +385,34 @@ update_program(struct gl_context *ctx)
|
||||
|
||||
if (st->state.num_viewports != num_viewports) {
|
||||
st->state.num_viewports = num_viewports;
|
||||
dirty |= ST_NEW_VIEWPORT;
|
||||
ST_SET_STATE(dirty, ST_NEW_VIEWPORT);
|
||||
|
||||
if (ctx->Scissor.EnableFlags & u_bit_consecutive(0, num_viewports))
|
||||
dirty |= ST_NEW_SCISSOR;
|
||||
ST_SET_STATE(dirty, ST_NEW_SCISSOR);
|
||||
}
|
||||
|
||||
if (st->lower_point_size && last_vertex_stage_dirty &&
|
||||
!ctx->VertexProgram.PointSizeEnabled && !ctx->PointSizeIsSet) {
|
||||
if (ctx->GeometryProgram._Current) {
|
||||
ctx->NewDriverState |= ST_NEW_GS_CONSTANTS;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_GS_CONSTANTS);
|
||||
} else if (ctx->TessEvalProgram._Current) {
|
||||
ctx->NewDriverState |= ST_NEW_TES_CONSTANTS;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_TES_CONSTANTS);
|
||||
} else {
|
||||
ctx->NewDriverState |= ST_NEW_VS_CONSTANTS;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_VS_CONSTANTS);
|
||||
}
|
||||
}
|
||||
|
||||
ctx->NewDriverState |= dirty;
|
||||
ST_SET_STATES(ctx->NewDriverState, dirty);
|
||||
|
||||
/* Let the driver know what's happening: */
|
||||
if (fp_changed || vp_changed || gp_changed || tep_changed ||
|
||||
tcp_changed || cp_changed) {
|
||||
/* This will mask out unused shader resources. */
|
||||
st->active_states = _mesa_get_active_states(ctx);
|
||||
_mesa_set_active_states(ctx);
|
||||
|
||||
/* Some drivers need to clean up previous states too */
|
||||
if (st->validate_all_dirty_states)
|
||||
st->active_states |= dirty;
|
||||
ST_SET_STATES(st->active_states, dirty);
|
||||
|
||||
return _NEW_PROGRAM;
|
||||
}
|
||||
@@ -415,8 +429,9 @@ update_single_program_constants(struct gl_context *ctx,
|
||||
if (prog) {
|
||||
const struct gl_program_parameter_list *params = prog->Parameters;
|
||||
if (params && params->StateFlags & ctx->NewState) {
|
||||
if (ctx->DriverFlags.NewShaderConstants[stage])
|
||||
ctx->NewDriverState |= ctx->DriverFlags.NewShaderConstants[stage];
|
||||
if (!BITSET_IS_EMPTY(ctx->DriverFlags.NewShaderConstants[stage]))
|
||||
ST_SET_STATES(ctx->NewDriverState,
|
||||
ctx->DriverFlags.NewShaderConstants[stage]);
|
||||
else
|
||||
return _NEW_PROGRAM_CONSTANTS;
|
||||
}
|
||||
@@ -639,7 +654,7 @@ set_vertex_processing_mode(struct gl_context *ctx, gl_vertex_processing_mode m)
|
||||
return;
|
||||
|
||||
/* On change we may get new maps into the current values */
|
||||
ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_VERTEX_ARRAYS);
|
||||
ctx->Array.NewVertexElements = true;
|
||||
|
||||
/* Finally memorize the value */
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
extern void
|
||||
_mesa_update_allow_draw_out_of_order(struct gl_context *ctx);
|
||||
|
||||
extern uint64_t
|
||||
_mesa_get_active_states(struct gl_context *ctx);
|
||||
extern void
|
||||
_mesa_set_active_states(struct gl_context *ctx);
|
||||
|
||||
extern void
|
||||
_mesa_update_state(struct gl_context *ctx);
|
||||
|
||||
+11
-11
@@ -161,7 +161,7 @@ _mesa_StencilFuncSeparateATI( GLenum frontfunc, GLenum backfunc, GLint ref, GLui
|
||||
ctx->Stencil.Ref[1] == ref)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0, GL_STENCIL_BUFFER_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_DSA;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_DSA);
|
||||
ctx->Stencil.Function[0] = frontfunc;
|
||||
ctx->Stencil.Function[1] = backfunc;
|
||||
ctx->Stencil.Ref[0] = ctx->Stencil.Ref[1] = ref;
|
||||
@@ -193,7 +193,7 @@ stencil_func(struct gl_context *ctx, GLenum func, GLint ref, GLuint mask)
|
||||
ctx->Stencil.Ref[face] == ref)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0, GL_STENCIL_BUFFER_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_DSA;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_DSA);
|
||||
ctx->Stencil.Function[face] = func;
|
||||
ctx->Stencil.Ref[face] = ref;
|
||||
ctx->Stencil.ValueMask[face] = mask;
|
||||
@@ -208,7 +208,7 @@ stencil_func(struct gl_context *ctx, GLenum func, GLint ref, GLuint mask)
|
||||
ctx->Stencil.Ref[1] == ref)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0, GL_STENCIL_BUFFER_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_DSA;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_DSA);
|
||||
ctx->Stencil.Function[0] = ctx->Stencil.Function[1] = func;
|
||||
ctx->Stencil.Ref[0] = ctx->Stencil.Ref[1] = ref;
|
||||
ctx->Stencil.ValueMask[0] = ctx->Stencil.ValueMask[1] = mask;
|
||||
@@ -267,7 +267,7 @@ _mesa_StencilMask( GLuint mask )
|
||||
if (ctx->Stencil.WriteMask[face] == mask)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0, GL_STENCIL_BUFFER_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_DSA;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_DSA);
|
||||
ctx->Stencil.WriteMask[face] = mask;
|
||||
}
|
||||
else {
|
||||
@@ -276,7 +276,7 @@ _mesa_StencilMask( GLuint mask )
|
||||
ctx->Stencil.WriteMask[1] == mask)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0, GL_STENCIL_BUFFER_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_DSA;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_DSA);
|
||||
ctx->Stencil.WriteMask[0] = ctx->Stencil.WriteMask[1] = mask;
|
||||
}
|
||||
}
|
||||
@@ -308,7 +308,7 @@ stencil_op(struct gl_context *ctx, GLenum fail, GLenum zfail, GLenum zpass)
|
||||
ctx->Stencil.FailFunc[face] == fail)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0, GL_STENCIL_BUFFER_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_DSA;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_DSA);
|
||||
ctx->Stencil.ZFailFunc[face] = zfail;
|
||||
ctx->Stencil.ZPassFunc[face] = zpass;
|
||||
ctx->Stencil.FailFunc[face] = fail;
|
||||
@@ -323,7 +323,7 @@ stencil_op(struct gl_context *ctx, GLenum fail, GLenum zfail, GLenum zpass)
|
||||
ctx->Stencil.FailFunc[1] == fail)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, 0, GL_STENCIL_BUFFER_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_DSA;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_DSA);
|
||||
ctx->Stencil.ZFailFunc[0] = ctx->Stencil.ZFailFunc[1] = zfail;
|
||||
ctx->Stencil.ZPassFunc[0] = ctx->Stencil.ZPassFunc[1] = zpass;
|
||||
ctx->Stencil.FailFunc[0] = ctx->Stencil.FailFunc[1] = fail;
|
||||
@@ -399,7 +399,7 @@ stencil_op_separate(struct gl_context *ctx, GLenum face, GLenum sfail,
|
||||
ctx->Stencil.ZPassFunc[0] != zpass ||
|
||||
ctx->Stencil.FailFunc[0] != sfail){
|
||||
FLUSH_VERTICES(ctx, 0, GL_STENCIL_BUFFER_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_DSA;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_DSA);
|
||||
ctx->Stencil.ZFailFunc[0] = zfail;
|
||||
ctx->Stencil.ZPassFunc[0] = zpass;
|
||||
ctx->Stencil.FailFunc[0] = sfail;
|
||||
@@ -412,7 +412,7 @@ stencil_op_separate(struct gl_context *ctx, GLenum face, GLenum sfail,
|
||||
ctx->Stencil.ZPassFunc[1] != zpass ||
|
||||
ctx->Stencil.FailFunc[1] != sfail) {
|
||||
FLUSH_VERTICES(ctx, 0, GL_STENCIL_BUFFER_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_DSA;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_DSA);
|
||||
ctx->Stencil.ZFailFunc[1] = zfail;
|
||||
ctx->Stencil.ZPassFunc[1] = zpass;
|
||||
ctx->Stencil.FailFunc[1] = sfail;
|
||||
@@ -467,7 +467,7 @@ stencil_func_separate(struct gl_context *ctx, GLenum face, GLenum func,
|
||||
GLint ref, GLuint mask)
|
||||
{
|
||||
FLUSH_VERTICES(ctx, 0, GL_STENCIL_BUFFER_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_DSA;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_DSA);
|
||||
|
||||
if (face != GL_BACK) {
|
||||
/* set front */
|
||||
@@ -521,7 +521,7 @@ static void
|
||||
stencil_mask_separate(struct gl_context *ctx, GLenum face, GLuint mask)
|
||||
{
|
||||
FLUSH_VERTICES(ctx, 0, GL_STENCIL_BUFFER_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_DSA;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_DSA);
|
||||
|
||||
if (face != GL_BACK) {
|
||||
ctx->Stencil.WriteMask[0] = mask;
|
||||
|
||||
@@ -6700,7 +6700,7 @@ texture_buffer_range(struct gl_context *ctx,
|
||||
}
|
||||
}
|
||||
|
||||
ctx->NewDriverState |= ST_NEW_SAMPLER_VIEWS;
|
||||
ST_SET_SHADER_STATES(ctx->NewDriverState, SAMPLER_VIEWS);
|
||||
|
||||
if (bufObj) {
|
||||
bufObj->UsageHistory |= USAGE_TEXTURE_BUFFER;
|
||||
|
||||
@@ -1710,7 +1710,7 @@ bind_texture_object(struct gl_context *ctx, unsigned unit,
|
||||
if (texUnit->CurrentTex[targetIndex] &&
|
||||
texUnit->CurrentTex[targetIndex]->Sampler.glclamp_mask !=
|
||||
texObj->Sampler.glclamp_mask)
|
||||
ctx->NewDriverState |= ctx->DriverFlags.NewSamplersWithClamp;
|
||||
ST_SET_STATES(ctx->NewDriverState, ctx->DriverFlags.NewSamplersWithClamp);
|
||||
|
||||
/* If the refcount on the previously bound texture is decremented to
|
||||
* zero, it'll be deleted here.
|
||||
|
||||
@@ -1267,18 +1267,18 @@ _mesa_flush_vertices_for_uniforms(struct gl_context *ctx,
|
||||
return;
|
||||
}
|
||||
|
||||
uint64_t new_driver_state = 0;
|
||||
st_state_bitset new_driver_state = {0};
|
||||
unsigned mask = uni->active_shader_mask;
|
||||
|
||||
while (mask) {
|
||||
unsigned index = u_bit_scan(&mask);
|
||||
|
||||
assert(index < MESA_SHADER_MESH_STAGES);
|
||||
new_driver_state |= ctx->DriverFlags.NewShaderConstants[index];
|
||||
ST_SET_STATES(new_driver_state, ctx->DriverFlags.NewShaderConstants[index]);
|
||||
}
|
||||
|
||||
FLUSH_VERTICES(ctx, new_driver_state ? 0 : _NEW_PROGRAM_CONSTANTS, 0);
|
||||
ctx->NewDriverState |= new_driver_state;
|
||||
FLUSH_VERTICES(ctx, BITSET_IS_EMPTY(new_driver_state) ? _NEW_PROGRAM_CONSTANTS : 0, 0);
|
||||
ST_SET_STATES(ctx->NewDriverState, new_driver_state);
|
||||
}
|
||||
|
||||
static bool
|
||||
@@ -1615,7 +1615,7 @@ _mesa_uniform(GLint location, GLsizei count, const GLvoid *values,
|
||||
}
|
||||
}
|
||||
|
||||
ctx->NewDriverState |= ST_NEW_IMAGE_UNITS;
|
||||
ST_SET_SHADER_STATES(ctx->NewDriverState, IMAGES);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1109,7 +1109,7 @@ uniform_block_binding(struct gl_context *ctx, struct gl_shader_program *shProg,
|
||||
uniformBlockBinding) {
|
||||
|
||||
FLUSH_VERTICES(ctx, 0, 0);
|
||||
ctx->NewDriverState |= ST_NEW_UNIFORM_BUFFER;
|
||||
ST_SET_SHADER_STATES(ctx->NewDriverState, UBOS);
|
||||
|
||||
shProg->data->UniformBlocks[uniformBlockIndex].Binding =
|
||||
uniformBlockBinding;
|
||||
@@ -1171,7 +1171,7 @@ shader_storage_block_binding(struct gl_context *ctx,
|
||||
shaderStorageBlockBinding) {
|
||||
|
||||
FLUSH_VERTICES(ctx, 0, 0);
|
||||
ctx->NewDriverState |= ST_NEW_STORAGE_BUFFER;
|
||||
ST_SET_SHADER_STATES(ctx->NewDriverState, SSBOS);
|
||||
|
||||
shProg->data->ShaderStorageBlocks[shaderStorageBlockIndex].Binding =
|
||||
shaderStorageBlockBinding;
|
||||
|
||||
+9
-10
@@ -236,7 +236,7 @@ _mesa_vertex_attrib_binding(struct gl_context *ctx,
|
||||
array->BufferBindingIndex = bindingIndex;
|
||||
|
||||
if (vao->Enabled & array_bit) {
|
||||
ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_VERTEX_ARRAYS);
|
||||
ctx->Array.NewVertexElements = true;
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ _mesa_bind_vertex_buffer(struct gl_context *ctx,
|
||||
}
|
||||
|
||||
if (vao->Enabled & binding->_BoundArrays) {
|
||||
ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_VERTEX_ARRAYS);
|
||||
/* The slow path merges vertex buffers, which affects vertex elements.
|
||||
* Stride changes also require new vertex elements.
|
||||
*/
|
||||
@@ -345,7 +345,7 @@ vertex_binding_divisor(struct gl_context *ctx,
|
||||
vao->NonZeroDivisorMask &= ~binding->_BoundArrays;
|
||||
|
||||
if (vao->Enabled & binding->_BoundArrays) {
|
||||
ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_VERTEX_ARRAYS);
|
||||
ctx->Array.NewVertexElements = true;
|
||||
}
|
||||
|
||||
@@ -857,7 +857,7 @@ _mesa_update_array_format(struct gl_context *ctx,
|
||||
normalized, integer, doubles);
|
||||
|
||||
if (vao->Enabled & VERT_BIT(attrib)) {
|
||||
ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_VERTEX_ARRAYS);
|
||||
ctx->Array.NewVertexElements = true;
|
||||
}
|
||||
|
||||
@@ -1122,7 +1122,7 @@ update_array(struct gl_context *ctx,
|
||||
array->Ptr = ptr;
|
||||
|
||||
if (vao->Enabled & VERT_BIT(attrib)) {
|
||||
ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_VERTEX_ARRAYS);
|
||||
/* The slow path merges vertex buffers, which affects vertex
|
||||
* elements.
|
||||
*/
|
||||
@@ -2113,8 +2113,7 @@ _mesa_update_edgeflag_state_explicit(struct gl_context *ctx,
|
||||
|
||||
struct gl_program *vp = ctx->VertexProgram._Current;
|
||||
if (vp) {
|
||||
ctx->NewDriverState |= ST_NEW_VS_STATE |
|
||||
ST_NEW_VERTEX_ARRAYS;
|
||||
ST_SET_STATE2(ctx->NewDriverState, ST_NEW_VS_STATE, ST_NEW_VERTEX_ARRAYS);
|
||||
ctx->Array.NewVertexElements = true;
|
||||
}
|
||||
}
|
||||
@@ -2128,7 +2127,7 @@ _mesa_update_edgeflag_state_explicit(struct gl_context *ctx,
|
||||
!ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0];
|
||||
if (polygon_mode_always_culls != ctx->Array._PolygonModeAlwaysCulls) {
|
||||
ctx->Array._PolygonModeAlwaysCulls = polygon_mode_always_culls;
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2157,7 +2156,7 @@ _mesa_enable_vertex_array_attribs(struct gl_context *ctx,
|
||||
/* was disabled, now being enabled */
|
||||
vao->Enabled |= attrib_bits;
|
||||
vao->NonDefaultStateMask |= attrib_bits;
|
||||
ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_VERTEX_ARRAYS);
|
||||
ctx->Array.NewVertexElements = true;
|
||||
|
||||
/* Update the map mode if needed */
|
||||
@@ -2260,7 +2259,7 @@ _mesa_disable_vertex_array_attribs(struct gl_context *ctx,
|
||||
if (attrib_bits) {
|
||||
/* was enabled, now being disabled */
|
||||
vao->Enabled &= ~attrib_bits;
|
||||
ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_VERTEX_ARRAYS);
|
||||
ctx->Array.NewVertexElements = true;
|
||||
|
||||
/* Update the map mode if needed */
|
||||
|
||||
@@ -76,7 +76,7 @@ set_viewport_no_notify(struct gl_context *ctx, unsigned idx,
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, 0, GL_VIEWPORT_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_VIEWPORT;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_VIEWPORT);
|
||||
|
||||
ctx->ViewportArray[idx].X = x;
|
||||
ctx->ViewportArray[idx].Width = width;
|
||||
@@ -297,7 +297,7 @@ set_depth_range_no_notify(struct gl_context *ctx, unsigned idx,
|
||||
|
||||
/* The depth range is needed by program state constants. */
|
||||
FLUSH_VERTICES(ctx, _NEW_VIEWPORT, GL_VIEWPORT_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_VIEWPORT;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_VIEWPORT);
|
||||
|
||||
ctx->ViewportArray[idx].Near = SATURATE(nearval);
|
||||
ctx->ViewportArray[idx].Far = SATURATE(farval);
|
||||
@@ -511,13 +511,13 @@ clip_control(struct gl_context *ctx, GLenum origin, GLenum depth, bool no_error)
|
||||
|
||||
/* Affects transform state and the viewport transform */
|
||||
FLUSH_VERTICES(ctx, 0, GL_TRANSFORM_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_VIEWPORT | ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE2(ctx->NewDriverState, ST_NEW_VIEWPORT, ST_NEW_RASTERIZER);
|
||||
|
||||
if (ctx->Transform.ClipOrigin != origin) {
|
||||
ctx->Transform.ClipOrigin = origin;
|
||||
|
||||
/* Affects the winding order of the front face. */
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
}
|
||||
|
||||
if (ctx->Transform.ClipDepthMode != depth) {
|
||||
@@ -600,7 +600,7 @@ subpixel_precision_bias(struct gl_context *ctx, GLuint xbits, GLuint ybits)
|
||||
ctx->SubpixelPrecisionBias[0] = xbits;
|
||||
ctx->SubpixelPrecisionBias[1] = ybits;
|
||||
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
}
|
||||
|
||||
void GLAPIENTRY
|
||||
@@ -656,7 +656,7 @@ set_viewport_swizzle(struct gl_context *ctx, GLuint index,
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_VIEWPORT, GL_VIEWPORT_BIT);
|
||||
ctx->NewDriverState |= ST_NEW_VIEWPORT;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_VIEWPORT);
|
||||
|
||||
viewport->SwizzleX = swizzlex;
|
||||
viewport->SwizzleY = swizzley;
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#define ST_ATOM_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "util/bitset.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -73,101 +74,85 @@ st_create_gallium_vertex_state(struct gl_context *ctx,
|
||||
struct gl_buffer_object *indexbuf,
|
||||
uint32_t enabled_attribs);
|
||||
|
||||
/* Define ST_NEW_xxx_INDEX */
|
||||
/* Define ST_NEW_xxx */
|
||||
enum {
|
||||
#define ST_STATE(FLAG, st_update) FLAG##_INDEX,
|
||||
#define ST_STATE(FLAG, st_update) FLAG,
|
||||
#include "st_atom_list.h"
|
||||
#undef ST_STATE
|
||||
ST_NUM_ATOMS,
|
||||
};
|
||||
|
||||
/* Define ST_NEW_xxx values as static const uint64_t values.
|
||||
* We can't use an enum type because MSVC doesn't allow 64-bit enum values.
|
||||
*/
|
||||
#define ST_STATE(FLAG, st_update) static const uint64_t FLAG = 1ull << FLAG##_INDEX;
|
||||
#include "st_atom_list.h"
|
||||
#undef ST_STATE
|
||||
|
||||
/* Declare function prototypes. */
|
||||
#define ST_STATE(FLAG, st_update) void st_update(struct st_context *st);
|
||||
#include "st_atom_list.h"
|
||||
#undef ST_STATE
|
||||
|
||||
/* Combined state flags. */
|
||||
#define ST_NEW_SAMPLERS (ST_NEW_VS_SAMPLERS | \
|
||||
ST_NEW_TCS_SAMPLERS | \
|
||||
ST_NEW_TES_SAMPLERS | \
|
||||
ST_NEW_GS_SAMPLERS | \
|
||||
ST_NEW_FS_SAMPLERS | \
|
||||
ST_NEW_CS_SAMPLERS)
|
||||
typedef BITSET_DECLARE(st_state_bitset, ST_NUM_ATOMS);
|
||||
|
||||
#define ST_NEW_FRAMEBUFFER (ST_NEW_FB_STATE | \
|
||||
ST_NEW_SAMPLE_STATE | \
|
||||
ST_NEW_SAMPLE_SHADING)
|
||||
#define ST_SET_STATE(bitset, state) BITSET_SET(bitset, state)
|
||||
#define ST_SET_STATE2(bitset, state1, state2) \
|
||||
do { \
|
||||
ST_SET_STATE(bitset, state1); \
|
||||
ST_SET_STATE(bitset, state2); \
|
||||
} while (0)
|
||||
#define ST_SET_STATE3(bitset, state1, state2, state3) \
|
||||
do { \
|
||||
ST_SET_STATE2(bitset, state1, state2); \
|
||||
ST_SET_STATE(bitset, state3); \
|
||||
} while (0)
|
||||
#define ST_SET_STATE4(bitset, state1, state2, state3, state4) \
|
||||
do { \
|
||||
ST_SET_STATE3(bitset, state1, state2, state3); \
|
||||
ST_SET_STATE(bitset, state4); \
|
||||
} while (0)
|
||||
|
||||
#define ST_NEW_VERTEX_PROGRAM(ctx, p) ((p)->affected_states | \
|
||||
(st_user_clip_planes_enabled(ctx) ? \
|
||||
ST_NEW_CLIP_STATE : 0))
|
||||
#define ST_SET_STATES(bitset1, bitset2) BITSET_OR(bitset1, bitset1, bitset2)
|
||||
|
||||
#define ST_NEW_CONSTANTS (ST_NEW_VS_CONSTANTS | \
|
||||
ST_NEW_TCS_CONSTANTS | \
|
||||
ST_NEW_TES_CONSTANTS | \
|
||||
ST_NEW_FS_CONSTANTS | \
|
||||
ST_NEW_GS_CONSTANTS | \
|
||||
ST_NEW_CS_CONSTANTS)
|
||||
#define ST_SET_SHADER_STATES(bitset, state) \
|
||||
do { \
|
||||
ST_SET_STATE3(bitset, ST_NEW_VS_##state, ST_NEW_TCS_##state, ST_NEW_TES_##state); \
|
||||
ST_SET_STATE3(bitset, ST_NEW_GS_##state, ST_NEW_FS_##state, ST_NEW_CS_##state); \
|
||||
} while (0)
|
||||
|
||||
#define ST_NEW_UNIFORM_BUFFER (ST_NEW_VS_UBOS | \
|
||||
ST_NEW_TCS_UBOS | \
|
||||
ST_NEW_TES_UBOS | \
|
||||
ST_NEW_FS_UBOS | \
|
||||
ST_NEW_GS_UBOS | \
|
||||
ST_NEW_CS_UBOS)
|
||||
#define ST_SET_FRAMEBUFFER_STATES(bitset) \
|
||||
ST_SET_STATE3(bitset, ST_NEW_FB_STATE, ST_NEW_SAMPLE_STATE, ST_NEW_SAMPLE_SHADING)
|
||||
|
||||
#define ST_NEW_SAMPLER_VIEWS (ST_NEW_VS_SAMPLER_VIEWS | \
|
||||
ST_NEW_FS_SAMPLER_VIEWS | \
|
||||
ST_NEW_GS_SAMPLER_VIEWS | \
|
||||
ST_NEW_TCS_SAMPLER_VIEWS | \
|
||||
ST_NEW_TES_SAMPLER_VIEWS | \
|
||||
ST_NEW_CS_SAMPLER_VIEWS)
|
||||
#define ST_SET_VERTEX_PROGRAM_STATES(bitset, ctx, p) \
|
||||
do { \
|
||||
BITSET_OR(bitset, bitset, (p)->affected_states); \
|
||||
if (st_user_clip_planes_enabled(ctx)) \
|
||||
ST_SET_STATE(bitset, ST_NEW_CLIP_STATE); \
|
||||
} while (0)
|
||||
|
||||
#define ST_NEW_ATOMIC_BUFFER (ST_NEW_VS_ATOMICS | \
|
||||
ST_NEW_TCS_ATOMICS | \
|
||||
ST_NEW_TES_ATOMICS | \
|
||||
ST_NEW_FS_ATOMICS | \
|
||||
ST_NEW_GS_ATOMICS | \
|
||||
ST_NEW_CS_ATOMICS)
|
||||
#define ST_SET_ALL_STATES(bitset) \
|
||||
BITSET_SET_RANGE(bitset, 0, ST_NUM_ATOMS - 1)
|
||||
|
||||
#define ST_NEW_STORAGE_BUFFER (ST_NEW_VS_SSBOS | \
|
||||
ST_NEW_TCS_SSBOS | \
|
||||
ST_NEW_TES_SSBOS | \
|
||||
ST_NEW_FS_SSBOS | \
|
||||
ST_NEW_GS_SSBOS | \
|
||||
ST_NEW_CS_SSBOS)
|
||||
#define ST_SHADER_STATE_MASK(bitset, shader) \
|
||||
ST_SET_STATE4(bitset, ST_NEW_##shader##_STATE, ST_NEW_##shader##_SAMPLER_VIEWS, \
|
||||
ST_NEW_##shader##_SAMPLERS, ST_NEW_##shader##_CONSTANTS); \
|
||||
ST_SET_STATE4(bitset, ST_NEW_##shader##_UBOS, ST_NEW_##shader##_ATOMICS, \
|
||||
ST_NEW_##shader##_SSBOS, ST_NEW_##shader##_IMAGES);
|
||||
|
||||
#define ST_NEW_IMAGE_UNITS (ST_NEW_VS_IMAGES | \
|
||||
ST_NEW_TCS_IMAGES | \
|
||||
ST_NEW_TES_IMAGES | \
|
||||
ST_NEW_GS_IMAGES | \
|
||||
ST_NEW_FS_IMAGES | \
|
||||
ST_NEW_CS_IMAGES)
|
||||
#define ST_PIPELINE_RENDER_STATE_MASK(bitset) \
|
||||
st_state_bitset bitset = {0}; \
|
||||
ST_SHADER_STATE_MASK(bitset, CS); \
|
||||
BITSET_NOT(bitset);
|
||||
|
||||
#define ST_ALL_SHADER_RESOURCES (ST_NEW_SAMPLER_VIEWS | \
|
||||
ST_NEW_SAMPLERS | \
|
||||
ST_NEW_UNIFORM_BUFFER | \
|
||||
ST_NEW_ATOMIC_BUFFER | \
|
||||
ST_NEW_STORAGE_BUFFER | \
|
||||
ST_NEW_IMAGE_UNITS)
|
||||
#define ST_PIPELINE_RENDER_STATE_MASK_NO_VARRAYS(bitset) \
|
||||
ST_PIPELINE_RENDER_STATE_MASK(bitset); \
|
||||
BITSET_CLEAR(bitset, ST_NEW_VERTEX_ARRAYS);
|
||||
|
||||
#define ST_PIPELINE_CLEAR_STATE_MASK(bitset) \
|
||||
st_state_bitset bitset = {0}; \
|
||||
ST_SET_STATE3(bitset, ST_NEW_FB_STATE, ST_NEW_SCISSOR, ST_NEW_WINDOW_RECTANGLES);
|
||||
|
||||
#define ST_PIPELINE_META_STATE_MASK(bitset) \
|
||||
ST_PIPELINE_RENDER_STATE_MASK_NO_VARRAYS(bitset)
|
||||
|
||||
/* All state flags within each group: */
|
||||
#define ST_PIPELINE_RENDER_STATE_MASK (ST_NEW_CS_STATE - 1)
|
||||
#define ST_PIPELINE_RENDER_STATE_MASK_NO_VARRAYS \
|
||||
(ST_PIPELINE_RENDER_STATE_MASK & ~ST_NEW_VERTEX_ARRAYS)
|
||||
#define ST_PIPELINE_CLEAR_STATE_MASK (ST_NEW_FB_STATE | \
|
||||
ST_NEW_SCISSOR | \
|
||||
ST_NEW_WINDOW_RECTANGLES)
|
||||
#define ST_PIPELINE_META_STATE_MASK ST_PIPELINE_RENDER_STATE_MASK_NO_VARRAYS
|
||||
/* For ReadPixels, ReadBuffer, GetSamplePosition: */
|
||||
#define ST_PIPELINE_UPDATE_FB_STATE_MASK (ST_NEW_FB_STATE)
|
||||
#define ST_PIPELINE_UPDATE_FB_STATE_MASK(bitset) \
|
||||
st_state_bitset bitset = {0}; \
|
||||
ST_SET_STATE(bitset, ST_NEW_FB_STATE);
|
||||
|
||||
/* We add the ST_NEW_FB_STATE bit here as well, because glBindFramebuffer
|
||||
* acts as a barrier that breaks feedback loops between the framebuffer
|
||||
@@ -175,11 +160,10 @@ enum {
|
||||
* accessed by compute shaders; so we must inform the driver of new
|
||||
* framebuffer state.
|
||||
*/
|
||||
#define ST_PIPELINE_COMPUTE_STATE_MASK ((0xffull << ST_NEW_CS_STATE_INDEX) | \
|
||||
ST_NEW_FB_STATE)
|
||||
|
||||
#define ST_ALL_STATES_MASK (ST_PIPELINE_RENDER_STATE_MASK | \
|
||||
ST_PIPELINE_COMPUTE_STATE_MASK)
|
||||
#define ST_PIPELINE_COMPUTE_STATE_MASK(bitset) \
|
||||
st_state_bitset bitset = {0}; \
|
||||
ST_SHADER_STATE_MASK(bitset, CS); \
|
||||
ST_SET_STATE(bitset, ST_NEW_FB_STATE);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -652,7 +652,7 @@ st_update_array(struct st_context *st)
|
||||
void
|
||||
st_init_update_array(struct st_context *st)
|
||||
{
|
||||
st_update_func_t *func = &st->update_functions[ST_NEW_VERTEX_ARRAYS_INDEX];
|
||||
st_update_func_t *func = &st->update_functions[ST_NEW_VERTEX_ARRAYS];
|
||||
|
||||
if (util_get_cpu_caps()->has_popcnt) {
|
||||
if (st->ctx->Const.UseVAOFastPath)
|
||||
|
||||
@@ -286,8 +286,7 @@ restore_render_state(struct gl_context *ctx)
|
||||
st->state.num_sampler_views[MESA_SHADER_FRAGMENT] = 0;
|
||||
|
||||
ctx->Array.NewVertexElements = true;
|
||||
ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS |
|
||||
ST_NEW_FS_SAMPLER_VIEWS;
|
||||
ST_SET_STATE2(ctx->NewDriverState, ST_NEW_VERTEX_ARRAYS, ST_NEW_FS_SAMPLER_VIEWS);
|
||||
}
|
||||
|
||||
|
||||
@@ -347,7 +346,7 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
|
||||
restore_render_state(ctx);
|
||||
|
||||
/* We uploaded modified constants, need to invalidate them. */
|
||||
ctx->NewDriverState |= ST_NEW_FS_CONSTANTS;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_FS_CONSTANTS);
|
||||
}
|
||||
|
||||
|
||||
@@ -639,7 +638,11 @@ st_Bitmap(struct gl_context *ctx, GLint x, GLint y,
|
||||
* for bitmap drawing uses no constants and the FS constants are
|
||||
* explicitly uploaded in the draw_bitmap_quad() function.
|
||||
*/
|
||||
st_validate_state(st, ST_PIPELINE_META_STATE_MASK & ~ST_NEW_CONSTANTS);
|
||||
ST_PIPELINE_META_STATE_MASK(mask);
|
||||
st_state_bitset constants = {0};
|
||||
ST_SET_SHADER_STATES(constants, CONSTANTS);
|
||||
BITSET_ANDNOT(mask, mask, constants);
|
||||
st_validate_state(st, mask);
|
||||
|
||||
struct pipe_sampler_view *view = NULL;
|
||||
|
||||
|
||||
@@ -321,8 +321,7 @@ clear_with_quad(struct gl_context *ctx, unsigned clear_buffers)
|
||||
/* Restore pipe state */
|
||||
cso_restore_state(cso, 0);
|
||||
ctx->Array.NewVertexElements = true;
|
||||
ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS |
|
||||
ST_NEW_FS_CONSTANTS;
|
||||
ST_SET_STATE2(ctx->NewDriverState, ST_NEW_VERTEX_ARRAYS, ST_NEW_FS_CONSTANTS);
|
||||
}
|
||||
|
||||
|
||||
@@ -396,7 +395,8 @@ st_Clear(struct gl_context *ctx, GLbitfield mask)
|
||||
st_invalidate_readpix_cache(st);
|
||||
|
||||
/* This makes sure the pipe has the latest scissor, etc values */
|
||||
st_validate_state(st, ST_PIPELINE_CLEAR_STATE_MASK);
|
||||
ST_PIPELINE_CLEAR_STATE_MASK(pipeline_mask);
|
||||
st_validate_state(st, pipeline_mask);
|
||||
|
||||
if (mask & BUFFER_BITS_COLOR) {
|
||||
for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {
|
||||
|
||||
@@ -928,8 +928,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
|
||||
st->state.num_sampler_views[MESA_SHADER_FRAGMENT] = 0;
|
||||
|
||||
ctx->Array.NewVertexElements = true;
|
||||
ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS |
|
||||
ST_NEW_FS_SAMPLER_VIEWS;
|
||||
ST_SET_STATE2(ctx->NewDriverState, ST_NEW_VERTEX_ARRAYS, ST_NEW_FS_SAMPLER_VIEWS);
|
||||
}
|
||||
|
||||
|
||||
@@ -1273,7 +1272,8 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
|
||||
st_flush_bitmap_cache(st);
|
||||
st_invalidate_readpix_cache(st);
|
||||
|
||||
st_validate_state(st, ST_PIPELINE_META_STATE_MASK);
|
||||
ST_PIPELINE_META_STATE_MASK(mask);
|
||||
st_validate_state(st, mask);
|
||||
|
||||
clippedUnpack = *unpack;
|
||||
unpack = &clippedUnpack;
|
||||
@@ -1676,7 +1676,8 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
|
||||
st_flush_bitmap_cache(st);
|
||||
st_invalidate_readpix_cache(st);
|
||||
|
||||
st_validate_state(st, ST_PIPELINE_META_STATE_MASK);
|
||||
ST_PIPELINE_META_STATE_MASK(mask);
|
||||
st_validate_state(st, mask);
|
||||
|
||||
if (blit_copy_pixels(ctx, srcx, srcy, width, height, dstx, dsty, type))
|
||||
return;
|
||||
|
||||
@@ -135,7 +135,8 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
|
||||
st_flush_bitmap_cache(st);
|
||||
st_invalidate_readpix_cache(st);
|
||||
|
||||
st_validate_state(st, ST_PIPELINE_META_STATE_MASK);
|
||||
ST_PIPELINE_META_STATE_MASK(mask);
|
||||
st_validate_state(st, mask);
|
||||
|
||||
/* determine if we need vertex color */
|
||||
if (ctx->FragmentProgram._Current->info.inputs_read & VARYING_BIT_COL0)
|
||||
@@ -302,7 +303,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
|
||||
/* restore state */
|
||||
cso_restore_state(cso, 0);
|
||||
ctx->Array.NewVertexElements = true;
|
||||
ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_VERTEX_ARRAYS);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -313,10 +313,11 @@ st_RenderMode(struct gl_context *ctx, GLenum newMode )
|
||||
ctx->Driver.DrawGalliumMultiMode = st_feedback_draw_vbo_multi_mode;
|
||||
/* need to generate/use a vertex program that emits pos/color/tex */
|
||||
if (vp)
|
||||
ctx->NewDriverState |= ST_NEW_VERTEX_PROGRAM(ctx, vp);
|
||||
ST_SET_VERTEX_PROGRAM_STATES(ctx->NewDriverState, ctx, vp);
|
||||
}
|
||||
|
||||
/* Restore geometry shader states when leaving GL_SELECT mode. */
|
||||
if (ctx->RenderMode == GL_SELECT && ctx->Const.HardwareAcceleratedSelect)
|
||||
ctx->NewDriverState |= ST_NEW_GS_SSBOS | ST_NEW_GS_CONSTANTS | ST_NEW_GS_STATE;
|
||||
ST_SET_STATE3(ctx->NewDriverState, ST_NEW_GS_SSBOS, ST_NEW_GS_CONSTANTS,
|
||||
ST_NEW_GS_STATE);
|
||||
}
|
||||
|
||||
@@ -251,7 +251,8 @@ st_RasterPos(struct gl_context *ctx, const GLfloat v[4])
|
||||
draw_set_rasterize_stage(st->draw, st->rastpos_stage);
|
||||
|
||||
/* make sure everything's up to date */
|
||||
st_validate_state(st, ST_PIPELINE_RENDER_STATE_MASK);
|
||||
ST_PIPELINE_RENDER_STATE_MASK(mask);
|
||||
st_validate_state(st, mask);
|
||||
|
||||
/* This will get set only if rastpos_point(), above, gets called */
|
||||
ctx->PopAttribState |= GL_CURRENT_BIT;
|
||||
@@ -261,7 +262,7 @@ st_RasterPos(struct gl_context *ctx, const GLfloat v[4])
|
||||
* Just plug in position pointer now.
|
||||
*/
|
||||
rs->VAO->VertexAttrib[VERT_ATTRIB_POS].Ptr = (GLubyte *) v;
|
||||
ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_VERTEX_ARRAYS);
|
||||
|
||||
/* The slow path merges vertex buffers, which changes vertex elements. */
|
||||
if (!ctx->Const.UseVAOFastPath) {
|
||||
@@ -277,7 +278,8 @@ st_RasterPos(struct gl_context *ctx, const GLfloat v[4])
|
||||
_mesa_set_varying_vp_inputs(ctx, VERT_BIT_POS &
|
||||
ctx->Array._DrawVAO->_EnabledWithMapMode);
|
||||
|
||||
st_prepare_draw(ctx, ST_PIPELINE_RENDER_STATE_MASK);
|
||||
ST_PIPELINE_RENDER_STATE_MASK(pipeline_mask);
|
||||
st_prepare_draw(ctx, pipeline_mask);
|
||||
st_feedback_draw_vbo(ctx, &rs->info, 0, NULL, &rs->draw, 1);
|
||||
|
||||
_mesa_restore_draw_vao(ctx, old_vao, old_vp_input_filter);
|
||||
|
||||
@@ -260,10 +260,9 @@ fail:
|
||||
st->state.num_sampler_views[MESA_SHADER_FRAGMENT] = 0;
|
||||
|
||||
st->ctx->Array.NewVertexElements = true;
|
||||
st->ctx->NewDriverState |= ST_NEW_FS_CONSTANTS |
|
||||
ST_NEW_FS_IMAGES |
|
||||
ST_NEW_FS_SAMPLER_VIEWS |
|
||||
ST_NEW_VERTEX_ARRAYS;
|
||||
ST_SET_STATE4(st->ctx->NewDriverState, ST_NEW_FS_CONSTANTS,
|
||||
ST_NEW_FS_IMAGES, ST_NEW_FS_SAMPLER_VIEWS,
|
||||
ST_NEW_VERTEX_ARRAYS);
|
||||
|
||||
return success;
|
||||
}
|
||||
@@ -433,7 +432,8 @@ st_ReadPixels(struct gl_context *ctx, GLint x, GLint y,
|
||||
|
||||
/* Validate state (to be sure we have up-to-date framebuffer surfaces)
|
||||
* and flush the bitmap cache prior to reading. */
|
||||
st_validate_state(st, ST_PIPELINE_UPDATE_FB_STATE_MASK);
|
||||
ST_PIPELINE_UPDATE_FB_STATE_MASK(mask);
|
||||
st_validate_state(st, mask);
|
||||
st_flush_bitmap_cache(st);
|
||||
|
||||
if (rb->TexImage && st->force_compute_based_texture_transfer)
|
||||
|
||||
@@ -1833,9 +1833,8 @@ fail:
|
||||
st->state.num_sampler_views[MESA_SHADER_FRAGMENT] = 0;
|
||||
|
||||
ctx->Array.NewVertexElements = true;
|
||||
ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS |
|
||||
ST_NEW_FS_CONSTANTS |
|
||||
ST_NEW_FS_SAMPLER_VIEWS;
|
||||
ST_SET_STATE3(ctx->NewDriverState, ST_NEW_VERTEX_ARRAYS,
|
||||
ST_NEW_FS_CONSTANTS, ST_NEW_FS_SAMPLER_VIEWS);
|
||||
|
||||
return success;
|
||||
}
|
||||
@@ -2115,10 +2114,9 @@ fail:
|
||||
st->state.num_sampler_views[MESA_SHADER_FRAGMENT] = 0;
|
||||
|
||||
st->ctx->Array.NewVertexElements = true;
|
||||
st->ctx->NewDriverState |= ST_NEW_FS_CONSTANTS |
|
||||
ST_NEW_FS_IMAGES |
|
||||
ST_NEW_FS_SAMPLER_VIEWS |
|
||||
ST_NEW_VERTEX_ARRAYS;
|
||||
ST_SET_STATE4(st->ctx->NewDriverState, ST_NEW_FS_CONSTANTS,
|
||||
ST_NEW_FS_IMAGES, ST_NEW_FS_SAMPLER_VIEWS,
|
||||
ST_NEW_VERTEX_ARRAYS);
|
||||
|
||||
return success;
|
||||
}
|
||||
@@ -3279,7 +3277,7 @@ st_finalize_texture(struct gl_context *ctx,
|
||||
*/
|
||||
pipe_resource_reference(&tObj->pt, NULL);
|
||||
st_texture_release_all_sampler_views(st, tObj);
|
||||
ctx->NewDriverState |= ST_NEW_FRAMEBUFFER;
|
||||
ST_SET_FRAMEBUFFER_STATES(ctx->NewDriverState);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,17 +75,12 @@
|
||||
void
|
||||
st_invalidate_buffers(struct st_context *st)
|
||||
{
|
||||
st->ctx->NewDriverState |= ST_NEW_BLEND |
|
||||
ST_NEW_DSA |
|
||||
ST_NEW_FB_STATE |
|
||||
ST_NEW_SAMPLE_STATE |
|
||||
ST_NEW_SAMPLE_SHADING |
|
||||
ST_NEW_FS_STATE |
|
||||
ST_NEW_POLY_STIPPLE |
|
||||
ST_NEW_VIEWPORT |
|
||||
ST_NEW_RASTERIZER |
|
||||
ST_NEW_SCISSOR |
|
||||
ST_NEW_WINDOW_RECTANGLES;
|
||||
ST_SET_STATE4(st->ctx->NewDriverState, ST_NEW_BLEND, ST_NEW_DSA,
|
||||
ST_NEW_FB_STATE, ST_NEW_SAMPLE_STATE);
|
||||
ST_SET_STATE4(st->ctx->NewDriverState, ST_NEW_SAMPLE_SHADING,
|
||||
ST_NEW_FS_STATE, ST_NEW_POLY_STIPPLE, ST_NEW_VIEWPORT);
|
||||
ST_SET_STATE3(st->ctx->NewDriverState, ST_NEW_RASTERIZER,
|
||||
ST_NEW_SCISSOR, ST_NEW_WINDOW_RECTANGLES);
|
||||
}
|
||||
|
||||
|
||||
@@ -111,59 +106,62 @@ st_invalidate_state(struct gl_context *ctx)
|
||||
* check them when _NEW_BUFFERS isn't set.
|
||||
*/
|
||||
if (new_state & _NEW_FOG)
|
||||
ctx->NewDriverState |= ST_NEW_FS_STATE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_FS_STATE);
|
||||
}
|
||||
|
||||
if (new_state & (_NEW_LIGHT_STATE |
|
||||
_NEW_POINT))
|
||||
ctx->NewDriverState |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_RASTERIZER);
|
||||
|
||||
if ((new_state & _NEW_LIGHT_STATE) &&
|
||||
(st->lower_flatshade || st->lower_two_sided_color))
|
||||
ctx->NewDriverState |= ST_NEW_FS_STATE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_FS_STATE);
|
||||
|
||||
if (new_state & _NEW_PROJECTION &&
|
||||
st_user_clip_planes_enabled(ctx))
|
||||
ctx->NewDriverState |= ST_NEW_CLIP_STATE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_CLIP_STATE);
|
||||
|
||||
if (new_state & _NEW_PIXEL)
|
||||
ctx->NewDriverState |= ST_NEW_PIXEL_TRANSFER;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_PIXEL_TRANSFER);
|
||||
|
||||
if (new_state & _NEW_CURRENT_ATTRIB && st_vp_uses_current_values(ctx)) {
|
||||
ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_VERTEX_ARRAYS);
|
||||
/* glColor3f -> glColor4f changes the vertex format. */
|
||||
ctx->Array.NewVertexElements = true;
|
||||
}
|
||||
|
||||
/* Update the vertex shader if ctx->Light._ClampVertexColor was changed. */
|
||||
if (st->clamp_vert_color_in_shader && (new_state & _NEW_LIGHT_STATE)) {
|
||||
ctx->NewDriverState |= ST_NEW_VS_STATE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_VS_STATE);
|
||||
if (_mesa_is_desktop_gl_compat(st->ctx) && ctx->Version >= 32) {
|
||||
ctx->NewDriverState |= ST_NEW_GS_STATE | ST_NEW_TES_STATE;
|
||||
ST_SET_STATE2(ctx->NewDriverState, ST_NEW_GS_STATE, ST_NEW_TES_STATE);
|
||||
}
|
||||
}
|
||||
|
||||
/* Update the vertex shader if ctx->Point was changed. */
|
||||
if (st->lower_point_size && new_state & _NEW_POINT) {
|
||||
if (ctx->GeometryProgram._Current)
|
||||
ctx->NewDriverState |= ST_NEW_GS_STATE | ST_NEW_GS_CONSTANTS;
|
||||
ST_SET_STATE2(ctx->NewDriverState, ST_NEW_GS_STATE, ST_NEW_GS_CONSTANTS);
|
||||
else if (ctx->TessEvalProgram._Current)
|
||||
ctx->NewDriverState |= ST_NEW_TES_STATE | ST_NEW_TES_CONSTANTS;
|
||||
ST_SET_STATE2(ctx->NewDriverState, ST_NEW_TES_STATE, ST_NEW_TES_CONSTANTS);
|
||||
else
|
||||
ctx->NewDriverState |= ST_NEW_VS_STATE | ST_NEW_VS_CONSTANTS;
|
||||
ST_SET_STATE2(ctx->NewDriverState, ST_NEW_VS_STATE, ST_NEW_VS_CONSTANTS);
|
||||
}
|
||||
|
||||
if (new_state & _NEW_TEXTURE_OBJECT) {
|
||||
ctx->NewDriverState |= st->active_states &
|
||||
(ST_NEW_SAMPLER_VIEWS |
|
||||
ST_NEW_SAMPLERS |
|
||||
ST_NEW_IMAGE_UNITS);
|
||||
st_state_bitset states = {0};
|
||||
ST_SET_SHADER_STATES(ctx->NewDriverState, SAMPLER_VIEWS);
|
||||
ST_SET_SHADER_STATES(ctx->NewDriverState, SAMPLERS);
|
||||
ST_SET_SHADER_STATES(ctx->NewDriverState, IMAGES);
|
||||
BITSET_AND(states, states, st->active_states);
|
||||
ST_SET_STATES(ctx->NewDriverState, states);
|
||||
|
||||
if (ctx->FragmentProgram._Current) {
|
||||
struct gl_program *fp = ctx->FragmentProgram._Current;
|
||||
|
||||
if (fp->ExternalSamplersUsed || fp->ati_fs ||
|
||||
(!fp->shader_program && fp->ShadowSamplers))
|
||||
ctx->NewDriverState |= ST_NEW_FS_STATE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_FS_STATE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -284,27 +282,27 @@ free_zombie_shaders(struct st_context *st)
|
||||
|
||||
switch (entry->type) {
|
||||
case MESA_SHADER_VERTEX:
|
||||
st->ctx->NewDriverState |= ST_NEW_VS_STATE;
|
||||
ST_SET_STATE(st->ctx->NewDriverState, ST_NEW_VS_STATE);
|
||||
st->pipe->delete_vs_state(st->pipe, entry->shader);
|
||||
break;
|
||||
case MESA_SHADER_FRAGMENT:
|
||||
st->ctx->NewDriverState |= ST_NEW_FS_STATE;
|
||||
ST_SET_STATE(st->ctx->NewDriverState, ST_NEW_FS_STATE);
|
||||
st->pipe->delete_fs_state(st->pipe, entry->shader);
|
||||
break;
|
||||
case MESA_SHADER_GEOMETRY:
|
||||
st->ctx->NewDriverState |= ST_NEW_GS_STATE;
|
||||
ST_SET_STATE(st->ctx->NewDriverState, ST_NEW_GS_STATE);
|
||||
st->pipe->delete_gs_state(st->pipe, entry->shader);
|
||||
break;
|
||||
case MESA_SHADER_TESS_CTRL:
|
||||
st->ctx->NewDriverState |= ST_NEW_TCS_STATE;
|
||||
ST_SET_STATE(st->ctx->NewDriverState, ST_NEW_TCS_STATE);
|
||||
st->pipe->delete_tcs_state(st->pipe, entry->shader);
|
||||
break;
|
||||
case MESA_SHADER_TESS_EVAL:
|
||||
st->ctx->NewDriverState |= ST_NEW_TES_STATE;
|
||||
ST_SET_STATE(st->ctx->NewDriverState, ST_NEW_TES_STATE);
|
||||
st->pipe->delete_tes_state(st->pipe, entry->shader);
|
||||
break;
|
||||
case MESA_SHADER_COMPUTE:
|
||||
st->ctx->NewDriverState |= ST_NEW_CS_STATE;
|
||||
ST_SET_STATE(st->ctx->NewDriverState, ST_NEW_CS_STATE);
|
||||
st->pipe->delete_compute_state(st->pipe, entry->shader);
|
||||
break;
|
||||
default:
|
||||
@@ -368,52 +366,53 @@ st_init_driver_flags(struct st_context *st)
|
||||
|
||||
/* Shader resources */
|
||||
if (st->has_hw_atomics)
|
||||
f->NewAtomicBuffer = ST_NEW_HW_ATOMICS | ST_NEW_CS_ATOMICS;
|
||||
ST_SET_STATE2(f->NewAtomicBuffer, ST_NEW_HW_ATOMICS, ST_NEW_CS_ATOMICS);
|
||||
else
|
||||
f->NewAtomicBuffer = ST_NEW_ATOMIC_BUFFER;
|
||||
ST_SET_SHADER_STATES(f->NewAtomicBuffer, ATOMICS);
|
||||
|
||||
f->NewShaderConstants[MESA_SHADER_VERTEX] = ST_NEW_VS_CONSTANTS;
|
||||
f->NewShaderConstants[MESA_SHADER_TESS_CTRL] = ST_NEW_TCS_CONSTANTS;
|
||||
f->NewShaderConstants[MESA_SHADER_TESS_EVAL] = ST_NEW_TES_CONSTANTS;
|
||||
f->NewShaderConstants[MESA_SHADER_GEOMETRY] = ST_NEW_GS_CONSTANTS;
|
||||
f->NewShaderConstants[MESA_SHADER_FRAGMENT] = ST_NEW_FS_CONSTANTS;
|
||||
f->NewShaderConstants[MESA_SHADER_COMPUTE] = ST_NEW_CS_CONSTANTS;
|
||||
ST_SET_STATE(f->NewShaderConstants[MESA_SHADER_VERTEX], ST_NEW_VS_CONSTANTS);
|
||||
ST_SET_STATE(f->NewShaderConstants[MESA_SHADER_TESS_CTRL], ST_NEW_TCS_CONSTANTS);
|
||||
ST_SET_STATE(f->NewShaderConstants[MESA_SHADER_TESS_EVAL], ST_NEW_TES_CONSTANTS);
|
||||
ST_SET_STATE(f->NewShaderConstants[MESA_SHADER_GEOMETRY], ST_NEW_GS_CONSTANTS);
|
||||
ST_SET_STATE(f->NewShaderConstants[MESA_SHADER_FRAGMENT], ST_NEW_FS_CONSTANTS);
|
||||
ST_SET_STATE(f->NewShaderConstants[MESA_SHADER_COMPUTE], ST_NEW_CS_CONSTANTS);
|
||||
|
||||
if (st->lower_alpha_test)
|
||||
f->NewAlphaTest = ST_NEW_FS_STATE | ST_NEW_FS_CONSTANTS;
|
||||
ST_SET_STATE2(f->NewAlphaTest, ST_NEW_FS_STATE, ST_NEW_FS_CONSTANTS);
|
||||
else
|
||||
f->NewAlphaTest = ST_NEW_DSA;
|
||||
ST_SET_STATE(f->NewAlphaTest, ST_NEW_DSA);
|
||||
|
||||
f->NewMultisampleEnable = ST_NEW_BLEND | ST_NEW_RASTERIZER |
|
||||
ST_NEW_SAMPLE_STATE | ST_NEW_SAMPLE_SHADING;
|
||||
f->NewSampleShading = ST_NEW_SAMPLE_SHADING;
|
||||
ST_SET_STATE4(f->NewMultisampleEnable, ST_NEW_BLEND, ST_NEW_RASTERIZER,
|
||||
ST_NEW_SAMPLE_STATE, ST_NEW_SAMPLE_SHADING);
|
||||
ST_SET_STATE(f->NewSampleShading, ST_NEW_SAMPLE_SHADING);
|
||||
|
||||
/* This depends on what the gallium driver wants. */
|
||||
if (st->force_persample_in_shader) {
|
||||
f->NewMultisampleEnable |= ST_NEW_FS_STATE;
|
||||
f->NewSampleShading |= ST_NEW_FS_STATE;
|
||||
ST_SET_STATE(f->NewMultisampleEnable, ST_NEW_FS_STATE);
|
||||
ST_SET_STATE(f->NewSampleShading, ST_NEW_FS_STATE);
|
||||
} else {
|
||||
f->NewSampleShading |= ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(f->NewSampleShading, ST_NEW_RASTERIZER);
|
||||
}
|
||||
|
||||
if (st->clamp_frag_color_in_shader) {
|
||||
f->NewFragClamp = ST_NEW_FS_STATE;
|
||||
ST_SET_STATE(f->NewFragClamp, ST_NEW_FS_STATE);
|
||||
} else {
|
||||
f->NewFragClamp = ST_NEW_RASTERIZER;
|
||||
ST_SET_STATE(f->NewFragClamp, ST_NEW_RASTERIZER);
|
||||
}
|
||||
|
||||
f->NewClipPlaneEnable = ST_NEW_RASTERIZER;
|
||||
if (st->lower_ucp)
|
||||
f->NewClipPlaneEnable |= ST_NEW_VS_STATE | ST_NEW_GS_STATE | ST_NEW_TES_STATE;
|
||||
ST_SET_STATE(f->NewClipPlaneEnable, ST_NEW_RASTERIZER);
|
||||
if (st->lower_ucp) {
|
||||
ST_SET_STATE3(f->NewClipPlaneEnable, ST_NEW_VS_STATE, ST_NEW_GS_STATE,
|
||||
ST_NEW_TES_STATE);
|
||||
}
|
||||
|
||||
if (st->emulate_gl_clamp)
|
||||
f->NewSamplersWithClamp = ST_NEW_SAMPLERS |
|
||||
ST_NEW_VS_STATE | ST_NEW_TCS_STATE |
|
||||
ST_NEW_TES_STATE | ST_NEW_GS_STATE |
|
||||
ST_NEW_FS_STATE | ST_NEW_CS_STATE;
|
||||
if (st->emulate_gl_clamp) {
|
||||
ST_SET_SHADER_STATES(f->NewSamplersWithClamp, SAMPLERS);
|
||||
ST_SET_SHADER_STATES(f->NewSamplersWithClamp, STATE);
|
||||
}
|
||||
|
||||
if (!st->has_hw_atomics && st->ctx->Const.ShaderStorageBufferOffsetAlignment > 4)
|
||||
f->NewAtomicBuffer |= ST_NEW_CONSTANTS;
|
||||
ST_SET_SHADER_STATES(f->NewAtomicBuffer, CONSTANTS);
|
||||
}
|
||||
|
||||
static bool
|
||||
@@ -472,9 +471,7 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe,
|
||||
st->cso_context = cso_create_context(pipe, cso_flags);
|
||||
ctx->cso_context = st->cso_context;
|
||||
|
||||
STATIC_ASSERT(ARRAY_SIZE(st->update_functions) <= 64);
|
||||
|
||||
#define ST_STATE(FLAG, st_update) st->update_functions[FLAG##_INDEX] = st_update;
|
||||
#define ST_STATE(FLAG, st_update) st->update_functions[FLAG] = st_update;
|
||||
#include "st_atom_list.h"
|
||||
#undef ST_STATE
|
||||
|
||||
@@ -763,7 +760,7 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe,
|
||||
ctx->Const.DriverSupportedPrimMask = screen->caps.supported_prim_modes |
|
||||
/* patches is always supported */
|
||||
BITFIELD_BIT(MESA_PRIM_PATCHES);
|
||||
st->active_states = _mesa_get_active_states(ctx);
|
||||
_mesa_set_active_states(ctx);
|
||||
|
||||
return st;
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ struct st_context
|
||||
} state;
|
||||
|
||||
/** This masks out unused shader resources. Only valid in draw calls. */
|
||||
uint64_t active_states;
|
||||
st_state_bitset active_states;
|
||||
|
||||
/**
|
||||
* The number of currently active queries (excluding timer queries).
|
||||
|
||||
@@ -72,7 +72,7 @@ static_assert(GL_TRIANGLE_STRIP_ADJACENCY == MESA_PRIM_TRIANGLE_STRIP_ADJACENCY,
|
||||
static_assert(GL_PATCHES == MESA_PRIM_PATCHES, "enum mismatch");
|
||||
|
||||
void
|
||||
st_prepare_draw(struct gl_context *ctx, uint64_t state_mask)
|
||||
st_prepare_draw(struct gl_context *ctx, const st_state_bitset state_mask)
|
||||
{
|
||||
struct st_context *st = ctx->st;
|
||||
|
||||
@@ -165,7 +165,8 @@ st_indirect_draw_vbo(struct gl_context *ctx,
|
||||
return;
|
||||
|
||||
assert(stride);
|
||||
st_prepare_draw(ctx, ST_PIPELINE_RENDER_STATE_MASK);
|
||||
ST_PIPELINE_RENDER_STATE_MASK(mask);
|
||||
st_prepare_draw(ctx, mask);
|
||||
|
||||
memset(&indirect, 0, sizeof(indirect));
|
||||
util_draw_init_info(&info);
|
||||
|
||||
@@ -75,7 +75,7 @@ pointer_to_offset(const void *ptr)
|
||||
}
|
||||
|
||||
void
|
||||
st_prepare_draw(struct gl_context *ctx, uint64_t state_mask);
|
||||
st_prepare_draw(struct gl_context *ctx, const st_state_bitset state_mask);
|
||||
|
||||
void
|
||||
st_draw_gallium(struct gl_context *ctx,
|
||||
|
||||
@@ -170,7 +170,7 @@ st_context_validate(struct st_context *st,
|
||||
struct gl_framebuffer *stread)
|
||||
{
|
||||
if (stdraw && stdraw->stamp != st->draw_stamp) {
|
||||
st->ctx->NewDriverState |= ST_NEW_FRAMEBUFFER;
|
||||
ST_SET_FRAMEBUFFER_STATES(st->ctx->NewDriverState);
|
||||
_mesa_resize_framebuffer(st->ctx, stdraw,
|
||||
stdraw->Width,
|
||||
stdraw->Height);
|
||||
@@ -179,7 +179,7 @@ st_context_validate(struct st_context *st,
|
||||
|
||||
if (stread && stread->stamp != st->read_stamp) {
|
||||
if (stread != stdraw) {
|
||||
st->ctx->NewDriverState |= ST_NEW_FRAMEBUFFER;
|
||||
ST_SET_FRAMEBUFFER_STATES(st->ctx->NewDriverState);
|
||||
_mesa_resize_framebuffer(st->ctx, stread,
|
||||
stread->Width,
|
||||
stread->Height);
|
||||
@@ -897,17 +897,17 @@ st_context_invalidate_state(struct st_context *st, unsigned flags)
|
||||
struct gl_context *ctx = st->ctx;
|
||||
|
||||
if (flags & ST_INVALIDATE_FS_SAMPLER_VIEWS)
|
||||
ctx->NewDriverState |= ST_NEW_FS_SAMPLER_VIEWS;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_FS_SAMPLER_VIEWS);
|
||||
if (flags & ST_INVALIDATE_FS_CONSTBUF0)
|
||||
ctx->NewDriverState |= ST_NEW_FS_CONSTANTS;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_FS_CONSTANTS);
|
||||
if (flags & ST_INVALIDATE_VS_CONSTBUF0)
|
||||
ctx->NewDriverState |= ST_NEW_VS_CONSTANTS;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_VS_CONSTANTS);
|
||||
if (flags & ST_INVALIDATE_VERTEX_BUFFERS) {
|
||||
ctx->Array.NewVertexElements = true;
|
||||
ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_VERTEX_ARRAYS);
|
||||
}
|
||||
if (flags & ST_INVALIDATE_FB_STATE)
|
||||
ctx->NewDriverState |= ST_NEW_FB_STATE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_FB_STATE);
|
||||
}
|
||||
|
||||
|
||||
@@ -1214,7 +1214,7 @@ st_manager_flush_frontbuffer(struct st_context *st)
|
||||
rb->defined = GL_FALSE;
|
||||
|
||||
/* Trigger an update of rb->defined on next draw */
|
||||
st->ctx->NewDriverState |= ST_NEW_FB_STATE;
|
||||
ST_SET_STATE(st->ctx->NewDriverState, ST_NEW_FB_STATE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1171,9 +1171,8 @@ fail:
|
||||
st->state.num_sampler_views[MESA_SHADER_COMPUTE] = 0;
|
||||
pipe->set_shader_buffers(pipe, MESA_SHADER_COMPUTE, 0, 1, NULL, 0);
|
||||
|
||||
st->ctx->NewDriverState |= ST_NEW_CS_CONSTANTS |
|
||||
ST_NEW_CS_SSBOS |
|
||||
ST_NEW_CS_SAMPLER_VIEWS;
|
||||
ST_SET_STATE3(st->ctx->NewDriverState, ST_NEW_CS_CONSTANTS,
|
||||
ST_NEW_CS_SSBOS, ST_NEW_CS_SAMPLER_VIEWS);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
@@ -72,33 +72,32 @@ static void
|
||||
destroy_program_variants(struct st_context *st, struct gl_program *target);
|
||||
|
||||
static void
|
||||
set_affected_state_flags(uint64_t *states,
|
||||
struct gl_program *prog,
|
||||
uint64_t new_constants,
|
||||
uint64_t new_sampler_views,
|
||||
uint64_t new_samplers,
|
||||
uint64_t new_images,
|
||||
uint64_t new_ubos,
|
||||
uint64_t new_ssbos,
|
||||
uint64_t new_atomics)
|
||||
set_affected_state_flags(struct gl_program *prog,
|
||||
unsigned new_constants,
|
||||
unsigned new_sampler_views,
|
||||
unsigned new_samplers,
|
||||
unsigned new_images,
|
||||
unsigned new_ubos,
|
||||
unsigned new_ssbos,
|
||||
unsigned new_atomics)
|
||||
{
|
||||
if (prog->Parameters->NumParameters)
|
||||
*states |= new_constants;
|
||||
ST_SET_STATE(prog->affected_states, new_constants);
|
||||
|
||||
if (prog->info.num_textures)
|
||||
*states |= new_sampler_views | new_samplers;
|
||||
ST_SET_STATE2(prog->affected_states, new_sampler_views, new_samplers);
|
||||
|
||||
if (prog->info.num_images)
|
||||
*states |= new_images;
|
||||
ST_SET_STATE(prog->affected_states, new_images);
|
||||
|
||||
if (prog->info.num_ubos)
|
||||
*states |= new_ubos;
|
||||
ST_SET_STATE(prog->affected_states, new_ubos);
|
||||
|
||||
if (prog->info.num_ssbos)
|
||||
*states |= new_ssbos;
|
||||
ST_SET_STATE(prog->affected_states, new_ssbos);
|
||||
|
||||
if (prog->info.num_abos)
|
||||
*states |= new_atomics;
|
||||
ST_SET_STATE(prog->affected_states, new_atomics);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,17 +106,14 @@ set_affected_state_flags(uint64_t *states,
|
||||
void
|
||||
st_set_prog_affected_state_flags(struct gl_program *prog)
|
||||
{
|
||||
uint64_t *states;
|
||||
BITSET_ZERO(prog->affected_states);
|
||||
|
||||
switch (prog->info.stage) {
|
||||
case MESA_SHADER_VERTEX:
|
||||
states = &prog->affected_states;
|
||||
ST_SET_STATE3(prog->affected_states, ST_NEW_VS_STATE,
|
||||
ST_NEW_RASTERIZER, ST_NEW_VERTEX_ARRAYS);
|
||||
|
||||
*states = ST_NEW_VS_STATE |
|
||||
ST_NEW_RASTERIZER |
|
||||
ST_NEW_VERTEX_ARRAYS;
|
||||
|
||||
set_affected_state_flags(states, prog,
|
||||
set_affected_state_flags(prog,
|
||||
ST_NEW_VS_CONSTANTS,
|
||||
ST_NEW_VS_SAMPLER_VIEWS,
|
||||
ST_NEW_VS_SAMPLERS,
|
||||
@@ -128,11 +124,9 @@ st_set_prog_affected_state_flags(struct gl_program *prog)
|
||||
break;
|
||||
|
||||
case MESA_SHADER_TESS_CTRL:
|
||||
states = &prog->affected_states;
|
||||
ST_SET_STATE(prog->affected_states, ST_NEW_TCS_STATE);
|
||||
|
||||
*states = ST_NEW_TCS_STATE;
|
||||
|
||||
set_affected_state_flags(states, prog,
|
||||
set_affected_state_flags(prog,
|
||||
ST_NEW_TCS_CONSTANTS,
|
||||
ST_NEW_TCS_SAMPLER_VIEWS,
|
||||
ST_NEW_TCS_SAMPLERS,
|
||||
@@ -143,12 +137,10 @@ st_set_prog_affected_state_flags(struct gl_program *prog)
|
||||
break;
|
||||
|
||||
case MESA_SHADER_TESS_EVAL:
|
||||
states = &prog->affected_states;
|
||||
ST_SET_STATE2(prog->affected_states, ST_NEW_TES_STATE,
|
||||
ST_NEW_RASTERIZER);
|
||||
|
||||
*states = ST_NEW_TES_STATE |
|
||||
ST_NEW_RASTERIZER;
|
||||
|
||||
set_affected_state_flags(states, prog,
|
||||
set_affected_state_flags(prog,
|
||||
ST_NEW_TES_CONSTANTS,
|
||||
ST_NEW_TES_SAMPLER_VIEWS,
|
||||
ST_NEW_TES_SAMPLERS,
|
||||
@@ -159,12 +151,10 @@ st_set_prog_affected_state_flags(struct gl_program *prog)
|
||||
break;
|
||||
|
||||
case MESA_SHADER_GEOMETRY:
|
||||
states = &prog->affected_states;
|
||||
ST_SET_STATE2(prog->affected_states, ST_NEW_GS_STATE,
|
||||
ST_NEW_RASTERIZER);
|
||||
|
||||
*states = ST_NEW_GS_STATE |
|
||||
ST_NEW_RASTERIZER;
|
||||
|
||||
set_affected_state_flags(states, prog,
|
||||
set_affected_state_flags(prog,
|
||||
ST_NEW_GS_CONSTANTS,
|
||||
ST_NEW_GS_SAMPLER_VIEWS,
|
||||
ST_NEW_GS_SAMPLERS,
|
||||
@@ -175,14 +165,11 @@ st_set_prog_affected_state_flags(struct gl_program *prog)
|
||||
break;
|
||||
|
||||
case MESA_SHADER_FRAGMENT:
|
||||
states = &prog->affected_states;
|
||||
|
||||
/* gl_FragCoord and glDrawPixels always use constants. */
|
||||
*states = ST_NEW_FS_STATE |
|
||||
ST_NEW_SAMPLE_SHADING |
|
||||
ST_NEW_FS_CONSTANTS;
|
||||
ST_SET_STATE3(prog->affected_states, ST_NEW_FS_STATE,
|
||||
ST_NEW_SAMPLE_SHADING, ST_NEW_FS_CONSTANTS);
|
||||
|
||||
set_affected_state_flags(states, prog,
|
||||
set_affected_state_flags(prog,
|
||||
ST_NEW_FS_CONSTANTS,
|
||||
ST_NEW_FS_SAMPLER_VIEWS,
|
||||
ST_NEW_FS_SAMPLERS,
|
||||
@@ -193,11 +180,9 @@ st_set_prog_affected_state_flags(struct gl_program *prog)
|
||||
break;
|
||||
|
||||
case MESA_SHADER_COMPUTE:
|
||||
states = &prog->affected_states;
|
||||
ST_SET_STATE(prog->affected_states, ST_NEW_CS_STATE);
|
||||
|
||||
*states = ST_NEW_CS_STATE;
|
||||
|
||||
set_affected_state_flags(states, prog,
|
||||
set_affected_state_flags(prog,
|
||||
ST_NEW_CS_CONSTANTS,
|
||||
ST_NEW_CS_SAMPLER_VIEWS,
|
||||
ST_NEW_CS_SAMPLERS,
|
||||
@@ -271,27 +256,27 @@ st_unbind_program(struct st_context *st, struct gl_program *p)
|
||||
switch (p->info.stage) {
|
||||
case MESA_SHADER_VERTEX:
|
||||
cso_set_vertex_shader_handle(st->cso_context, NULL);
|
||||
ctx->NewDriverState |= ST_NEW_VS_STATE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_VS_STATE);
|
||||
break;
|
||||
case MESA_SHADER_TESS_CTRL:
|
||||
cso_set_tessctrl_shader_handle(st->cso_context, NULL);
|
||||
ctx->NewDriverState |= ST_NEW_TCS_STATE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_TCS_STATE);
|
||||
break;
|
||||
case MESA_SHADER_TESS_EVAL:
|
||||
cso_set_tesseval_shader_handle(st->cso_context, NULL);
|
||||
ctx->NewDriverState |= ST_NEW_TES_STATE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_TES_STATE);
|
||||
break;
|
||||
case MESA_SHADER_GEOMETRY:
|
||||
cso_set_geometry_shader_handle(st->cso_context, NULL);
|
||||
ctx->NewDriverState |= ST_NEW_GS_STATE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_GS_STATE);
|
||||
break;
|
||||
case MESA_SHADER_FRAGMENT:
|
||||
cso_set_fragment_shader_handle(st->cso_context, NULL);
|
||||
ctx->NewDriverState |= ST_NEW_FS_STATE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_FS_STATE);
|
||||
break;
|
||||
case MESA_SHADER_COMPUTE:
|
||||
cso_set_compute_shader_handle(st->cso_context, NULL);
|
||||
ctx->NewDriverState |= ST_NEW_CS_STATE;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_CS_STATE);
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("invalid shader type");
|
||||
@@ -552,12 +537,12 @@ st_translate_vertex_program(struct st_context *st,
|
||||
/* This determines which states will be updated when the assembly
|
||||
* shader is bound.
|
||||
*/
|
||||
prog->affected_states = ST_NEW_VS_STATE |
|
||||
ST_NEW_RASTERIZER |
|
||||
ST_NEW_VERTEX_ARRAYS;
|
||||
BITSET_ZERO(prog->affected_states);
|
||||
ST_SET_STATE3(prog->affected_states, ST_NEW_VS_STATE,
|
||||
ST_NEW_RASTERIZER, ST_NEW_VERTEX_ARRAYS);
|
||||
|
||||
if (prog->Parameters->NumParameters)
|
||||
prog->affected_states |= ST_NEW_VS_CONSTANTS;
|
||||
ST_SET_STATE(prog->affected_states, ST_NEW_VS_CONSTANTS);
|
||||
|
||||
if (prog->arb.Instructions && prog->nir)
|
||||
ralloc_free(prog->nir);
|
||||
@@ -948,19 +933,19 @@ st_translate_fragment_program(struct st_context *st,
|
||||
*
|
||||
* fragment.position and glDrawPixels always use constants.
|
||||
*/
|
||||
prog->affected_states = ST_NEW_FS_STATE |
|
||||
ST_NEW_SAMPLE_SHADING |
|
||||
ST_NEW_FS_CONSTANTS;
|
||||
BITSET_ZERO(prog->affected_states);
|
||||
ST_SET_STATE3(prog->affected_states, ST_NEW_FS_STATE,
|
||||
ST_NEW_SAMPLE_SHADING, ST_NEW_FS_CONSTANTS);
|
||||
|
||||
if (prog->ati_fs) {
|
||||
/* Just set them for ATI_fs unconditionally. */
|
||||
prog->affected_states |= ST_NEW_FS_SAMPLER_VIEWS |
|
||||
ST_NEW_FS_SAMPLERS;
|
||||
ST_SET_STATE2(prog->affected_states, ST_NEW_FS_SAMPLER_VIEWS,
|
||||
ST_NEW_FS_SAMPLERS);
|
||||
} else {
|
||||
/* ARB_fp */
|
||||
if (prog->SamplersUsed)
|
||||
prog->affected_states |= ST_NEW_FS_SAMPLER_VIEWS |
|
||||
ST_NEW_FS_SAMPLERS;
|
||||
ST_SET_STATE2(prog->affected_states, ST_NEW_FS_SAMPLER_VIEWS,
|
||||
ST_NEW_FS_SAMPLERS);
|
||||
}
|
||||
|
||||
/* Translate to NIR. */
|
||||
@@ -1496,9 +1481,9 @@ st_finalize_program(struct st_context *st, struct gl_program *prog,
|
||||
if (is_bound) {
|
||||
if (prog->info.stage == MESA_SHADER_VERTEX) {
|
||||
ctx->Array.NewVertexElements = true;
|
||||
ctx->NewDriverState |= ST_NEW_VERTEX_PROGRAM(ctx, prog);
|
||||
ST_SET_VERTEX_PROGRAM_STATES(ctx->NewDriverState, ctx, prog);
|
||||
} else {
|
||||
ctx->NewDriverState |= prog->affected_states;
|
||||
ST_SET_STATES(ctx->NewDriverState, prog->affected_states);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -154,19 +154,19 @@ bind_compute_state(struct st_context *st,
|
||||
|
||||
/* Set compute states in the same order as defined in st_atom_list.h */
|
||||
|
||||
assert(prog->affected_states & ST_NEW_CS_STATE);
|
||||
assert(BITSET_TEST(prog->affected_states, ST_NEW_CS_STATE));
|
||||
assert(st->shader_has_one_variant[MESA_SHADER_COMPUTE]);
|
||||
cso_set_compute_shader_handle(st->cso_context,
|
||||
cs_handle_from_prog ?
|
||||
prog->variants->driver_shader : NULL);
|
||||
|
||||
if (prog->affected_states & ST_NEW_CS_SAMPLER_VIEWS) {
|
||||
if (BITSET_TEST(prog->affected_states, ST_NEW_CS_SAMPLER_VIEWS)) {
|
||||
st->pipe->set_sampler_views(st->pipe, prog->info.stage, 0,
|
||||
prog->info.num_textures, 0,
|
||||
sampler_views);
|
||||
}
|
||||
|
||||
if (prog->affected_states & ST_NEW_CS_SAMPLERS) {
|
||||
if (BITSET_TEST(prog->affected_states, ST_NEW_CS_SAMPLERS)) {
|
||||
/* Programs seem to set this bit more often than needed. For example, if
|
||||
* a program only uses texelFetch, this shouldn't be needed. Section
|
||||
* "11.1.3.2 Texel Fetches", of the GL 4.6 spec says:
|
||||
@@ -182,26 +182,26 @@ bind_compute_state(struct st_context *st,
|
||||
*/
|
||||
}
|
||||
|
||||
if (prog->affected_states & ST_NEW_CS_CONSTANTS) {
|
||||
if (BITSET_TEST(prog->affected_states, ST_NEW_CS_CONSTANTS)) {
|
||||
st_upload_constants(st, constbuf0_from_prog ? prog : NULL,
|
||||
prog->info.stage);
|
||||
}
|
||||
|
||||
if (prog->affected_states & ST_NEW_CS_UBOS) {
|
||||
if (BITSET_TEST(prog->affected_states, ST_NEW_CS_UBOS)) {
|
||||
UNREACHABLE("Uniform buffer objects not handled");
|
||||
}
|
||||
|
||||
if (prog->affected_states & ST_NEW_CS_ATOMICS) {
|
||||
if (BITSET_TEST(prog->affected_states, ST_NEW_CS_ATOMICS)) {
|
||||
UNREACHABLE("Atomic buffer objects not handled");
|
||||
}
|
||||
|
||||
if (prog->affected_states & ST_NEW_CS_SSBOS) {
|
||||
if (BITSET_TEST(prog->affected_states, ST_NEW_CS_SSBOS)) {
|
||||
st->pipe->set_shader_buffers(st->pipe, prog->info.stage, 0,
|
||||
prog->info.num_ssbos, shader_buffers,
|
||||
prog->sh.ShaderStorageBlocksWriteAccess);
|
||||
}
|
||||
|
||||
if (prog->affected_states & ST_NEW_CS_IMAGES) {
|
||||
if (BITSET_TEST(prog->affected_states, ST_NEW_CS_IMAGES)) {
|
||||
st->pipe->set_shader_images(st->pipe, prog->info.stage, 0,
|
||||
prog->info.num_images, 0, image_views);
|
||||
}
|
||||
@@ -242,8 +242,9 @@ dispatch_compute_state(struct st_context *st,
|
||||
* trampled on by these state changes, dirty the relevant flags.
|
||||
*/
|
||||
if (st->cp) {
|
||||
st->ctx->NewDriverState |=
|
||||
st->cp->affected_states & prog->affected_states;
|
||||
st_state_bitset state;
|
||||
BITSET_AND(state, st->cp->affected_states, prog->affected_states);
|
||||
ST_SET_STATES(st->ctx->NewDriverState, state);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -108,37 +108,25 @@ st_point_size_per_vertex(struct gl_context *ctx)
|
||||
}
|
||||
|
||||
static inline void
|
||||
st_validate_state(struct st_context *st, uint64_t pipeline_state_mask)
|
||||
st_validate_state(struct st_context *st, const st_state_bitset pipeline_state_mask)
|
||||
{
|
||||
struct gl_context *ctx = st->ctx;
|
||||
|
||||
/* Inactive states are shader states not used by shaders at the moment. */
|
||||
uint64_t dirty = ctx->NewDriverState & st->active_states & pipeline_state_mask;
|
||||
st_state_bitset dirty;
|
||||
BITSET_COPY(dirty, pipeline_state_mask);
|
||||
BITSET_AND(dirty, dirty, ctx->NewDriverState);
|
||||
BITSET_AND(dirty, dirty, st->active_states);
|
||||
|
||||
if (dirty) {
|
||||
ctx->NewDriverState &= ~dirty;
|
||||
if (!BITSET_IS_EMPTY(dirty)) {
|
||||
BITSET_ANDNOT(ctx->NewDriverState, ctx->NewDriverState, dirty);
|
||||
|
||||
/* Execute functions that set states that have been changed since
|
||||
* the last draw.
|
||||
*
|
||||
* x86_64: u_bit_scan64 is negligibly faster than u_bit_scan
|
||||
* i386: u_bit_scan64 is noticably slower than u_bit_scan
|
||||
*/
|
||||
st_update_func_t *update_state = st->update_functions;
|
||||
|
||||
if (sizeof(void*) == 8) {
|
||||
while (dirty)
|
||||
update_state[u_bit_scan64(&dirty)](st);
|
||||
} else {
|
||||
/* Split u_bit_scan64 into 2x u_bit_scan32 for i386. */
|
||||
uint32_t dirty_lo = dirty;
|
||||
uint32_t dirty_hi = dirty >> 32;
|
||||
|
||||
while (dirty_lo)
|
||||
update_state[u_bit_scan(&dirty_lo)](st);
|
||||
while (dirty_hi)
|
||||
update_state[32 + u_bit_scan(&dirty_hi)](st);
|
||||
}
|
||||
unsigned i;
|
||||
BITSET_FOREACH_SET(i, dirty, ST_NUM_ATOMS)
|
||||
st->update_functions[i](st);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -341,7 +341,8 @@ vbo_exec_vtx_flush(struct vbo_exec_context *exec)
|
||||
printf("%s %d %d\n", __func__, exec->vtx.prim_count,
|
||||
exec->vtx.vert_count);
|
||||
|
||||
st_prepare_draw(ctx, ST_PIPELINE_RENDER_STATE_MASK);
|
||||
ST_PIPELINE_RENDER_STATE_MASK(mask);
|
||||
st_prepare_draw(ctx, mask);
|
||||
|
||||
ctx->Driver.DrawGalliumMultiMode(ctx, &exec->vtx.info,
|
||||
exec->vtx.draw,
|
||||
|
||||
@@ -258,7 +258,7 @@ _vbo_set_attrib_format(struct gl_context *ctx,
|
||||
GL_FALSE, integer, doubles, offset);
|
||||
|
||||
if (vao->Enabled & VERT_BIT(attr)) {
|
||||
ctx->NewDriverState |= ST_NEW_VERTEX_ARRAYS;
|
||||
ST_SET_STATE(ctx->NewDriverState, ST_NEW_VERTEX_ARRAYS);
|
||||
ctx->Array.NewVertexElements = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -281,7 +281,8 @@ vbo_save_playback_vertex_list_gallium(struct gl_context *ctx,
|
||||
/* Set edge flags. */
|
||||
_mesa_update_edgeflag_state_explicit(ctx, enabled & VERT_BIT_EDGEFLAG);
|
||||
|
||||
st_prepare_draw(ctx, ST_PIPELINE_RENDER_STATE_MASK_NO_VARRAYS);
|
||||
ST_PIPELINE_RENDER_STATE_MASK_NO_VARRAYS(mask);
|
||||
st_prepare_draw(ctx, mask);
|
||||
|
||||
struct pipe_context *pipe = ctx->pipe;
|
||||
uint32_t velem_mask = ctx->VertexProgram._Current->info.inputs_read;
|
||||
@@ -377,7 +378,8 @@ vbo_save_playback_vertex_list(struct gl_context *ctx, void *data, bool copy_to_c
|
||||
|
||||
struct pipe_draw_info *info = (struct pipe_draw_info *) &node->cold->info;
|
||||
|
||||
st_prepare_draw(ctx, ST_PIPELINE_RENDER_STATE_MASK);
|
||||
ST_PIPELINE_RENDER_STATE_MASK(mask);
|
||||
st_prepare_draw(ctx, mask);
|
||||
|
||||
if (node->modes) {
|
||||
ctx->Driver.DrawGalliumMultiMode(ctx, info,
|
||||
|
||||
Reference in New Issue
Block a user