vulkan: Hook up image upload mechanism to env variables

Instead of having to decie at compile-time, check if
GSK_RENDERING=staging-image was given, and if so, select the staging
image upload mode.
This commit is contained in:
Benjamin Otte 2016-12-08 20:05:53 +01:00
parent b2e30fb66e
commit 85bc9ff36b
2 changed files with 4 additions and 18 deletions

View File

@ -316,16 +316,10 @@ gsk_vulkan_image_new_from_data (GdkVulkanContext *context,
gsize height, gsize height,
gsize stride) gsize stride)
{ {
switch (GSK_VULKAN_UPLOAD_IMAGE_DEFAULT) if (GSK_RENDER_MODE_CHECK (STAGING_IMAGE))
{ return gsk_vulkan_image_new_from_data_via_staging_image (context, command_buffer, data, width, height, stride);
default: else
g_assert_not_reached (); return gsk_vulkan_image_new_from_data_directly (context, command_buffer, data, width, height, stride);
/* fall through */
case GSK_VULKAN_UPLOAD_DIRECTLY:
return gsk_vulkan_image_new_from_data_directly (context, command_buffer, data, width, height, stride);
case GSK_VULKAN_UPLOAD_VIA_STAGING_IMAGE:
return gsk_vulkan_image_new_from_data_via_staging_image (context, command_buffer, data, width, height, stride);
}
} }
void void

View File

@ -5,14 +5,6 @@
G_BEGIN_DECLS G_BEGIN_DECLS
/* Modify here for benchmarking */
#define GSK_VULKAN_UPLOAD_IMAGE_DEFAULT GSK_VULKAN_UPLOAD_DIRECTLY
typedef enum {
GSK_VULKAN_UPLOAD_DIRECTLY,
GSK_VULKAN_UPLOAD_VIA_STAGING_IMAGE
} GstkVulkanImageUpload;
typedef struct _GskVulkanImage GskVulkanImage; typedef struct _GskVulkanImage GskVulkanImage;
GskVulkanImage * gsk_vulkan_image_new_from_data (GdkVulkanContext *context, GskVulkanImage * gsk_vulkan_image_new_from_data (GdkVulkanContext *context,