057c33fe63
This is part of the effort to replace GrContext with the GrDirectContext/GrRecordingContext pair. It also tries out, a bit, the context naming proposal (i.e., rContext and dContext). Change-Id: Ib4d9881f820a7f8a8c525eba7448b1015526400c Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303627 Reviewed-by: Adlai Holler <adlai@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
49 lines
1.2 KiB
C++
49 lines
1.2 KiB
C++
/*
|
|
* Copyright 2020 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef VkYcbcrSamplerHelper_DEFINED
|
|
#define VkYcbcrSamplerHelper_DEFINED
|
|
|
|
#include "include/core/SkTypes.h"
|
|
|
|
#ifdef SK_VULKAN
|
|
|
|
#include "include/gpu/GrBackendSurface.h"
|
|
|
|
class GrContext;
|
|
class GrVkGpu;
|
|
|
|
// This helper will create and hold data for a Vulkan YCbCr backend texture. This format is
|
|
// particularly interesting because its sampler is immutable.
|
|
class VkYcbcrSamplerHelper {
|
|
public:
|
|
VkYcbcrSamplerHelper(GrDirectContext*);
|
|
~VkYcbcrSamplerHelper();
|
|
|
|
bool isYCbCrSupported();
|
|
|
|
bool createBackendTexture(uint32_t width, uint32_t height);
|
|
|
|
const GrBackendTexture& backendTexture() const { return fTexture; }
|
|
|
|
static int GetExpectedY(int x, int y, int width, int height);
|
|
static std::pair<int, int> GetExpectedUV(int x, int y, int width, int height);
|
|
|
|
private:
|
|
GrVkGpu* vkGpu();
|
|
|
|
GrDirectContext* fDContext;
|
|
|
|
VkImage fImage = VK_NULL_HANDLE;
|
|
VkDeviceMemory fImageMemory = VK_NULL_HANDLE;
|
|
GrBackendTexture fTexture;
|
|
};
|
|
|
|
#endif // SK_VULKAN
|
|
|
|
#endif // VkYcbcrSamplerHelper_DEFINED
|