X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fbarrier.c;h=2be30220e498521116f2f64274617a0e5903e06f;hb=ddb351f7fe056589b349233edd6d5f9cd2295ec7;hp=e55d13cb6b3e79efae630d2c920b6eb45d2d7d5a;hpb=376316e963b6636bb3c3900b3918a197c5e632aa;p=mesa.git diff --git a/src/mesa/main/barrier.c b/src/mesa/main/barrier.c index e55d13cb6b3..2be30220e49 100644 --- a/src/mesa/main/barrier.c +++ b/src/mesa/main/barrier.c @@ -67,11 +67,10 @@ _mesa_MemoryBarrier(GLbitfield barriers) ctx->Driver.MemoryBarrier(ctx, barriers); } -void GLAPIENTRY -_mesa_MemoryBarrierByRegion(GLbitfield barriers) +static ALWAYS_INLINE void +memory_barrier_by_region(struct gl_context *ctx, GLbitfield barriers, + bool no_error) { - GET_CURRENT_CONTEXT(ctx); - GLbitfield all_allowed_bits = GL_ATOMIC_COUNTER_BARRIER_BIT | GL_FRAMEBUFFER_BARRIER_BIT | GL_SHADER_IMAGE_ACCESS_BARRIER_BIT | @@ -100,7 +99,7 @@ _mesa_MemoryBarrierByRegion(GLbitfield barriers) * value ALL_BARRIER_BITS, and has any bits set other than those * described above." */ - if ((barriers & ~all_allowed_bits) != 0) { + if (!no_error && (barriers & ~all_allowed_bits) != 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glMemoryBarrierByRegion(unsupported barrier bit"); } @@ -109,17 +108,44 @@ _mesa_MemoryBarrierByRegion(GLbitfield barriers) } } +void GLAPIENTRY +_mesa_MemoryBarrierByRegion_no_error(GLbitfield barriers) +{ + GET_CURRENT_CONTEXT(ctx); + memory_barrier_by_region(ctx, barriers, true); +} + +void GLAPIENTRY +_mesa_MemoryBarrierByRegion(GLbitfield barriers) +{ + GET_CURRENT_CONTEXT(ctx); + memory_barrier_by_region(ctx, barriers, false); +} + void GLAPIENTRY _mesa_BlendBarrier(void) { GET_CURRENT_CONTEXT(ctx); - if (!ctx->Extensions.MESA_shader_framebuffer_fetch_non_coherent && - !ctx->Extensions.KHR_blend_equation_advanced) { + if (!ctx->Extensions.KHR_blend_equation_advanced) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBlendBarrier(not supported)"); return; } - ctx->Driver.BlendBarrier(ctx); + ctx->Driver.FramebufferFetchBarrier(ctx); +} + +void GLAPIENTRY +_mesa_FramebufferFetchBarrierEXT(void) +{ + GET_CURRENT_CONTEXT(ctx); + + if (!ctx->Extensions.EXT_shader_framebuffer_fetch_non_coherent) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glFramebufferFetchBarrierEXT(not supported)"); + return; + } + + ctx->Driver.FramebufferFetchBarrier(ctx); }