From: Brian Paul Date: Thu, 7 Mar 2019 16:21:53 +0000 (-0700) Subject: st/mesa: move utility functions, macros into new st_util.h file X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b29d827f09729259d772c4bbbf1b4d4606359736;p=mesa.git st/mesa: move utility functions, macros into new st_util.h file 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 --- diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources index d554408d01b..89bcfe40bb5 100644 --- a/src/mesa/Makefile.sources +++ b/src/mesa/Makefile.sources @@ -556,6 +556,7 @@ STATETRACKER_FILES = \ 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 diff --git a/src/mesa/meson.build b/src/mesa/meson.build index 05a8bb5e100..2d9b673fbe7 100644 --- a/src/mesa/meson.build +++ b/src/mesa/meson.build @@ -600,6 +600,7 @@ files_libmesa_gallium = files( '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', ) diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c index df1a94e831e..49f79ad9d49 100644 --- a/src/mesa/state_tracker/st_atom.c +++ b/src/mesa/state_tracker/st_atom.c @@ -36,6 +36,8 @@ #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); diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c index a0dd0d1f649..f18c40dbe7b 100644 --- a/src/mesa/state_tracker/st_atom_framebuffer.c +++ b/src/mesa/state_tracker/st_atom_framebuffer.c @@ -38,6 +38,7 @@ #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" diff --git a/src/mesa/state_tracker/st_atom_msaa.c b/src/mesa/state_tracker/st_atom_msaa.c index c6affec5525..594e6397242 100644 --- a/src/mesa/state_tracker/st_atom_msaa.c +++ b/src/mesa/state_tracker/st_atom_msaa.c @@ -31,6 +31,7 @@ #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" diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c index 2bffa684a25..fee992e4c4a 100644 --- a/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/src/mesa/state_tracker/st_atom_rasterizer.c @@ -37,6 +37,7 @@ #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" diff --git a/src/mesa/state_tracker/st_atom_scissor.c b/src/mesa/state_tracker/st_atom_scissor.c index a87d02941ca..04135a3a340 100644 --- a/src/mesa/state_tracker/st_atom_scissor.c +++ b/src/mesa/state_tracker/st_atom_scissor.c @@ -36,6 +36,7 @@ #include "st_context.h" #include "pipe/p_context.h" #include "st_atom.h" +#include "st_util.h" /** diff --git a/src/mesa/state_tracker/st_atom_viewport.c b/src/mesa/state_tracker/st_atom_viewport.c index 6e3347e7cfa..4a07b2d0914 100644 --- a/src/mesa/state_tracker/st_atom_viewport.c +++ b/src/mesa/state_tracker/st_atom_viewport.c @@ -30,6 +30,7 @@ #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" diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 7ef0d7ea5c6..d7e2ccb3815 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -49,6 +49,7 @@ #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" diff --git a/src/mesa/state_tracker/st_cb_blit.c b/src/mesa/state_tracker/st_cb_blit.c index 564ad666655..cc8649eb392 100644 --- a/src/mesa/state_tracker/st_cb_blit.c +++ b/src/mesa/state_tracker/st_cb_blit.c @@ -41,6 +41,7 @@ #include "st_cb_fbo.h" #include "st_manager.h" #include "st_scissor.h" +#include "st_util.h" #include "util/u_format.h" diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index b05f2516980..4f77dad7874 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -43,6 +43,7 @@ #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" diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 2de8e49c8cc..3a49bd4d6c1 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -50,6 +50,7 @@ #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" diff --git a/src/mesa/state_tracker/st_cb_compute.c b/src/mesa/state_tracker/st_cb_compute.c index f91df4bd177..a99484e4f2e 100644 --- a/src/mesa/state_tracker/st_cb_compute.c +++ b/src/mesa/state_tracker/st_cb_compute.c @@ -31,6 +31,7 @@ #include "st_cb_bitmap.h" #include "st_cb_bufferobjects.h" #include "st_cb_compute.h" +#include "st_util.h" #include "pipe/p_context.h" diff --git a/src/mesa/state_tracker/st_cb_copyimage.c b/src/mesa/state_tracker/st_cb_copyimage.c index 6d3eda014dc..8c5be504985 100644 --- a/src/mesa/state_tracker/st_cb_copyimage.c +++ b/src/mesa/state_tracker/st_cb_copyimage.c @@ -27,6 +27,7 @@ #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" diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 119f018cd0b..6b7d4f28167 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -65,6 +65,7 @@ #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" diff --git a/src/mesa/state_tracker/st_cb_drawtex.c b/src/mesa/state_tracker/st_cb_drawtex.c index 3c583b3927f..111767d88a4 100644 --- a/src/mesa/state_tracker/st_cb_drawtex.c +++ b/src/mesa/state_tracker/st_cb_drawtex.c @@ -25,6 +25,7 @@ #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" diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 3bd7fd4ad27..5fe6c79a93a 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -53,6 +53,7 @@ #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" diff --git a/src/mesa/state_tracker/st_cb_feedback.c b/src/mesa/state_tracker/st_cb_feedback.c index 6e48be6f5d2..ce236c05d98 100644 --- a/src/mesa/state_tracker/st_cb_feedback.c +++ b/src/mesa/state_tracker/st_cb_feedback.c @@ -48,6 +48,7 @@ #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" diff --git a/src/mesa/state_tracker/st_cb_memoryobjects.c b/src/mesa/state_tracker/st_cb_memoryobjects.c index 39174bc9f75..7e5cd2a04cb 100644 --- a/src/mesa/state_tracker/st_cb_memoryobjects.c +++ b/src/mesa/state_tracker/st_cb_memoryobjects.c @@ -29,6 +29,7 @@ #include "st_context.h" #include "st_cb_memoryobjects.h" +#include "st_util.h" #include "state_tracker/drm_driver.h" #include "pipe/p_context.h" diff --git a/src/mesa/state_tracker/st_cb_perfmon.c b/src/mesa/state_tracker/st_cb_perfmon.c index 23d32dcad47..e1873d7c408 100644 --- a/src/mesa/state_tracker/st_cb_perfmon.c +++ b/src/mesa/state_tracker/st_cb_perfmon.c @@ -29,6 +29,7 @@ #include "st_context.h" #include "st_cb_bitmap.h" #include "st_cb_perfmon.h" +#include "st_util.h" #include "util/bitset.h" diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c index 825a09d7fda..349ed7fa3f8 100644 --- a/src/mesa/state_tracker/st_cb_program.c +++ b/src/mesa/state_tracker/st_cb_program.c @@ -47,6 +47,7 @@ #include "st_cb_program.h" #include "st_glsl_to_ir.h" #include "st_atifs_to_tgsi.h" +#include "st_util.h" /** diff --git a/src/mesa/state_tracker/st_cb_queryobj.c b/src/mesa/state_tracker/st_cb_queryobj.c index 642b901d05a..460c3e71ff9 100644 --- a/src/mesa/state_tracker/st_cb_queryobj.c +++ b/src/mesa/state_tracker/st_cb_queryobj.c @@ -45,6 +45,7 @@ #include "st_cb_queryobj.h" #include "st_cb_bitmap.h" #include "st_cb_bufferobjects.h" +#include "st_util.h" static struct gl_query_object * diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c index c54b50dc754..52ead76baab 100644 --- a/src/mesa/state_tracker/st_cb_rasterpos.c +++ b/src/mesa/state_tracker/st_cb_rasterpos.c @@ -49,6 +49,7 @@ #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" diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index f614849b956..e887d8de6d7 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -46,6 +46,8 @@ #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. diff --git a/src/mesa/state_tracker/st_cb_semaphoreobjects.c b/src/mesa/state_tracker/st_cb_semaphoreobjects.c index 4a3faf57538..4b1f21e6b17 100644 --- a/src/mesa/state_tracker/st_cb_semaphoreobjects.c +++ b/src/mesa/state_tracker/st_cb_semaphoreobjects.c @@ -29,6 +29,7 @@ #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" diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index f16f8762278..47d06122ec1 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -62,6 +62,7 @@ #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" diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 45451531df9..68b6ddbb855 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -78,6 +78,7 @@ #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" @@ -132,7 +133,7 @@ st_query_memory_info(struct gl_context *ctx, struct gl_memory_info *out) } -uint64_t +static uint64_t st_get_active_states(struct gl_context *ctx) { struct st_vertex_program *vp = @@ -184,6 +185,14 @@ st_invalidate_buffers(struct st_context *st) } +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() */ diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 324a7f24178..58a1ead5c0d 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -54,14 +54,6 @@ struct st_perf_monitor_group; 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 */ @@ -317,14 +309,40 @@ struct st_context }; -/* 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. @@ -345,86 +363,6 @@ struct st_framebuffer }; -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 diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 0a190bd8ba8..7485fc82b18 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -55,6 +55,7 @@ #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" diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c index b83f63811dd..275e1090735 100644 --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@ -39,6 +39,7 @@ #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" diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index 3f105871a5e..d6e9136384e 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -40,6 +40,7 @@ #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" diff --git a/src/mesa/state_tracker/st_shader_cache.c b/src/mesa/state_tracker/st_shader_cache.c index c82ce3eaa2d..b18829754cb 100644 --- a/src/mesa/state_tracker/st_shader_cache.c +++ b/src/mesa/state_tracker/st_shader_cache.c @@ -25,6 +25,7 @@ #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" diff --git a/src/mesa/state_tracker/st_util.h b/src/mesa/state_tracker/st_util.h new file mode 100644 index 00000000000..b6454e5a958 --- /dev/null +++ b/src/mesa/state_tracker/st_util.h @@ -0,0 +1,114 @@ +/************************************************************************** + * + * 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 */