skia2/include/gpu/vk/GrVkBackendContext.h
jvanverth fd7bd45ac2 Revise layer, extension and feature setup for Vulkan
Moves all the extension setup logic into GrVkBackendContext, and
pass extension and feature information to Skia via flags. Also adds
version information to GrVkBackendContext.

GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1832613003
TBR=bsalomon@google.com

Review URL: https://codereview.chromium.org/1832613003
2016-03-25 06:29:52 -07:00

56 lines
1.8 KiB
C

/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrVkBackendContext_DEFINED
#define GrVkBackendContext_DEFINED
#include "SkRefCnt.h"
#include "vulkan/vulkan.h"
#ifdef SK_DEBUG
#define ENABLE_VK_LAYERS
#endif
struct GrVkInterface;
enum GrVkExtensionFlags {
kEXT_debug_report_GrVkExtensionFlag = 0x0001,
kNV_glsl_shader_GrVkExtensionFlag = 0x0002,
};
enum GrVkFeatureFlags {
kGeometryShader_GrVkFeatureFlag = 0x0001,
kDualSrcBlend_GrVkFeatureFlag = 0x0002,
kSampleRateShading_GrVkFeatureFlag = 0x0004,
};
// The BackendContext contains all of the base Vulkan objects needed by the GrVkGpu. The assumption
// is that the client will set these up and pass them to the GrVkGpu constructor. The VkDevice
// created must support at least one graphics queue, which is passed in as well.
// The QueueFamilyIndex must match the family of the given queue. It is needed for CommandPool
// creation, and any GrBackendObjects handed to us (e.g., for wrapped textures) need to be created
// in or transitioned to that family.
struct GrVkBackendContext : public SkRefCnt {
VkInstance fInstance;
VkPhysicalDevice fPhysicalDevice;
VkDevice fDevice;
VkQueue fQueue;
uint32_t fQueueFamilyIndex;
uint32_t fMinAPIVersion;
uint32_t fExtensions;
uint32_t fFeatures;
SkAutoTUnref<const GrVkInterface> fInterface;
// Helper function to create the default Vulkan objects needed by the GrVkGpu object
static const GrVkBackendContext* Create();
~GrVkBackendContext() override;
};
#endif