vulkan: Add gskvulkanprivate.h

It's the new place for all the common stuff.

Because the old place is about to go away.
This commit is contained in:
Benjamin Otte 2023-07-03 15:57:30 +02:00
parent 210cb3eecd
commit 58c318a4dc
21 changed files with 92 additions and 67 deletions

View File

@ -2,6 +2,8 @@
#include "gskvulkanblendmodeopprivate.h" #include "gskvulkanblendmodeopprivate.h"
#include "gskvulkanprivate.h"
#include "vulkan/resources/blend-mode.vert.h" #include "vulkan/resources/blend-mode.vert.h"
typedef struct _GskVulkanBlendModeOp GskVulkanBlendModeOp; typedef struct _GskVulkanBlendModeOp GskVulkanBlendModeOp;

View File

@ -2,6 +2,8 @@
#include "gskvulkanbluropprivate.h" #include "gskvulkanbluropprivate.h"
#include "gskvulkanprivate.h"
#include "vulkan/resources/blur.vert.h" #include "vulkan/resources/blur.vert.h"
typedef struct _GskVulkanBlurOp GskVulkanBlurOp; typedef struct _GskVulkanBlurOp GskVulkanBlurOp;

View File

@ -2,10 +2,11 @@
#include "gskvulkanborderopprivate.h" #include "gskvulkanborderopprivate.h"
#include "vulkan/resources/border.vert.h" #include "gskvulkanprivate.h"
#include "gsk/gskroundedrectprivate.h" #include "gsk/gskroundedrectprivate.h"
#include "vulkan/resources/border.vert.h"
typedef struct _GskVulkanBorderOp GskVulkanBorderOp; typedef struct _GskVulkanBorderOp GskVulkanBorderOp;
struct _GskVulkanBorderOp struct _GskVulkanBorderOp

View File

