Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Unified Diff: src/gpu/vk/GrVkCaps.h

Issue 1718693002: Add vulkan files into skia repo. (Closed) Base URL: https://skia.googlesource.com/skia.git@merge
Patch Set: fix path Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/vk/GrVkBuffer.cpp ('k') | src/gpu/vk/GrVkCaps.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkCaps.h
diff --git a/src/gpu/vk/GrVkCaps.h b/src/gpu/vk/GrVkCaps.h
new file mode 100644
index 0000000000000000000000000000000000000000..3135c9e46ea9097dcb123af0cdbda5bb77b81d50
--- /dev/null
+++ b/src/gpu/vk/GrVkCaps.h
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrVkCaps_DEFINED
+#define GrVkCaps_DEFINED
+
+#include "GrCaps.h"
+#include "GrVkStencilAttachment.h"
+#include "vulkan/vulkan.h"
+
+struct GrVkInterface;
+class GrGLSLCaps;
+
+/**
+ * Stores some capabilities of a Vk backend.
+ */
+class GrVkCaps : public GrCaps {
+public:
+ typedef GrVkStencilAttachment::Format StencilFormat;
+
+ /**
+ * Creates a GrVkCaps that is set such that nothing is supported. The init function should
+ * be called to fill out the caps.
+ */
+ GrVkCaps(const GrContextOptions& contextOptions, const GrVkInterface* vkInterface,
+ VkPhysicalDevice device);
+
+ bool isConfigTexturable(GrPixelConfig config) const override {
+ SkASSERT(kGrPixelConfigCnt > config);
+ return fConfigTextureSupport[config];
+ }
+
+ bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const override {
+ SkASSERT(kGrPixelConfigCnt > config);
+ return fConfigRenderSupport[config][withMSAA];
+ }
+
+ bool isConfigRenderableLinearly(GrPixelConfig config, bool withMSAA) const {
+ SkASSERT(kGrPixelConfigCnt > config);
+ return fConfigLinearRenderSupport[config][withMSAA];
+ }
+
+ bool isConfigTexurableLinearly(GrPixelConfig config) const {
+ SkASSERT(kGrPixelConfigCnt > config);
+ return fConfigLinearTextureSupport[config];
+ }
+
+ /**
+ * Gets an array of legal stencil formats. These formats are not guaranteed to be supported by
+ * the driver but are legal VK_TEXTURE_FORMATs.
+ */
+ const SkTArray<StencilFormat, true>& stencilFormats() const {
+ return fStencilFormats;
+ }
+
+ /**
+ * Gets an array of legal stencil formats. These formats are not guaranteed to be supported by
+ * the driver but are legal VK_TEXTURE_FORMATs.
+ */
+ const SkTArray<StencilFormat, true>& linearStencilFormats() const {
+ return fLinearStencilFormats;
+ }
+
+ /**
+ * Returns the max number of sampled textures we can use in a program. This number is the max of
+ * max samplers and max sampled images. This number is technically the max sampled textures we
+ * can have per stage, but we'll use it for the whole program since for now we only do texture
+ * lookups in the fragment shader.
+ */
+ int maxSampledTextures() const {
+ return fMaxSampledTextures;
+ }
+
+
+ GrGLSLCaps* glslCaps() const { return reinterpret_cast<GrGLSLCaps*>(fShaderCaps.get()); }
+
+private:
+ void init(const GrContextOptions& contextOptions, const GrVkInterface* vkInterface,
+ VkPhysicalDevice device);
+ void initSampleCount(const VkPhysicalDeviceProperties& properties);
+ void initGLSLCaps(const GrVkInterface* interface, VkPhysicalDevice physDev);
+ void initConfigRenderableTable(const GrVkInterface* interface, VkPhysicalDevice physDev);
+ void initConfigTexturableTable(const GrVkInterface* interface, VkPhysicalDevice physDev);
+ void initStencilFormats(const GrVkInterface* interface, VkPhysicalDevice physDev);
+
+
+ bool fConfigTextureSupport[kGrPixelConfigCnt];
+ // For Vulkan we track whether a config is supported linearly (without need for swizzling)
+ bool fConfigLinearTextureSupport[kGrPixelConfigCnt];
+
+ // The first entry for each config is without msaa and the second is with.
+ bool fConfigRenderSupport[kGrPixelConfigCnt][2];
+ // The first entry for each config is without msaa and the second is with.
+ bool fConfigLinearRenderSupport[kGrPixelConfigCnt][2];
+
+ SkTArray<StencilFormat, true> fLinearStencilFormats;
+ SkTArray<StencilFormat, true> fStencilFormats;
+
+ int fMaxSampledTextures;
+
+ typedef GrCaps INHERITED;
+};
+
+#endif
« no previous file with comments | « src/gpu/vk/GrVkBuffer.cpp ('k') | src/gpu/vk/GrVkCaps.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698