Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_34031325
engine
提交
b8fc6b78
E
engine
项目概览
qq_34031325
/
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,发现更多精彩内容 >>
未验证
提交
b8fc6b78
编写于
10月 31, 2017
作者:
M
mikejurka
提交者:
GitHub
10月 31, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Vulkan: Enable Fuchsia memory extensions on initialization. (#4301)
Refactor querying of supported Vulkan extensions.
上级
afd42296
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
60 addition
and
42 deletion
+60
-42
vulkan/vulkan_application.cc
vulkan/vulkan_application.cc
+53
-2
vulkan/vulkan_application.h
vulkan/vulkan_application.h
+5
-0
vulkan/vulkan_debug_report.cc
vulkan/vulkan_debug_report.cc
+0
-38
vulkan/vulkan_debug_report.h
vulkan/vulkan_debug_report.h
+0
-2
vulkan/vulkan_device.cc
vulkan/vulkan_device.cc
+2
-0
未找到文件。
vulkan/vulkan_application.cc
浏览文件 @
b8fc6b78
...
...
@@ -21,15 +21,25 @@ VulkanApplication::VulkanApplication(
uint32_t
api_version
)
:
vk
(
p_vk
),
api_version_
(
api_version
),
valid_
(
false
)
{
// Check if we want to enable debugging.
std
::
vector
<
VkExtensionProperties
>
supported_extensions
=
GetSupportedInstanceExtensions
(
vk
);
bool
enable_instance_debugging
=
IsDebuggingEnabled
()
&&
VulkanDebugReport
::
DebugExtensionSupported
(
vk
);
IsDebuggingEnabled
()
&&
ExtensionSupported
(
supported_extensions
,
VulkanDebugReport
::
DebugExtensionName
());
// Configure extensions.
if
(
enable_instance_debugging
)
{
enabled_extensions
.
emplace_back
(
VulkanDebugReport
::
DebugExtensionName
());
}
#if OS_FUCHSIA
if
(
ExtensionSupported
(
supported_extensions
,
VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME
))
{
enabled_extensions
.
emplace_back
(
VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME
);
}
#endif
const
char
*
extensions
[
enabled_extensions
.
size
()];
...
...
@@ -166,4 +176,45 @@ VulkanApplication::AcquireFirstCompatibleLogicalDevice() const {
return
nullptr
;
}
std
::
vector
<
VkExtensionProperties
>
VulkanApplication
::
GetSupportedInstanceExtensions
(
const
VulkanProcTable
&
vk
)
const
{
if
(
!
vk
.
EnumerateInstanceExtensionProperties
)
{
return
std
::
vector
<
VkExtensionProperties
>
();
}
uint32_t
count
=
0
;
if
(
VK_CALL_LOG_ERROR
(
vk
.
EnumerateInstanceExtensionProperties
(
nullptr
,
&
count
,
nullptr
))
!=
VK_SUCCESS
)
{
return
std
::
vector
<
VkExtensionProperties
>
();
}
if
(
count
==
0
)
{
return
std
::
vector
<
VkExtensionProperties
>
();
}
std
::
vector
<
VkExtensionProperties
>
properties
;
properties
.
resize
(
count
);
if
(
VK_CALL_LOG_ERROR
(
vk
.
EnumerateInstanceExtensionProperties
(
nullptr
,
&
count
,
properties
.
data
()))
!=
VK_SUCCESS
)
{
return
std
::
vector
<
VkExtensionProperties
>
();
}
return
properties
;
}
bool
VulkanApplication
::
ExtensionSupported
(
const
std
::
vector
<
VkExtensionProperties
>&
supported_instance_extensions
,
std
::
string
extension_name
)
{
uint32_t
count
=
supported_instance_extensions
.
size
();
for
(
size_t
i
=
0
;
i
<
count
;
i
++
)
{
if
(
strncmp
(
supported_instance_extensions
[
i
].
extensionName
,
extension_name
.
c_str
(),
extension_name
.
size
())
==
0
)
{
return
true
;
}
}
return
false
;
}
}
// namespace vulkan
vulkan/vulkan_application.h
浏览文件 @
b8fc6b78
...
...
@@ -50,6 +50,11 @@ class VulkanApplication {
bool
valid_
;
std
::
vector
<
VkPhysicalDevice
>
GetPhysicalDevices
()
const
;
std
::
vector
<
VkExtensionProperties
>
GetSupportedInstanceExtensions
(
const
VulkanProcTable
&
vk
)
const
;
bool
ExtensionSupported
(
const
std
::
vector
<
VkExtensionProperties
>&
supported_extensions
,
std
::
string
extension_name
);
FXL_DISALLOW_COPY_AND_ASSIGN
(
VulkanApplication
);
};
...
...
vulkan/vulkan_debug_report.cc
浏览文件 @
b8fc6b78
...
...
@@ -22,44 +22,6 @@ std::string VulkanDebugReport::DebugExtensionName() {
return
VK_EXT_DEBUG_REPORT_EXTENSION_NAME
;
}
bool
VulkanDebugReport
::
DebugExtensionSupported
(
const
VulkanProcTable
&
vk
)
{
if
(
!
IsDebuggingEnabled
())
{
return
false
;
}
if
(
!
vk
.
EnumerateInstanceExtensionProperties
)
{
return
false
;
}
uint32_t
count
=
0
;
if
(
VK_CALL_LOG_ERROR
(
vk
.
EnumerateInstanceExtensionProperties
(
nullptr
,
&
count
,
nullptr
))
!=
VK_SUCCESS
)
{
return
false
;
}
if
(
count
==
0
)
{
return
false
;
}
std
::
vector
<
VkExtensionProperties
>
properties
;
properties
.
resize
(
count
);
if
(
VK_CALL_LOG_ERROR
(
vk
.
EnumerateInstanceExtensionProperties
(
nullptr
,
&
count
,
properties
.
data
()))
!=
VK_SUCCESS
)
{
return
false
;
}
auto
debug_extension_name
=
DebugExtensionName
();
for
(
size_t
i
=
0
;
i
<
count
;
i
++
)
{
if
(
strncmp
(
properties
[
i
].
extensionName
,
debug_extension_name
.
c_str
(),
debug_extension_name
.
size
())
==
0
)
{
return
true
;
}
}
return
false
;
}
static
const
char
*
VkDebugReportFlagsEXTToString
(
VkDebugReportFlagsEXT
flags
)
{
if
(
flags
&
VK_DEBUG_REPORT_INFORMATION_BIT_EXT
)
{
return
"Information"
;
...
...
vulkan/vulkan_debug_report.h
浏览文件 @
b8fc6b78
...
...
@@ -14,8 +14,6 @@ namespace vulkan {
class
VulkanDebugReport
{
public:
static
bool
DebugExtensionSupported
(
const
VulkanProcTable
&
vk
);
static
std
::
string
DebugExtensionName
();
VulkanDebugReport
(
const
VulkanProcTable
&
vk
,
...
...
vulkan/vulkan_device.cc
浏览文件 @
b8fc6b78
...
...
@@ -61,6 +61,8 @@ VulkanDevice::VulkanDevice(VulkanProcTable& p_vk,
const
char
*
extensions
[]
=
{
VK_KHR_SWAPCHAIN_EXTENSION_NAME
,
#if OS_FUCHSIA
VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME
,
VK_KHR_EXTERNAL_MEMORY_FUCHSIA_EXTENSION_NAME
,
VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME
,
VK_KHR_EXTERNAL_SEMAPHORE_FUCHSIA_EXTENSION_NAME
,
#endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录