Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
liujiuri
engine
提交
8a218122
E
engine
项目概览
liujiuri
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8a218122
编写于
3月 23, 2018
作者:
B
Brian Salomon
提交者:
Brian Osman
3月 23, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Vulkan swap chain setup no longer uses GrPixelConfig and doesn't include from skia/src (#4856)
上级
9e0e7247
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
80 addition
and
68 deletion
+80
-68
content_handler/vulkan_surface.cc
content_handler/vulkan_surface.cc
+0
-1
content_handler/vulkan_surface_producer.cc
content_handler/vulkan_surface_producer.cc
+0
-1
vulkan/vulkan_backbuffer.cc
vulkan/vulkan_backbuffer.cc
+1
-1
vulkan/vulkan_device.cc
vulkan/vulkan_device.cc
+12
-32
vulkan/vulkan_device.h
vulkan/vulkan_device.h
+3
-2
vulkan/vulkan_swapchain.cc
vulkan/vulkan_swapchain.cc
+58
-29
vulkan/vulkan_swapchain.h
vulkan/vulkan_swapchain.h
+6
-2
未找到文件。
content_handler/vulkan_surface.cc
浏览文件 @
8a218122
...
...
@@ -10,7 +10,6 @@
#include "third_party/skia/include/gpu/GrBackendSemaphore.h"
#include "third_party/skia/include/gpu/GrBackendSurface.h"
#include "third_party/skia/include/gpu/GrContext.h"
#include "third_party/skia/src/gpu/vk/GrVkImage.h"
namespace
flutter_runner
{
...
...
content_handler/vulkan_surface_producer.cc
浏览文件 @
8a218122
...
...
@@ -11,7 +11,6 @@
#include "third_party/skia/include/gpu/GrBackendSemaphore.h"
#include "third_party/skia/include/gpu/GrContext.h"
#include "third_party/skia/include/gpu/vk/GrVkTypes.h"
#include "third_party/skia/src/gpu/vk/GrVkUtil.h"
namespace
flutter_runner
{
...
...
vulkan/vulkan_backbuffer.cc
浏览文件 @
8a218122
...
...
@@ -6,9 +6,9 @@
#include <limits>
#include "flutter/vulkan/skia_vulkan_header.h"
#include "flutter/vulkan/vulkan_proc_table.h"
#include "third_party/skia/include/gpu/vk/GrVkTypes.h"
#include "third_party/skia/src/gpu/vk/GrVkUtil.h"
namespace
vulkan
{
...
...
vulkan/vulkan_device.cc
浏览文件 @
8a218122
...
...
@@ -12,7 +12,6 @@
#include "flutter/vulkan/vulkan_surface.h"
#include "flutter/vulkan/vulkan_utilities.h"
#include "third_party/skia/include/gpu/vk/GrVkBackendContext.h"
#include "third_party/skia/src/gpu/vk/GrVkUtil.h"
namespace
vulkan
{
...
...
@@ -260,65 +259,46 @@ std::vector<VkQueueFamilyProperties> VulkanDevice::GetQueueFamilyProperties()
return
properties
;
}
bool
VulkanDevice
::
ChooseSurfaceFormat
(
const
VulkanSurface
&
surface
,
int
VulkanDevice
::
ChooseSurfaceFormat
(
const
VulkanSurface
&
surface
,
std
::
vector
<
VkFormat
>
desired_formats
,
VkSurfaceFormatKHR
*
format
)
const
{
if
(
!
surface
.
IsValid
()
||
format
==
nullptr
)
{
return
false
;
return
-
1
;
}
uint32_t
format_count
=
0
;
if
(
VK_CALL_LOG_ERROR
(
vk
.
GetPhysicalDeviceSurfaceFormatsKHR
(
physical_device_
,
surface
.
Handle
(),
&
format_count
,
nullptr
))
!=
VK_SUCCESS
)
{
return
false
;
return
-
1
;
}
if
(
format_count
==
0
)
{
return
false
;
return
-
1
;
}
VkSurfaceFormatKHR
formats
[
format_count
];
if
(
VK_CALL_LOG_ERROR
(
vk
.
GetPhysicalDeviceSurfaceFormatsKHR
(
physical_device_
,
surface
.
Handle
(),
&
format_count
,
formats
))
!=
VK_SUCCESS
)
{
return
false
;
return
-
1
;
}
std
::
map
<
VkFormat
,
VkSurfaceFormatKHR
>
supported_formats
;
for
(
uint32_t
i
=
0
;
i
<
format_count
;
i
++
)
{
GrPixelConfig
pixel_config
=
GrVkFormatToPixelConfig
(
formats
[
i
].
format
);
if
(
pixel_config
!=
kUnknown_GrPixelConfig
)
{
supported_formats
[
formats
[
i
].
format
]
=
formats
[
i
];
}
}
if
(
supported_formats
.
size
()
==
0
)
{
return
false
;
}
const
std
::
vector
<
VkFormat
>
desired_formats
=
{
VK_FORMAT_R8G8B8A8_SRGB
,
// kSRGBA_8888_GrPixelConfig
VK_FORMAT_B8G8R8A8_SRGB
,
// kSBGRA_8888_GrPixelConfig
VK_FORMAT_R16G16B16A16_SFLOAT
,
// kRGBA_half_GrPixelConfig
VK_FORMAT_R8G8B8A8_UNORM
,
// kRGBA_8888_GrPixelConfig
VK_FORMAT_B8G8R8A8_UNORM
,
// kBGRA_8888_GrPixelConfig
};
// Try to find the first supported format in the list of desired formats.
for
(
VkFormat
current_format
:
desired_formats
)
{
auto
found
=
supported_formats
.
find
(
current_format
);
for
(
size_t
i
=
0
;
i
<
desired_formats
.
size
();
++
i
)
{
auto
found
=
supported_formats
.
find
(
desired_formats
[
i
]
);
if
(
found
!=
supported_formats
.
end
())
{
*
format
=
found
->
second
;
return
true
;
return
static_cast
<
int
>
(
i
)
;
}
}
// None of the desired formats were supported. Return the first supported
// format even if we don't like it all that much (it has already returned true
// for GrVkFormatToPixelConfig).
*
format
=
supported_formats
.
begin
()
->
second
;
return
true
;
return
-
1
;
}
bool
VulkanDevice
::
ChoosePresentMode
(
const
VulkanSurface
&
surface
,
...
...
vulkan/vulkan_device.h
浏览文件 @
8a218122
...
...
@@ -49,7 +49,8 @@ class VulkanDevice {
uint32_t
*
/* mask of GrVkFeatureFlags */
features
)
const
;
FXL_WARN_UNUSED_RESULT
bool
ChooseSurfaceFormat
(
const
VulkanSurface
&
surface
,
int
ChooseSurfaceFormat
(
const
VulkanSurface
&
surface
,
std
::
vector
<
VkFormat
>
desired_formats
,
VkSurfaceFormatKHR
*
format
)
const
;
FXL_WARN_UNUSED_RESULT
...
...
vulkan/vulkan_swapchain.cc
浏览文件 @
8a218122
...
...
@@ -10,11 +10,32 @@
#include "flutter/vulkan/vulkan_proc_table.h"
#include "flutter/vulkan/vulkan_surface.h"
#include "third_party/skia/include/gpu/GrBackendSurface.h"
#include "third_party/skia/include/gpu/GrContext.h"
#include "third_party/skia/include/gpu/vk/GrVkTypes.h"
#include "third_party/skia/src/gpu/vk/GrVkUtil.h"
namespace
vulkan
{
namespace
{
struct
FormatInfo
{
VkFormat
format_
;
SkColorType
color_type_
;
sk_sp
<
SkColorSpace
>
color_space_
;
};
}
// namespace
static
std
::
vector
<
FormatInfo
>
DesiredFormatInfos
()
{
return
{{
VK_FORMAT_R8G8B8A8_SRGB
,
kRGBA_8888_SkColorType
,
SkColorSpace
::
MakeSRGB
()},
{
VK_FORMAT_B8G8R8A8_SRGB
,
kRGBA_8888_SkColorType
,
SkColorSpace
::
MakeSRGB
()},
{
VK_FORMAT_R16G16B16A16_SFLOAT
,
kRGBA_F16_SkColorType
,
SkColorSpace
::
MakeSRGBLinear
()},
{
VK_FORMAT_R8G8B8A8_UNORM
,
kRGBA_8888_SkColorType
,
SkColorSpace
::
MakeSRGB
()},
{
VK_FORMAT_B8G8R8A8_UNORM
,
kRGBA_8888_SkColorType
,
SkColorSpace
::
MakeSRGB
()}};
}
VulkanSwapchain
::
VulkanSwapchain
(
const
VulkanProcTable
&
p_vk
,
const
VulkanDevice
&
device
,
const
VulkanSurface
&
surface
,
...
...
@@ -39,7 +60,20 @@ VulkanSwapchain::VulkanSwapchain(const VulkanProcTable& p_vk,
return
;
}
if
(
!
device_
.
ChooseSurfaceFormat
(
surface
,
&
surface_format_
))
{
const
auto
format_infos
=
DesiredFormatInfos
();
std
::
vector
<
VkFormat
>
desired_formats
(
format_infos
.
size
());
for
(
size_t
i
=
0
;
i
<
format_infos
.
size
();
++
i
)
{
if
(
skia_context
->
colorTypeSupportedAsSurface
(
format_infos
[
i
].
color_type_
))
{
desired_formats
[
i
]
=
format_infos
[
i
].
format_
;
}
else
{
desired_formats
[
i
]
=
VK_FORMAT_UNDEFINED
;
}
}
int
format_index
=
device_
.
ChooseSurfaceFormat
(
surface
,
desired_formats
,
&
surface_format_
);
if
(
format_index
<
0
)
{
FXL_DLOG
(
INFO
)
<<
"Could not choose surface format."
;
return
;
}
...
...
@@ -115,7 +149,9 @@ VulkanSwapchain::VulkanSwapchain(const VulkanProcTable& p_vk,
nullptr
);
}};
if
(
!
CreateSwapchainImages
(
skia_context
))
{
if
(
!
CreateSwapchainImages
(
skia_context
,
format_infos
[
format_index
].
color_type_
,
format_infos
[
format_index
].
color_space_
))
{
FXL_DLOG
(
INFO
)
<<
"Could not create swapchain images."
;
return
;
}
...
...
@@ -171,29 +207,18 @@ SkISize VulkanSwapchain::GetSize() const {
return
SkISize
::
Make
(
extents
.
width
,
extents
.
height
);
}
static
sk_sp
<
SkColorSpace
>
SkColorSpaceFromVkFormat
(
VkFormat
format
)
{
if
(
GrVkFormatIsSRGB
(
format
,
nullptr
/* dont care */
))
{
return
SkColorSpace
::
MakeSRGB
();
}
if
(
format
==
VK_FORMAT_R16G16B16A16_SFLOAT
)
{
return
SkColorSpace
::
MakeSRGBLinear
();
}
return
nullptr
;
}
sk_sp
<
SkSurface
>
VulkanSwapchain
::
CreateSkiaSurface
(
GrContext
*
gr_context
,
sk_sp
<
SkSurface
>
VulkanSwapchain
::
CreateSkiaSurface
(
GrContext
*
gr_context
,
VkImage
image
,
const
SkISize
&
size
)
const
{
const
SkISize
&
size
,
SkColorType
color_type
,
sk_sp
<
SkColorSpace
>
color_space
)
const
{
if
(
gr_context
==
nullptr
)
{
return
nullptr
;
}
GrPixelConfig
pixel_config
=
GrVkFormatToPixelConfig
(
surface_format_
.
format
);
if
(
pixel_config
==
kUnknown_GrPixelConfig
)
{
// Vulkan format unsupported by Skia.
if
(
color_type
==
kUnknown_SkColorType
)
{
// Unexpected Vulkan format.
return
nullptr
;
}
...
...
@@ -214,13 +239,16 @@ sk_sp<SkSurface> VulkanSwapchain::CreateSkiaSurface(GrContext* gr_context,
return
SkSurface
::
MakeFromBackendRenderTarget
(
gr_context
,
// context
backend_render_target
,
// backend render target
kTopLeft_GrSurfaceOrigin
,
SkColorSpaceFromVkFormat
(
surface_format_
.
format
),
// colorspace
kTopLeft_GrSurfaceOrigin
,
// origin
color_type
,
// color type
std
::
move
(
color_space
),
// color space
&
props
// surface properties
);
}
bool
VulkanSwapchain
::
CreateSwapchainImages
(
GrContext
*
skia_context
)
{
bool
VulkanSwapchain
::
CreateSwapchainImages
(
GrContext
*
skia_context
,
SkColorType
color_type
,
sk_sp
<
SkColorSpace
>
color_space
)
{
std
::
vector
<
VkImage
>
images
=
GetImages
();
if
(
images
.
size
()
==
0
)
{
...
...
@@ -250,7 +278,8 @@ bool VulkanSwapchain::CreateSwapchainImages(GrContext* skia_context) {
images_
.
emplace_back
(
std
::
move
(
vulkan_image
));
// Populate the surface.
auto
surface
=
CreateSkiaSurface
(
skia_context
,
image
,
surface_size
);
auto
surface
=
CreateSkiaSurface
(
skia_context
,
image
,
surface_size
,
color_type
,
color_space
);
if
(
surface
==
nullptr
)
{
return
false
;
...
...
vulkan/vulkan_swapchain.h
浏览文件 @
8a218122
...
...
@@ -77,11 +77,15 @@ class VulkanSwapchain {
std
::
vector
<
VkImage
>
GetImages
()
const
;
bool
CreateSwapchainImages
(
GrContext
*
skia_context
);
bool
CreateSwapchainImages
(
GrContext
*
skia_context
,
SkColorType
color_type
,
sk_sp
<
SkColorSpace
>
color_space
);
sk_sp
<
SkSurface
>
CreateSkiaSurface
(
GrContext
*
skia_context
,
VkImage
image
,
const
SkISize
&
size
)
const
;
const
SkISize
&
size
,
SkColorType
color_type
,
sk_sp
<
SkColorSpace
>
color_space
)
const
;
VulkanBackbuffer
*
GetNextBackbuffer
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录