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

Side by Side Diff: src/gpu/vk/GrVkImageView.cpp

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 unified diff | Download patch
« no previous file with comments | « src/gpu/vk/GrVkImageView.h ('k') | src/gpu/vk/GrVkIndexBuffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "GrVkImageView.h"
9 #include "GrVkGpu.h"
10 #include "GrVkUtil.h"
11
12 const GrVkImageView* GrVkImageView::Create(GrVkGpu* gpu, VkImage image, VkFormat format,
13 Type viewType) {
14 VkImageView imageView;
15
16 // Create the VkImageView
17 VkImageViewCreateInfo viewInfo = {
18 VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, // sType
19 NULL, // pNext
20 0, // flags
21 image, // image
22 VK_IMAGE_VIEW_TYPE_2D, // viewType
23 format, // format
24 { VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G,
25 VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_A }, // components
26 { VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1 }, // subresourceRa nge
27 };
28 if (kStencil_Type == viewType) {
29 viewInfo.components.r = VK_COMPONENT_SWIZZLE_ZERO;
30 viewInfo.components.g = VK_COMPONENT_SWIZZLE_ZERO;
31 viewInfo.components.b = VK_COMPONENT_SWIZZLE_ZERO;
32 viewInfo.components.a = VK_COMPONENT_SWIZZLE_ZERO;
33 viewInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_STENCIL_BIT;
34 }
35
36 VkResult err = GR_VK_CALL(gpu->vkInterface(), CreateImageView(gpu->device(), &viewInfo,
37 nullptr, &imag eView));
38 if (err) {
39 return nullptr;
40 }
41
42 return new GrVkImageView(imageView);
43 }
44
45 void GrVkImageView::freeGPUData(const GrVkGpu* gpu) const {
46 GR_VK_CALL(gpu->vkInterface(), DestroyImageView(gpu->device(), fImageView, n ullptr));
47 }
48
49
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkImageView.h ('k') | src/gpu/vk/GrVkIndexBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698