Files
gtk/gsk/gskslcompiler.h
Benjamin Otte 8431b63b5d gsksl: Add support for stages
The stage is just passed to everywhere it's needed. The compiler does
not keep a stage property, instead it requires passing the stage as an
argument to every compilation.

As a side effect, environment treatment has changed:
Environments now allow creating "similar" (for lack of a better term)
environments with different version/profile.
We use this to pass the stage as part of the environment.
2017-10-30 02:58:03 +01:00

87 lines
3.3 KiB
C

/* GTK - The GIMP Toolkit
*
* Copyright © 2017 Benjamin Otte <otte@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GSK_SL_COMPILER_H__
#define __GSK_SL_COMPILER_H__
#if !defined (__GSK_H_INSIDE__) && !defined (GSK_COMPILATION)
#error "Only <gsk/gsk.h> can be included directly."
#endif
#include <gsk/gsktypes.h>
G_BEGIN_DECLS
typedef enum {
GSK_SL_COMPILER_ERROR_ARGUMENT_COUNT,
GSK_SL_COMPILER_ERROR_CONSTANT,
GSK_SL_COMPILER_ERROR_DECLARATION,
GSK_SL_COMPILER_ERROR_PREPROCESSOR,
GSK_SL_COMPILER_ERROR_SCOPE,
GSK_SL_COMPILER_ERROR_SYNTAX,
GSK_SL_COMPILER_ERROR_TOKENIZER,
GSK_SL_COMPILER_ERROR_TYPE_MISMATCH,
GSK_SL_COMPILER_ERROR_UNIQUENESS,
GSK_SL_COMPILER_ERROR_UNSUPPORTED,
} GskSlCompilerError;
typedef enum {
GSK_SL_COMPILER_WARNING_CONSTANT,
GSK_SL_COMPILER_WARNING_DEAD_CODE,
GSK_SL_COMPILER_WARNING_SHADOW,
GSK_SL_COMPILER_WARNING_UNIMPLEMENTED,
GSK_SL_COMPILER_WARNING_VERSION
} GskSlCompilerWarning;
#define GSK_SL_COMPILER_ERROR (gsk_sl_compiler_error_quark ())
#define GSK_SL_COMPILER_WARNING (gsk_sl_compiler_warning_quark ())
#define GSK_TYPE_SL_COMPILER (gsk_sl_compiler_get_type ())
G_DECLARE_FINAL_TYPE (GskSlCompiler, gsk_sl_compiler, GSK, SL_COMPILER, GObject)
GDK_AVAILABLE_IN_3_92
GQuark gsk_sl_compiler_error_quark (void);
GDK_AVAILABLE_IN_3_92
GQuark gsk_sl_compiler_warning_quark (void);
GDK_AVAILABLE_IN_3_92
GskSlCompiler * gsk_sl_compiler_new (void);
GDK_AVAILABLE_IN_3_92
gboolean gsk_sl_compiler_add_define (GskSlCompiler *compiler,
const char *name,
const char *definition,
GError **error);
GDK_AVAILABLE_IN_3_92
void gsk_sl_compiler_remove_define (GskSlCompiler *compiler,
const char *name);
GDK_AVAILABLE_IN_3_92
GskSlProgram * gsk_sl_compiler_compile_file (GskSlCompiler *compiler,
GskSlShaderStage stage,
GFile *file);
GDK_AVAILABLE_IN_3_92
GskSlProgram * gsk_sl_compiler_compile_bytes (GskSlCompiler *compiler,
GskSlShaderStage stage,
GBytes *bytes);
G_END_DECLS
#endif /* __GSK_SL_COMPILER_H__ */