@ -1,8 +1,9 @@
#include "config.h" #include "config.h"
#include "gskvulkanbufferprivate.h" #include "gskvulkanbufferprivate.h"
#include "gskvulkanmemoryprivate.h" #include "gskvulkanmemoryprivate.h"
#include "gskvulkanpipelineprivate.h" #include "gskvulkanprivate.h"
struct _GskVulkanBuffer struct _GskVulkanBuffer
{ {

View File

@ -2,6 +2,8 @@
#include "gskvulkancolormatrixopprivate.h" #include "gskvulkancolormatrixopprivate.h"
#include "gskvulkanprivate.h"
#include "vulkan/resources/color-matrix.vert.h" #include "vulkan/resources/color-matrix.vert.h"
typedef struct _GskVulkanColorMatrixOp GskVulkanColorMatrixOp; typedef struct _GskVulkanColorMatrixOp GskVulkanColorMatrixOp;

View File

@ -1,7 +1,7 @@
#include "config.h" #include "config.h"
#include "gskvulkancommandpoolprivate.h" #include "gskvulkancommandpoolprivate.h"
#include "gskvulkanpipelineprivate.h" #include "gskvulkanprivate.h"
struct _GskVulkanCommandPool struct _GskVulkanCommandPool
{ {

View File

@ -2,6 +2,8 @@
#include "gskvulkancrossfadeopprivate.h" #include "gskvulkancrossfadeopprivate.h"
#include "gskvulkanprivate.h"
#include "vulkan/resources/cross-fade.vert.h" #include "vulkan/resources/cross-fade.vert.h"
typedef struct _GskVulkanCrossFadeOp GskVulkanCrossFadeOp; typedef struct _GskVulkanCrossFadeOp GskVulkanCrossFadeOp;

View File

@ -2,6 +2,8 @@
#include "gskvulkanglyphopprivate.h" #include "gskvulkanglyphopprivate.h"
#include "gskvulkanprivate.h"
#include "vulkan/resources/glyph.vert.h" #include "vulkan/resources/glyph.vert.h"
typedef struct _GskVulkanGlyphOp GskVulkanGlyphOp; typedef struct _GskVulkanGlyphOp GskVulkanGlyphOp;

View File

@ -4,7 +4,7 @@
#include "gskvulkanbufferprivate.h" #include "gskvulkanbufferprivate.h"
#include "gskvulkanmemoryprivate.h" #include "gskvulkanmemoryprivate.h"
#include "gskvulkanpipelineprivate.h" #include "gskvulkanprivate.h"
#include "gdk/gdkmemoryformatprivate.h" #include "gdk/gdkmemoryformatprivate.h"

View File

@ -2,10 +2,11 @@
#include "gskvulkaninsetshadowopprivate.h" #include "gskvulkaninsetshadowopprivate.h"
#include "vulkan/resources/inset-shadow.vert.h" #include "gskvulkanprivate.h"
#include "gsk/gskroundedrectprivate.h" #include "gsk/gskroundedrectprivate.h"
#include "vulkan/resources/inset-shadow.vert.h"
typedef struct _GskVulkanInsetShadowOp GskVulkanInsetShadowOp; typedef struct _GskVulkanInsetShadowOp GskVulkanInsetShadowOp;
struct _GskVulkanInsetShadowOp struct _GskVulkanInsetShadowOp

View File

@ -2,6 +2,8 @@
#include "gskvulkanlineargradientopprivate.h" #include "gskvulkanlineargradientopprivate.h"
#include "gskvulkanprivate.h"
#include "vulkan/resources/linear.vert.h" #include "vulkan/resources/linear.vert.h"
typedef struct _GskVulkanLinearGradientOp GskVulkanLinearGradientOp; typedef struct _GskVulkanLinearGradientOp GskVulkanLinearGradientOp;

View File

@ -1,8 +1,9 @@
#include "config.h" #include "config.h"
#include "gskvulkanpipelineprivate.h"
#include "gskvulkanmemoryprivate.h" #include "gskvulkanmemoryprivate.h"
#include "gskvulkanprivate.h"
struct _GskVulkanMemory struct _GskVulkanMemory
{ {
GdkVulkanContext *vulkan; GdkVulkanContext *vulkan;

View File

@ -69,45 +69,5 @@ void gsk_vulkan_op_command (GskVulk
VkPipelineLayout pipeline_layout, VkPipelineLayout pipeline_layout,
VkCommandBuffer command_buffer); VkCommandBuffer command_buffer);
static inline void
gsk_vulkan_normalize_tex_coords (graphene_rect_t *tex_coords,
const graphene_rect_t *rect,
const graphene_rect_t *tex)
{
graphene_rect_init (tex_coords,
(rect->origin.x - tex->origin.x) / tex->size.width,
(rect->origin.y - tex->origin.y) / tex->size.height,
rect->size.width / tex->size.width,
rect->size.height / tex->size.height);
}
static inline void
gsk_vulkan_rect_to_float (const graphene_rect_t *rect,
float values[4])
{
values[0] = rect->origin.x;
values[1] = rect->origin.y;
values[2] = rect->size.width;
values[3] = rect->size.height;
}
static inline void
gsk_vulkan_rgba_to_float (const GdkRGBA *rgba,
float values[4])
{
values[0] = rgba->red;
values[1] = rgba->green;
values[2] = rgba->blue;
values[3] = rgba->alpha;
}
static inline void
gsk_vulkan_point_to_float (const graphene_point_t *point,
float values[2])
{
values[0] = point->x;
values[1] = point->y;
}
G_END_DECLS G_END_DECLS

View File

@ -2,10 +2,11 @@
#include "gskvulkanoutsetshadowopprivate.h" #include "gskvulkanoutsetshadowopprivate.h"
#include "vulkan/resources/outset-shadow.vert.h" #include "gskvulkanprivate.h"
#include "gsk/gskroundedrectprivate.h" #include "gsk/gskroundedrectprivate.h"
#include "vulkan/resources/outset-shadow.vert.h"
typedef struct _GskVulkanOutsetShadowOp GskVulkanOutsetShadowOp; typedef struct _GskVulkanOutsetShadowOp GskVulkanOutsetShadowOp;
struct _GskVulkanOutsetShadowOp struct _GskVulkanOutsetShadowOp

View File

@ -2,8 +2,6 @@
#include <gdk/gdk.h> #include <gdk/gdk.h>
#include "gskdebugprivate.h"
G_BEGIN_DECLS G_BEGIN_DECLS
#define GSK_TYPE_VULKAN_PIPELINE (gsk_vulkan_pipeline_get_type ()) #define GSK_TYPE_VULKAN_PIPELINE (gsk_vulkan_pipeline_get_type ())
@ -18,19 +16,6 @@ struct _GskVulkanPipelineClass
(* get_input_state_create_info) (GskVulkanPipeline *self); (* get_input_state_create_info) (GskVulkanPipeline *self);
}; };
static inline VkResult
gsk_vulkan_handle_result (VkResult res,
const char *called_function)
{
if (res != VK_SUCCESS)
{
GSK_DEBUG (VULKAN, "%s(): %s (%d)", called_function, gdk_vulkan_strerror (res), res);
}
return res;
}
#define GSK_VK_CHECK(func, ...) gsk_vulkan_handle_result (func (__VA_ARGS__), G_STRINGIFY (func))
GskVulkanPipeline * gsk_vulkan_pipeline_new (GType pipeline_type, GskVulkanPipeline * gsk_vulkan_pipeline_new (GType pipeline_type,
GdkVulkanContext *context, GdkVulkanContext *context,
VkPipelineLayout layout, VkPipelineLayout layout,

View File

@ -0,0 +1,60 @@
#pragma once
#include "gskdebugprivate.h"
#include <gdk/gdk.h>
#include <graphene.h>
static inline VkResult
gsk_vulkan_handle_result (VkResult res,
const char *called_function)
{
if (res != VK_SUCCESS)
{
GSK_DEBUG (VULKAN, "%s(): %s (%d)", called_function, gdk_vulkan_strerror (res), res);
}
return res;
}
#define GSK_VK_CHECK(func, ...) gsk_vulkan_handle_result (func (__VA_ARGS__), G_STRINGIFY (func))
static inline void
gsk_vulkan_normalize_tex_coords (graphene_rect_t *tex_coords,
const graphene_rect_t *rect,
const graphene_rect_t *tex)
{
graphene_rect_init (tex_coords,
(rect->origin.x - tex->origin.x) / tex->size.width,
(rect->origin.y - tex->origin.y) / tex->size.height,
rect->size.width / tex->size.width,
rect->size.height / tex->size.height);
}
static inline void
gsk_vulkan_rect_to_float (const graphene_rect_t *rect,
float values[4])
{
values[0] = rect->origin.x;
values[1] = rect->origin.y;
values[2] = rect->size.width;
values[3] = rect->size.height;
}
static inline void
gsk_vulkan_rgba_to_float (const GdkRGBA *rgba,
float values[4])
{
values[0] = rgba->red;
values[1] = rgba->green;
values[2] = rgba->blue;
values[3] = rgba->alpha;
}
static inline void
gsk_vulkan_point_to_float (const graphene_point_t *point,
float values[2])
{
values[0] = point->x;
values[1] = point->y;
}

View File

@ -9,6 +9,7 @@
#include "gskvulkancommandpoolprivate.h" #include "gskvulkancommandpoolprivate.h"
#include "gskvulkanglyphcacheprivate.h" #include "gskvulkanglyphcacheprivate.h"
#include "gskvulkanpipelineprivate.h" #include "gskvulkanpipelineprivate.h"
#include "gskvulkanprivate.h"
#include "gskvulkanpushconstantsopprivate.h" #include "gskvulkanpushconstantsopprivate.h"
#include "gskvulkanrendererprivate.h" #include "gskvulkanrendererprivate.h"
#include "gskvulkanrenderpassprivate.h" #include "gskvulkanrenderpassprivate.h"

View File

@ -8,7 +8,7 @@
#include "gskrendernodeprivate.h" #include "gskrendernodeprivate.h"
#include "gskvulkanbufferprivate.h" #include "gskvulkanbufferprivate.h"
#include "gskvulkanimageprivate.h" #include "gskvulkanimageprivate.h"
#include "gskvulkanpipelineprivate.h" #include "gskvulkanprivate.h"
#include "gskvulkanrenderprivate.h" #include "gskvulkanrenderprivate.h"
#include "gskvulkanglyphcacheprivate.h" #include "gskvulkanglyphcacheprivate.h"

View File

@ -20,6 +20,7 @@
#include "gskvulkaninsetshadowopprivate.h" #include "gskvulkaninsetshadowopprivate.h"
#include "gskvulkanlineargradientopprivate.h" #include "gskvulkanlineargradientopprivate.h"
#include "gskvulkanopprivate.h" #include "gskvulkanopprivate.h"
#include "gskvulkanprivate.h"
#include "gskvulkanrendererprivate.h" #include "gskvulkanrendererprivate.h"
#include "gskvulkanimageprivate.h" #include "gskvulkanimageprivate.h"
#include "gskvulkanoffscreenopprivate.h" #include "gskvulkanoffscreenopprivate.h"

View File

@ -4,7 +4,6 @@
#include <gsk/gskrendernode.h> #include <gsk/gskrendernode.h>
#include "gskvulkanimageprivate.h" #include "gskvulkanimageprivate.h"
#include "gskvulkanpipelineprivate.h"
#include "gskvulkanrenderpassprivate.h" #include "gskvulkanrenderpassprivate.h"
#include "gsk/gskprivate.h" #include "gsk/gskprivate.h"

View File

@ -2,6 +2,8 @@
#include "gskvulkantextureopprivate.h" #include "gskvulkantextureopprivate.h"
#include "gskvulkanprivate.h"
#include "vulkan/resources/texture.vert.h" #include "vulkan/resources/texture.vert.h"
typedef struct _GskVulkanTextureOp GskVulkanTextureOp; typedef struct _GskVulkanTextureOp GskVulkanTextureOp;