| Index: src/gpu/vk/GrVkPipelineState.h
|
| diff --git a/src/gpu/vk/GrVkPipelineState.h b/src/gpu/vk/GrVkPipelineState.h
|
| index ad32ece6bca24aa3d304176bf01ed963b4f660db..d15fef487a63abae1ad8da5eecfa85910debf425 100644
|
| --- a/src/gpu/vk/GrVkPipelineState.h
|
| +++ b/src/gpu/vk/GrVkPipelineState.h
|
| @@ -56,90 +56,28 @@ public:
|
|
|
| void abandonGPUResources();
|
|
|
| - // The key is composed of two parts:
|
| - // 1. uint32_t for total key length
|
| - // 2. Pipeline state data
|
| - enum StateKeyOffsets {
|
| - // Part 1.
|
| - kLength_StateKeyOffset = 0,
|
| - // Part 2.
|
| - kData_StateKeyOffset = kLength_StateKeyOffset + sizeof(uint32_t),
|
| - };
|
| - static void BuildStateKey(const GrPipeline&, GrPrimitiveType primitiveType,
|
| - SkTArray<unsigned char, true>* key);
|
| -
|
| /**
|
| * For Vulkan we want to cache the entire VkPipeline for reuse of draws. The Desc here holds all
|
| * the information needed to differentiate one pipeline from another.
|
| *
|
| - * The GrGLSLProgramDesc contains all the information need to create the actual shaders for the
|
| + * The GrProgramDesc contains all the information need to create the actual shaders for the
|
| * pipeline.
|
| *
|
| - * The fStateKey is used to store all the inputs for the rest of the state stored on the
|
| - * pipeline. This includes stencil settings, blending information, render pass format, draw face
|
| + * For Vulkan we need to add to the GrProgramDesc to include the rest of the state on the
|
| + * pipline. This includes stencil settings, blending information, render pass format, draw face
|
| * information, and primitive type. Note that some state is set dynamically on the pipeline for
|
| * each draw and thus is not included in this descriptor. This includes the viewport, scissor,
|
| * and blend constant.
|
| - *
|
| - * A checksum which includes the fProgramDesc and fStateKey is included at the top of the Desc
|
| - * for caching purposes and faster equality checks.
|
| */
|
| - struct Desc {
|
| - uint32_t fChecksum;
|
| - GrProgramDesc fProgramDesc;
|
| -
|
| - enum {
|
| - kRenderPassKeyAlloc = 12, // This is typical color attachment with no stencil or msaa
|
| - kStencilKeyAlloc = sizeof(GrStencilSettings),
|
| - kDrawFaceKeyAlloc = 4,
|
| - kBlendingKeyAlloc = 4,
|
| - kPrimitiveTypeKeyAlloc = 4,
|
| - kPreAllocSize = kData_StateKeyOffset + kRenderPassKeyAlloc + kStencilKeyAlloc +
|
| - kDrawFaceKeyAlloc + kBlendingKeyAlloc + kPrimitiveTypeKeyAlloc,
|
| - };
|
| - SkSTArray<kPreAllocSize, uint8_t, true> fStateKey;
|
| -
|
| - bool operator== (const Desc& that) const {
|
| - if (fChecksum != that.fChecksum || fProgramDesc != that.fProgramDesc) {
|
| - return false;
|
| - }
|
| - // We store the keyLength at the start of fVkKey. Thus we don't have to worry about
|
| - // different length keys since we will fail on the comparison immediately. Therefore we
|
| - // just use this PipelineDesc to get the length to iterate over.
|
| - int keyLength = fStateKey.count();
|
| - SkASSERT(SkIsAlign4(keyLength));
|
| - int l = keyLength >> 2;
|
| - const uint32_t* aKey = reinterpret_cast<const uint32_t*>(fStateKey.begin());
|
| - const uint32_t* bKey = reinterpret_cast<const uint32_t*>(that.fStateKey.begin());
|
| - for (int i = 0; i < l; ++i) {
|
| - if (aKey[i] != bKey[i]) {
|
| - return false;
|
| - }
|
| - }
|
| - return true;
|
| - }
|
| -
|
| - static bool Less(const Desc& a, const Desc& b) {
|
| - if (a.fChecksum != b.fChecksum) {
|
| - return a.fChecksum < b.fChecksum ? true : false;
|
| - }
|
| - bool progDescLess = GrProgramDesc::Less(a.fProgramDesc, b.fProgramDesc);
|
| - if (progDescLess || a.fProgramDesc != b.fProgramDesc) {
|
| - return progDescLess;
|
| - }
|
| -
|
| - int keyLength = a.fStateKey.count();
|
| - SkASSERT(SkIsAlign4(keyLength));
|
| - int l = keyLength >> 2;
|
| - const uint32_t* aKey = reinterpret_cast<const uint32_t*>(a.fStateKey.begin());
|
| - const uint32_t* bKey = reinterpret_cast<const uint32_t*>(b.fStateKey.begin());
|
| - for (int i = 0; i < l; ++i) {
|
| - if (aKey[i] != bKey[i]) {
|
| - return aKey[i] < bKey[i] ? true : false;
|
| - }
|
| - }
|
| - return false;
|
| - }
|
| + class Desc : public GrProgramDesc {
|
| + public:
|
| + static bool Build(Desc*,
|
| + const GrPrimitiveProcessor&,
|
| + const GrPipeline&,
|
| + GrPrimitiveType primitiveType,
|
| + const GrGLSLCaps&);
|
| + private:
|
| + typedef GrProgramDesc INHERITED;
|
| };
|
|
|
| const Desc& getDesc() { return fDesc; }
|
|
|