To de-clutter st_context.h.
Clean up remaining function prototypes in st_context.h.
The st_vp_uses_current_values() helper is only used in st_context.c
so move it there.
The st_get_active_states() function is only used in st_context.c so
remove its prototype in st_context.h
Reviewed-by: Neha Bhende <bhenden@vmware.com>
state_tracker/st_texture.h \
state_tracker/st_tgsi_lower_yuv.c \
state_tracker/st_tgsi_lower_yuv.h \
+ state_tracker/st_util.h \
state_tracker/st_vdpau.c \
state_tracker/st_vdpau.h
'state_tracker/st_texture.h',
'state_tracker/st_tgsi_lower_yuv.c',
'state_tracker/st_tgsi_lower_yuv.h',
+ 'state_tracker/st_util.h',
'state_tracker/st_vdpau.c',
'state_tracker/st_vdpau.h',
)
#include "st_atom.h"
#include "st_program.h"
#include "st_manager.h"
+#include "st_util.h"
+
typedef void (*update_func_t)(struct st_context *st);
#include "st_cb_bitmap.h"
#include "st_cb_fbo.h"
#include "st_texture.h"
+#include "st_util.h"
#include "pipe/p_context.h"
#include "cso_cache/cso_context.h"
#include "util/u_math.h"
#include "pipe/p_context.h"
#include "st_atom.h"
#include "st_program.h"
+#include "st_util.h"
#include "cso_cache/cso_context.h"
#include "util/u_framebuffer.h"
#include "st_atom.h"
#include "st_debug.h"
#include "st_program.h"
+#include "st_util.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "cso_cache/cso_context.h"
#include "st_context.h"
#include "pipe/p_context.h"
#include "st_atom.h"
+#include "st_util.h"
/**
#include "main/viewport.h"
#include "st_context.h"
#include "st_atom.h"
+#include "st_util.h"
#include "pipe/p_context.h"
#include "cso_cache/cso_context.h"
#include "st_cb_drawpixels.h"
#include "st_sampler_view.h"
#include "st_texture.h"
+#include "st_util.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "st_cb_fbo.h"
#include "st_manager.h"
#include "st_scissor.h"
+#include "st_util.h"
#include "util/u_format.h"
#include "st_cb_bufferobjects.h"
#include "st_cb_memoryobjects.h"
#include "st_debug.h"
+#include "st_util.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "st_format.h"
#include "st_nir.h"
#include "st_program.h"
+#include "st_util.h"
#include "pipe/p_context.h"
#include "pipe/p_shader_tokens.h"
#include "st_cb_bitmap.h"
#include "st_cb_bufferobjects.h"
#include "st_cb_compute.h"
+#include "st_util.h"
#include "pipe/p_context.h"
#include "state_tracker/st_cb_copyimage.h"
#include "state_tracker/st_cb_fbo.h"
#include "state_tracker/st_texture.h"
+#include "state_tracker/st_util.h"
#include "util/u_box.h"
#include "util/u_format.h"
#include "st_sampler_view.h"
#include "st_scissor.h"
#include "st_texture.h"
+#include "st_util.h"
#include "st_nir.h"
#include "pipe/p_context.h"
#include "st_cb_bitmap.h"
#include "st_cb_drawtex.h"
#include "st_nir.h"
+#include "st_util.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "st_cb_texture.h"
#include "st_format.h"
#include "st_texture.h"
+#include "st_util.h"
#include "st_manager.h"
#include "util/u_format.h"
#include "st_draw.h"
#include "st_cb_feedback.h"
#include "st_program.h"
+#include "st_util.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "st_context.h"
#include "st_cb_memoryobjects.h"
+#include "st_util.h"
#include "state_tracker/drm_driver.h"
#include "pipe/p_context.h"
#include "st_context.h"
#include "st_cb_bitmap.h"
#include "st_cb_perfmon.h"
+#include "st_util.h"
#include "util/bitset.h"
#include "st_cb_program.h"
#include "st_glsl_to_ir.h"
#include "st_atifs_to_tgsi.h"
+#include "st_util.h"
/**
#include "st_cb_queryobj.h"
#include "st_cb_bitmap.h"
#include "st_cb_bufferobjects.h"
+#include "st_util.h"
static struct gl_query_object *
#include "st_draw.h"
#include "st_program.h"
#include "st_cb_rasterpos.h"
+#include "st_util.h"
#include "draw/draw_context.h"
#include "draw/draw_pipe.h"
#include "vbo/vbo.h"
#include "state_tracker/st_format.h"
#include "state_tracker/st_pbo.h"
#include "state_tracker/st_texture.h"
+#include "state_tracker/st_util.h"
+
/* The readpixels cache caches a blitted staging texture so that back-to-back
* calls to glReadPixels with user pointers require less CPU-GPU synchronization.
#include "st_context.h"
#include "st_texture.h"
+#include "st_util.h"
#include "st_cb_bitmap.h"
#include "st_cb_bufferobjects.h"
#include "st_cb_semaphoreobjects.h"
#include "state_tracker/st_gen_mipmap.h"
#include "state_tracker/st_atom.h"
#include "state_tracker/st_sampler_view.h"
+#include "state_tracker/st_util.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "st_shader_cache.h"
#include "st_vdpau.h"
#include "st_texture.h"
+#include "st_util.h"
#include "pipe/p_context.h"
#include "util/u_cpu_detect.h"
#include "util/u_inlines.h"
}
-uint64_t
+static uint64_t
st_get_active_states(struct gl_context *ctx)
{
struct st_vertex_program *vp =
}
+static inline bool
+st_vp_uses_current_values(const struct gl_context *ctx)
+{
+ const uint64_t inputs = ctx->VertexProgram._Current->info.inputs_read;
+ return _mesa_draw_current_bits(ctx) & inputs;
+}
+
+
/**
* Called via ctx->Driver.UpdateState()
*/
struct u_upload_mgr;
-/** For drawing quads for glClear, glDraw/CopyPixels, glBitmap, etc. */
-struct st_util_vertex
-{
- float x, y, z;
- float r, g, b, a;
- float s, t;
-};
-
struct st_bitmap_cache
{
/** Window pos to render the cached image */
};
-/* Need this so that we can implement Mesa callbacks in this module.
+/*
+ * Get the state tracker context for the given Mesa context.
*/
-static inline struct st_context *st_context(struct gl_context *ctx)
+static inline struct st_context *
+st_context(struct gl_context *ctx)
{
return ctx->st;
}
+extern struct st_context *
+st_create_context(gl_api api, struct pipe_context *pipe,
+ const struct gl_config *visual,
+ struct st_context *share,
+ const struct st_config_options *options,
+ bool no_error);
+
+extern void
+st_destroy_context(struct st_context *st);
+
+
+extern void
+st_init_driver_functions(struct pipe_screen *screen,
+ struct dd_function_table *functions);
+
+
+extern void
+st_invalidate_buffers(struct st_context *st);
+
+
+extern uint64_t
+st_get_active_states(struct gl_context *ctx);
+
+
/**
* Wrapper for struct gl_framebuffer.
* This is an opaque type to the outside world.
};
-extern void st_init_driver_functions(struct pipe_screen *screen,
- struct dd_function_table *functions);
-
-void
-st_invalidate_buffers(struct st_context *st);
-
-/* Invalidate the readpixels cache to ensure we don't read stale data.
- */
-static inline void
-st_invalidate_readpix_cache(struct st_context *st)
-{
- if (unlikely(st->readpix_cache.src)) {
- pipe_resource_reference(&st->readpix_cache.src, NULL);
- pipe_resource_reference(&st->readpix_cache.cache, NULL);
- }
-}
-
-
-#define Y_0_TOP 1
-#define Y_0_BOTTOM 2
-
-static inline GLuint
-st_fb_orientation(const struct gl_framebuffer *fb)
-{
- if (fb && _mesa_is_winsys_fbo(fb)) {
- /* Drawing into a window (on-screen buffer).
- *
- * Negate Y scale to flip image vertically.
- * The NDC Y coords prior to viewport transformation are in the range
- * [y=-1=bottom, y=1=top]
- * Hardware window coords are in the range [y=0=top, y=H-1=bottom] where
- * H is the window height.
- * Use the viewport transformation to invert Y.
- */
- return Y_0_TOP;
- }
- else {
- /* Drawing into user-created FBO (very likely a texture).
- *
- * For textures, T=0=Bottom, so by extension Y=0=Bottom for rendering.
- */
- return Y_0_BOTTOM;
- }
-}
-
-
-static inline bool
-st_user_clip_planes_enabled(struct gl_context *ctx)
-{
- return (ctx->API == API_OPENGL_COMPAT ||
- ctx->API == API_OPENGLES) && /* only ES 1.x */
- ctx->Transform.ClipPlanesEnabled;
-}
-
-
-static inline bool
-st_vp_uses_current_values(const struct gl_context *ctx)
-{
- const uint64_t inputs = ctx->VertexProgram._Current->info.inputs_read;
- return _mesa_draw_current_bits(ctx) & inputs;
-}
-
-/** clear-alloc a struct-sized object, with casting */
-#define ST_CALLOC_STRUCT(T) (struct T *) calloc(1, sizeof(struct T))
-
-
-extern struct st_context *
-st_create_context(gl_api api, struct pipe_context *pipe,
- const struct gl_config *visual,
- struct st_context *share,
- const struct st_config_options *options,
- bool no_error);
-
-extern void
-st_destroy_context(struct st_context *st);
-
-uint64_t
-st_get_active_states(struct gl_context *ctx);
-
-
#ifdef __cplusplus
}
#endif
#include "st_debug.h"
#include "st_draw.h"
#include "st_program.h"
+#include "st_util.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "st_cb_bufferobjects.h"
#include "st_draw.h"
#include "st_program.h"
+#include "st_util.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "st_debug.h"
#include "st_context.h"
#include "st_texture.h"
+#include "st_util.h"
#include "st_gen_mipmap.h"
#include "st_cb_bitmap.h"
#include "st_cb_texture.h"
#include "st_debug.h"
#include "st_program.h"
#include "st_shader_cache.h"
+#include "st_util.h"
#include "compiler/glsl/program.h"
#include "compiler/nir/nir.h"
#include "compiler/nir/nir_serialize.h"
--- /dev/null
+/**************************************************************************
+ *
+ * Copyright 2019 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+/*
+ * Miscellantous state tracker utility functions, macros.
+ */
+
+
+#ifndef ST_UTIL
+#define ST_UTIL
+
+
+#include "state_tracker/st_context.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/** For drawing quads for glClear, glDraw/CopyPixels, glBitmap, etc. */
+struct st_util_vertex
+{
+ float x, y, z;
+ float r, g, b, a;
+ float s, t;
+};
+
+
+
+/* Invalidate the readpixels cache to ensure we don't read stale data.
+ */
+static inline void
+st_invalidate_readpix_cache(struct st_context *st)
+{
+ if (unlikely(st->readpix_cache.src)) {
+ pipe_resource_reference(&st->readpix_cache.src, NULL);
+ pipe_resource_reference(&st->readpix_cache.cache, NULL);
+ }
+}
+
+
+#define Y_0_TOP 1
+#define Y_0_BOTTOM 2
+
+static inline GLuint
+st_fb_orientation(const struct gl_framebuffer *fb)
+{
+ if (fb && _mesa_is_winsys_fbo(fb)) {
+ /* Drawing into a window (on-screen buffer).
+ *
+ * Negate Y scale to flip image vertically.
+ * The NDC Y coords prior to viewport transformation are in the range
+ * [y=-1=bottom, y=1=top]
+ * Hardware window coords are in the range [y=0=top, y=H-1=bottom] where
+ * H is the window height.
+ * Use the viewport transformation to invert Y.
+ */
+ return Y_0_TOP;
+ }
+ else {
+ /* Drawing into user-created FBO (very likely a texture).
+ *
+ * For textures, T=0=Bottom, so by extension Y=0=Bottom for rendering.
+ */
+ return Y_0_BOTTOM;
+ }
+}
+
+
+static inline bool
+st_user_clip_planes_enabled(struct gl_context *ctx)
+{
+ return (ctx->API == API_OPENGL_COMPAT ||
+ ctx->API == API_OPENGLES) && /* only ES 1.x */
+ ctx->Transform.ClipPlanesEnabled;
+}
+
+
+/** clear-alloc a struct-sized object, with casting */
+#define ST_CALLOC_STRUCT(T) (struct T *) calloc(1, sizeof(struct T))
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* ST_UTIL */