18int VkYcbcrSamplerHelper::GetExpectedY(
int x,
int y,
int width,
int height) {
22std::pair<int, int> VkYcbcrSamplerHelper::GetExpectedUV(
int x,
int y,
int width,
int height) {
23 return { 16 +
x * 224 / (
width - 1), 16 +
y * 224 / (
height - 1) };
26GrVkGpu* VkYcbcrSamplerHelper::vkGpu() {
34VkYcbcrSamplerHelper::~VkYcbcrSamplerHelper() {
47bool VkYcbcrSamplerHelper::isYCbCrSupported() {
74bool VkYcbcrSamplerHelper::createBackendTexture(uint32_t
width, uint32_t
height) {
104 uint32_t memoryTypeIndex = 0;
105 bool foundHeap =
false;
109 for (uint32_t i = 0; i < phyDevMemProps.
memoryTypeCount && !foundHeap; ++i) {
129 nullptr, &fImageMemory));
136 requirements.
size, 0u, &mappedBuffer));
149 &subresource, &yLayout));
150 uint8_t* bufferData =
reinterpret_cast<uint8_t*
>(mappedBuffer) + yLayout.
offset;
152 for (
size_t x = 0;
x <
width; ++
x) {
161 &subresource, &uvLayout));
162 bufferData =
reinterpret_cast<uint8_t*
>(mappedBuffer) + uvLayout.
offset;
163 for (
size_t y = 0;
y <
height / 2; ++
y) {
164 for (
size_t x = 0;
x <
width / 2; ++
x) {
166 bufferData[
y * uvLayout.
rowPitch +
x * 2] = u;
167 bufferData[
y * uvLayout.
rowPitch +
x * 2 + 1] = v;
173 flushRange.
pNext =
nullptr;
174 flushRange.
memory = fImageMemory;
#define GR_VK_CALL(IFACE, X)
#define GR_VK_CALL_RESULT(GPU, RESULT, X)
#define SkASSERT_RELEASE(cond)
GrDirectContext * fDContext
SK_API GrBackendApi backend() const
GrDirectContextPriv priv()
bool supportsYcbcrConversion() const
const GrVkCaps & vkCaps() const
const skgpu::VulkanInterface * vkInterface() const
VkPhysicalDevice physicalDevice() const
SK_API GrBackendTexture MakeVk(int width, int height, const GrVkImageInfo &, std::string_view label={})
VkSharingMode sharingMode
VkImageLayout initialLayout
VkSampleCountFlagBits samples
VkImageAspectFlags aspectMask
VkDeviceSize allocationSize
VkMemoryPropertyFlags propertyFlags
VkMemoryType memoryTypes[VK_MAX_MEMORY_TYPES]
@ VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT
@ VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT
@ VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT
@ VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT
@ VK_IMAGE_LAYOUT_UNDEFINED
@ VK_SHARING_MODE_EXCLUSIVE
@ VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT
@ VK_IMAGE_ASPECT_PLANE_0_BIT
@ VK_IMAGE_ASPECT_PLANE_1_BIT
@ VK_IMAGE_USAGE_TRANSFER_DST_BIT
@ VK_IMAGE_USAGE_SAMPLED_BIT
@ VK_IMAGE_USAGE_TRANSFER_SRC_BIT
@ VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709
@ VK_CHROMA_LOCATION_COSITED_EVEN
@ VK_SAMPLER_YCBCR_RANGE_ITU_NARROW
@ VK_FORMAT_G8_B8R8_2PLANE_420_UNORM
#define VK_QUEUE_FAMILY_IGNORED
@ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
@ VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO
@ VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE