diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/color_conversion.h | 26 | ||||
-rw-r--r-- | include/egl.h | 5 | ||||
-rw-r--r-- | include/shader.h | 4 | ||||
-rw-r--r-- | include/utils.h | 2 |
4 files changed, 29 insertions, 8 deletions
diff --git a/include/color_conversion.h b/include/color_conversion.h index 6daf36f..a8462c0 100644 --- a/include/color_conversion.h +++ b/include/color_conversion.h @@ -6,7 +6,9 @@ #include "vec2.h" #include <stdbool.h> -#define GSR_COLOR_CONVERSION_MAX_SHADERS 6 +#define GSR_COLOR_CONVERSION_MAX_COMPUTE_SHADERS 12 +#define GSR_COLOR_CONVERSION_MAX_GRAPHICS_SHADERS 6 +#define GSR_COLOR_CONVERSION_MAX_FRAMEBUFFERS 2 typedef enum { GSR_COLOR_RANGE_LIMITED, @@ -38,10 +40,15 @@ typedef enum { typedef struct { int rotation_matrix; + int offset; +} gsr_color_graphics_uniforms; + +typedef struct { + int rotation_matrix; int source_position; int target_position; int scale; -} gsr_color_uniforms; +} gsr_color_compute_uniforms; typedef struct { gsr_egl *egl; @@ -57,10 +64,17 @@ typedef struct { typedef struct { gsr_color_conversion_params params; - gsr_color_uniforms uniforms[GSR_COLOR_CONVERSION_MAX_SHADERS]; - gsr_shader shaders[GSR_COLOR_CONVERSION_MAX_SHADERS]; + gsr_color_compute_uniforms compute_uniforms[GSR_COLOR_CONVERSION_MAX_COMPUTE_SHADERS]; + gsr_shader compute_shaders[GSR_COLOR_CONVERSION_MAX_COMPUTE_SHADERS]; + + /* These are only loader if compute shaders (of the same type) fail to load */ + gsr_color_graphics_uniforms graphics_uniforms[GSR_COLOR_CONVERSION_MAX_GRAPHICS_SHADERS]; + gsr_shader graphics_shaders[GSR_COLOR_CONVERSION_MAX_GRAPHICS_SHADERS]; + + bool compute_shaders_failed_to_load; + bool external_compute_shaders_failed_to_load; - unsigned int framebuffers[2]; + unsigned int framebuffers[GSR_COLOR_CONVERSION_MAX_FRAMEBUFFERS]; unsigned int vertex_array_object_id; unsigned int vertex_buffer_object_id; @@ -71,7 +85,7 @@ typedef struct { int gsr_color_conversion_init(gsr_color_conversion *self, const gsr_color_conversion_params *params); void gsr_color_conversion_deinit(gsr_color_conversion *self); -void gsr_color_conversion_draw(gsr_color_conversion *self, unsigned int texture_id, vec2i destination_pos, vec2i destination_size, vec2i texture_pos, vec2i texture_size, gsr_rotation rotation, bool external_texture, gsr_source_color source_color); +void gsr_color_conversion_draw(gsr_color_conversion *self, unsigned int texture_id, vec2i destination_pos, vec2i destination_size, vec2i source_pos, vec2i source_size, vec2i texture_size, gsr_rotation rotation, gsr_source_color source_color, bool external_texture, bool alpha_blending); void gsr_color_conversion_clear(gsr_color_conversion *self); gsr_rotation gsr_monitor_rotation_to_rotation(gsr_monitor_rotation monitor_rotation); diff --git a/include/egl.h b/include/egl.h index f7b0cc1..730502f 100644 --- a/include/egl.h +++ b/include/egl.h @@ -141,6 +141,10 @@ typedef void(*__GLXextFuncPtr)(void); #define GL_MAX_COMPUTE_FIXED_GROUP_INVOCATIONS 0x90EB #define GL_TEXTURE0 0x84C0 #define GL_TEXTURE1 0x84C1 +#define GL_CLAMP_TO_BORDER 0x812D +#define GL_TEXTURE_BORDER_COLOR 0x1004 +#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020 +#define GL_ALL_BARRIER_BITS 0xFFFFFFFF #define GL_VENDOR 0x1F00 #define GL_RENDERER 0x1F01 @@ -243,6 +247,7 @@ struct gsr_egl { void (*glBindImageTexture)(unsigned int unit, unsigned int texture, int level, unsigned char layered, int layer, unsigned int access, unsigned int format); void (*glTexParameteri)(unsigned int target, unsigned int pname, int param); void (*glTexParameteriv)(unsigned int target, unsigned int pname, const int *params); + void (*glTexParameterfv)(unsigned int target, unsigned int pname, const float *params); void (*glGetTexLevelParameteriv)(unsigned int target, int level, unsigned int pname, int *params); void (*glTexImage2D)(unsigned int target, int level, int internalFormat, int width, int height, int border, unsigned int format, unsigned int type, const void *pixels); void (*glTexSubImage2D)(unsigned int target, int level, int xoffset, int yoffset, int width, int height, unsigned format, unsigned type, const void *pixels); diff --git a/include/shader.h b/include/shader.h index 8bc1104..285758d 100644 --- a/include/shader.h +++ b/include/shader.h @@ -1,6 +1,8 @@ #ifndef GSR_SHADER_H #define GSR_SHADER_H +#include <stdbool.h> + typedef struct gsr_egl gsr_egl; typedef struct { @@ -16,4 +18,6 @@ int gsr_shader_bind_attribute_location(gsr_shader *self, const char *attribute, void gsr_shader_use(gsr_shader *self); void gsr_shader_use_none(gsr_shader *self); +void gsr_shader_enable_debug_output(bool enable); + #endif /* GSR_SHADER_H */ diff --git a/include/utils.h b/include/utils.h index 873e6e4..b6f51c1 100644 --- a/include/utils.h +++ b/include/utils.h @@ -50,8 +50,6 @@ drm_connector_type_count* drm_connector_types_get_index(drm_connector_type_count uint32_t monitor_identifier_from_type_and_count(int monitor_type_index, int monitor_type_count); bool gl_get_gpu_info(gsr_egl *egl, gsr_gpu_info *info); -bool version_greater_than(int major, int minor, int patch, int other_major, int other_minor, int other_patch); -bool gl_driver_version_greater_than(const gsr_gpu_info *gpu_info, int major, int minor, int patch); bool try_card_has_valid_plane(const char *card_path); /* |output| should be at least 128 bytes in size */ |