diff options
author | Greg Daniel <egdaniel@google.com> | 2016-02-22 09:56:40 -0500 |
---|---|---|
committer | Greg Daniel <egdaniel@google.com> | 2016-02-22 09:56:40 -0500 |
commit | 164a9f061c5186ae931cc23a3c73f32472e80ff5 (patch) | |
tree | 79929f22803c622a2e0c8dbc333717c275ca0405 /src/gpu/vk/GrVkProgramDesc.h | |
parent | 129ed1cd6d792f3f6cf563aefa9756fc6308289d (diff) |
Add vulkan files into skia repo. This is an incomplete backend with only partial functionality at this time.
R=robertphillips@google.com
TBR=bsalomon@google.com
BUG=skia:4955
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1718693002
Committed: https://skia.googlesource.com/skia/+/48cf268defad66f58f1aa03b4835e5583be96b2f
Review URL: https://codereview.chromium.org/1718693002
Diffstat (limited to 'src/gpu/vk/GrVkProgramDesc.h')
-rw-r--r-- | src/gpu/vk/GrVkProgramDesc.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/gpu/vk/GrVkProgramDesc.h b/src/gpu/vk/GrVkProgramDesc.h new file mode 100644 index 0000000000..1767a051ba --- /dev/null +++ b/src/gpu/vk/GrVkProgramDesc.h @@ -0,0 +1,69 @@ +/* + * 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 GrVkProgramDesc_DEFINED +#define GrVkProgramDesc_DEFINED + +#include "GrColor.h" +#include "GrProgramDesc.h" +#include "GrGpu.h" +#include "GrTypesPriv.h" + +#include "shaderc/shaderc.h" +#include "vulkan/vulkan.h" + +class GrVkGpu; +class GrVkProgramDescBuilder; + +class GrVkProgramDesc : public GrProgramDesc { +private: + friend class GrVkProgramDescBuilder; +}; + +/** + * This class can be used to build a GrProgramDesc. It also provides helpers for accessing + * GL specific info in the header. + */ +class GrVkProgramDescBuilder { +public: + typedef GrProgramDesc::KeyHeader KeyHeader; + // The key, stored in fKey, is composed of five parts(first 2 are defined in the key itself): + // 1. uint32_t for total key length. + // 2. uint32_t for a checksum. + // 3. Header struct defined above. + // 4. Backend-specific information including per-processor keys and their key lengths. + // Each processor's key is a variable length array of uint32_t. + enum { + // Part 3. + kHeaderOffset = GrVkProgramDesc::kHeaderOffset, + kHeaderSize = SkAlign4(sizeof(KeyHeader)), + // Part 4. + // This is the offset into the backenend specific part of the key, which includes + // per-processor keys. + kProcessorKeysOffset = kHeaderOffset + kHeaderSize, + }; + + /** + * Builds a GL specific program descriptor + * + * @param GrPrimitiveProcessor The geometry + * @param GrPipeline The optimized drawstate. The descriptor will represent a program + * which this optstate can use to draw with. The optstate contains + * general draw information, as well as the specific color, geometry, + * and coverage stages which will be used to generate the GL Program for + * this optstate. + * @param GrVkGpu A GL Gpu, the caps and Gpu object are used to output processor specific + * parts of the descriptor. + * @param GrProgramDesc The built and finalized descriptor + **/ + static bool Build(GrProgramDesc*, + const GrPrimitiveProcessor&, + const GrPipeline&, + const GrGLSLCaps&); +}; + +#endif |