mesa/st: move barriers to direct call
Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14073>
This commit is contained in:
parent
8fe4ff2fda
commit
12f8475ff9
|
@ -31,6 +31,8 @@
|
|||
#include "context.h"
|
||||
#include "barrier.h"
|
||||
|
||||
#include "state_tracker/st_cb_texturebarrier.h"
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_TextureBarrierNV(void)
|
||||
{
|
||||
|
@ -42,7 +44,7 @@ _mesa_TextureBarrierNV(void)
|
|||
return;
|
||||
}
|
||||
|
||||
ctx->Driver.TextureBarrier(ctx);
|
||||
st_TextureBarrier(ctx);
|
||||
}
|
||||
|
||||
void GLAPIENTRY
|
||||
|
@ -50,8 +52,7 @@ _mesa_MemoryBarrier(GLbitfield barriers)
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
if (ctx->Driver.MemoryBarrier)
|
||||
ctx->Driver.MemoryBarrier(ctx, barriers);
|
||||
st_MemoryBarrier(ctx, barriers);
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE void
|
||||
|
@ -65,34 +66,32 @@ memory_barrier_by_region(struct gl_context *ctx, GLbitfield barriers,
|
|||
GL_TEXTURE_FETCH_BARRIER_BIT |
|
||||
GL_UNIFORM_BARRIER_BIT;
|
||||
|
||||
if (ctx->Driver.MemoryBarrier) {
|
||||
/* From section 7.11.2 of the OpenGL ES 3.1 specification:
|
||||
*
|
||||
* "When barriers is ALL_BARRIER_BITS, shader memory accesses will be
|
||||
* synchronized relative to all these barrier bits, but not to other
|
||||
* barrier bits specific to MemoryBarrier."
|
||||
*
|
||||
* That is, if barriers is the special value GL_ALL_BARRIER_BITS, then all
|
||||
* barriers allowed by glMemoryBarrierByRegion should be activated."
|
||||
*/
|
||||
if (barriers == GL_ALL_BARRIER_BITS) {
|
||||
ctx->Driver.MemoryBarrier(ctx, all_allowed_bits);
|
||||
return;
|
||||
}
|
||||
|
||||
/* From section 7.11.2 of the OpenGL ES 3.1 specification:
|
||||
*
|
||||
* "An INVALID_VALUE error is generated if barriers is not the special
|
||||
* value ALL_BARRIER_BITS, and has any bits set other than those
|
||||
* described above."
|
||||
*/
|
||||
if (!no_error && (barriers & ~all_allowed_bits) != 0) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE,
|
||||
"glMemoryBarrierByRegion(unsupported barrier bit");
|
||||
}
|
||||
|
||||
ctx->Driver.MemoryBarrier(ctx, barriers);
|
||||
/* From section 7.11.2 of the OpenGL ES 3.1 specification:
|
||||
*
|
||||
* "When barriers is ALL_BARRIER_BITS, shader memory accesses will be
|
||||
* synchronized relative to all these barrier bits, but not to other
|
||||
* barrier bits specific to MemoryBarrier."
|
||||
*
|
||||
* That is, if barriers is the special value GL_ALL_BARRIER_BITS, then all
|
||||
* barriers allowed by glMemoryBarrierByRegion should be activated."
|
||||
*/
|
||||
if (barriers == GL_ALL_BARRIER_BITS) {
|
||||
st_MemoryBarrier(ctx, all_allowed_bits);
|
||||
return;
|
||||
}
|
||||
|
||||
/* From section 7.11.2 of the OpenGL ES 3.1 specification:
|
||||
*
|
||||
* "An INVALID_VALUE error is generated if barriers is not the special
|
||||
* value ALL_BARRIER_BITS, and has any bits set other than those
|
||||
* described above."
|
||||
*/
|
||||
if (!no_error && (barriers & ~all_allowed_bits) != 0) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE,
|
||||
"glMemoryBarrierByRegion(unsupported barrier bit");
|
||||
}
|
||||
|
||||
st_MemoryBarrier(ctx, barriers);
|
||||
}
|
||||
|
||||
void GLAPIENTRY
|
||||
|
@ -120,7 +119,7 @@ _mesa_BlendBarrier(void)
|
|||
return;
|
||||
}
|
||||
|
||||
ctx->Driver.FramebufferFetchBarrier(ctx);
|
||||
st_FramebufferFetchBarrier(ctx);
|
||||
}
|
||||
|
||||
void GLAPIENTRY
|
||||
|
@ -134,5 +133,5 @@ _mesa_FramebufferFetchBarrierEXT(void)
|
|||
return;
|
||||
}
|
||||
|
||||
ctx->Driver.FramebufferFetchBarrier(ctx);
|
||||
st_FramebufferFetchBarrier(ctx);
|
||||
}
|
||||
|
|
|
@ -931,11 +931,6 @@ struct dd_function_table {
|
|||
void (*ResumeTransformFeedback)(struct gl_context *ctx,
|
||||
struct gl_transform_feedback_object *obj);
|
||||
|
||||
/**
|
||||
* \name GL_NV_texture_barrier interface
|
||||
*/
|
||||
void (*TextureBarrier)(struct gl_context *ctx);
|
||||
|
||||
/**
|
||||
* \name GL_ARB_texture_multisample
|
||||
*/
|
||||
|
@ -967,25 +962,6 @@ struct dd_function_table {
|
|||
*/
|
||||
GLenum (*GetGraphicsResetStatus)(struct gl_context *ctx);
|
||||
|
||||
/**
|
||||
* \name GL_ARB_shader_image_load_store interface.
|
||||
*/
|
||||
/** @{ */
|
||||
void (*MemoryBarrier)(struct gl_context *ctx, GLbitfield barriers);
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* GL_EXT_shader_framebuffer_fetch_non_coherent rendering barrier.
|
||||
*
|
||||
* On return from this function any framebuffer contents written by
|
||||
* previous draw commands are guaranteed to be visible from subsequent
|
||||
* fragment shader invocations using the
|
||||
* EXT_shader_framebuffer_fetch_non_coherent interface.
|
||||
*/
|
||||
/** @{ */
|
||||
void (*FramebufferFetchBarrier)(struct gl_context *ctx);
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* \name GL_ARB_compute_shader interface
|
||||
*/
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
/**
|
||||
* Called via ctx->Driver.TextureBarrier()
|
||||
*/
|
||||
static void
|
||||
void
|
||||
st_TextureBarrier(struct gl_context *ctx)
|
||||
{
|
||||
struct pipe_context *pipe = st_context(ctx)->pipe;
|
||||
|
@ -57,7 +57,7 @@ st_TextureBarrier(struct gl_context *ctx)
|
|||
/**
|
||||
* Called via ctx->Driver.FramebufferFetchBarrier()
|
||||
*/
|
||||
static void
|
||||
void
|
||||
st_FramebufferFetchBarrier(struct gl_context *ctx)
|
||||
{
|
||||
struct pipe_context *pipe = st_context(ctx)->pipe;
|
||||
|
@ -69,7 +69,7 @@ st_FramebufferFetchBarrier(struct gl_context *ctx)
|
|||
/**
|
||||
* Called via ctx->Driver.MemoryBarrier()
|
||||
*/
|
||||
static void
|
||||
void
|
||||
st_MemoryBarrier(struct gl_context *ctx, GLbitfield barriers)
|
||||
{
|
||||
struct pipe_context *pipe = st_context(ctx)->pipe;
|
||||
|
@ -130,10 +130,3 @@ st_MemoryBarrier(struct gl_context *ctx, GLbitfield barriers)
|
|||
if (flags && pipe->memory_barrier)
|
||||
pipe->memory_barrier(pipe, flags);
|
||||
}
|
||||
|
||||
void st_init_texture_barrier_functions(struct dd_function_table *functions)
|
||||
{
|
||||
functions->TextureBarrier = st_TextureBarrier;
|
||||
functions->FramebufferFetchBarrier = st_FramebufferFetchBarrier;
|
||||
functions->MemoryBarrier = st_MemoryBarrier;
|
||||
}
|
||||
|
|
|
@ -28,10 +28,8 @@
|
|||
#ifndef ST_CB_TEXTUREBARRIER_H
|
||||
#define ST_CB_TEXTUREBARRIER_H
|
||||
|
||||
|
||||
struct dd_function_table;
|
||||
|
||||
extern void st_init_texture_barrier_functions(struct dd_function_table *functions);
|
||||
|
||||
void st_TextureBarrier(struct gl_context *ctx);
|
||||
void st_FramebufferFetchBarrier(struct gl_context *ctx);
|
||||
void st_MemoryBarrier(struct gl_context *ctx, GLbitfield barriers);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -66,7 +66,6 @@
|
|||
#include "st_cb_texture.h"
|
||||
#include "st_cb_xformfb.h"
|
||||
#include "st_cb_flush.h"
|
||||
#include "st_cb_texturebarrier.h"
|
||||
#include "st_cb_viewport.h"
|
||||
#include "st_atom.h"
|
||||
#include "st_draw.h"
|
||||
|
@ -963,7 +962,6 @@ st_init_driver_functions(struct pipe_screen *screen,
|
|||
st_init_readpixels_functions(functions);
|
||||
st_init_semaphoreobject_functions(functions);
|
||||
st_init_texture_functions(functions);
|
||||
st_init_texture_barrier_functions(functions);
|
||||
st_init_flush_functions(screen, functions);
|
||||
st_init_viewport_functions(functions);
|
||||
st_init_compute_functions(functions);
|
||||
|
|
Loading…
Reference in New Issue