vk: better vendor info (#2529)

This commit is contained in:
Yun Hsiao Wu
2020-06-05 14:21:42 +08:00
committed by GitHub
parent 4f241df386
commit d368b11250
5 changed files with 42 additions and 11 deletions
+23 -4
View File
@@ -153,8 +153,8 @@ bool CCVKDevice::initialize(const GFXDeviceInfo& info)
else
{
deviceCreateInfo.pNext = &requestedFeatures2;
if (context->minorVersion() >= VK_API_VERSION_1_1) requestedFeatures2.pNext = &requestedVulkan11Features;
if (context->minorVersion() >= VK_API_VERSION_1_2) requestedVulkan11Features.pNext = &requestedVulkan12Features;
if (context->minorVersion() >= 1) requestedFeatures2.pNext = &requestedVulkan11Features;
if (context->minorVersion() >= 2) requestedVulkan11Features.pNext = &requestedVulkan12Features;
}
VK_CHECK(vkCreateDevice(gpuContext->physicalDevice, &deviceCreateInfo, nullptr, &_gpuDevice->vkDevice));
@@ -282,6 +282,18 @@ bool CCVKDevice::initialize(const GFXDeviceInfo& info)
deviceExtensions += extension + String(" ");
}
_features[(int)GFXFeature::COLOR_FLOAT] = true;
_features[(int)GFXFeature::COLOR_HALF_FLOAT] = true;
_features[(int)GFXFeature::TEXTURE_FLOAT] = true;
_features[(int)GFXFeature::TEXTURE_HALF_FLOAT] = true;
_features[(int)GFXFeature::TEXTURE_FLOAT_LINEAR] = true;
_features[(int)GFXFeature::TEXTURE_HALF_FLOAT_LINEAR] = true;
_features[(int)GFXFeature::FORMAT_R11G11B10F] = true;
_features[(int)GFXFeature::FORMAT_D24S8] = true;
_features[(int)GFXFeature::MSAA] = true;
_features[(int)GFXFeature::ELEMENT_INDEX_UINT] = true;
_features[(int)GFXFeature::INSTANCED_ARRAYS] = true;
String compressedFmts;
if (deviceFeatures.textureCompressionETC2)
{
@@ -294,9 +306,16 @@ bool CCVKDevice::initialize(const GFXDeviceInfo& info)
compressedFmts += "astc ";
}
uint32_t apiVersion = gpuContext->physicalDeviceProperties.apiVersion;
_renderer = gpuContext->physicalDeviceProperties.deviceName;
_vendor = MapVendorName(gpuContext->physicalDeviceProperties.vendorID);
_version = StringUtil::Format("%d.%d.%d", VK_VERSION_MAJOR(apiVersion),
VK_VERSION_MINOR(apiVersion), VK_VERSION_PATCH(apiVersion));
CC_LOG_INFO("Vulkan device initialized.");
CC_LOG_INFO("DEVICE_NAME: %s", gpuContext->physicalDeviceProperties.deviceName);
CC_LOG_INFO("VULKAN_VERSION: %d.%d", ((CCVKContext*)_context)->majorVersion(), ((CCVKContext*)_context)->minorVersion());
CC_LOG_INFO("RENDERER: %s", _renderer.c_str());
CC_LOG_INFO("VENDOR: %s", _vendor.c_str());
CC_LOG_INFO("VERSION: %s", _version.c_str());
CC_LOG_INFO("SCREEN_SIZE: %d x %d", _width, _height);
CC_LOG_INFO("NATIVE_SIZE: %d x %d", _nativeWidth, _nativeHeight);
CC_LOG_INFO("INSTANCE_LAYERS: %s", instanceLayers.c_str());
@@ -588,6 +588,20 @@ namespace
return ++v;
}
const char* MapVendorName(uint32_t vendorID)
{
switch (vendorID)
{
case 0x1002: return "Advanced Micro Devices, Inc.";
case 0x1010: return "Imagination Technologies";
case 0x10DE: return "Nvidia Corporation";
case 0x13B5: return "Arm Limited";
case 0x5143: return "Qualcomm Incorporated";
case 0x8086: return "Intel Corporation";
}
return "Unknown";
}
bool isLayerSupported(const char * required, const std::vector<VkLayerProperties> &available)
{
for (const VkLayerProperties &availableLayer : available)
@@ -13407,7 +13407,7 @@ static bool js_gfx_GFXDevice_getDepthStencilFormat(se::State& s)
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_gfx_GFXDevice_getDepthStencilFormat)
SE_BIND_PROP_GET(js_gfx_GFXDevice_getDepthStencilFormat)
static bool js_gfx_GFXDevice_getNumTris(se::State& s)
{
@@ -13662,7 +13662,7 @@ static bool js_gfx_GFXDevice_getColorFormat(se::State& s)
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_gfx_GFXDevice_getColorFormat)
SE_BIND_PROP_GET(js_gfx_GFXDevice_getColorFormat)
static bool js_gfx_GFXDevice_createFramebuffer(se::State& s)
{
@@ -14240,21 +14240,21 @@ bool js_register_gfx_GFXDevice(se::Object* obj)
cls->defineProperty("minClipZ", _SE(js_gfx_GFXDevice_getMinClipZ), nullptr);
cls->defineProperty("maxTextureSize", _SE(js_gfx_GFXDevice_getMaxTextureSize), nullptr);
cls->defineProperty("nativeHeight", _SE(js_gfx_GFXDevice_getNativeHeight), nullptr);
cls->defineProperty("depthStencilFormat", _SE(js_gfx_GFXDevice_getDepthStencilFormat), nullptr);
cls->defineProperty("numTris", _SE(js_gfx_GFXDevice_getNumTris), nullptr);
cls->defineProperty("stencilBits", _SE(js_gfx_GFXDevice_getStencilBits), nullptr);
cls->defineProperty("queue", _SE(js_gfx_GFXDevice_getQueue), nullptr);
cls->defineProperty("context", _SE(js_gfx_GFXDevice_getContext), nullptr);
cls->defineProperty("colorFormat", _SE(js_gfx_GFXDevice_getColorFormat), nullptr);
cls->defineProperty("mainWindow", _SE(js_gfx_GFXDevice_getMainWindow), nullptr);
cls->defineFunction("hasFeature", _SE(js_gfx_GFXDevice_hasFeature));
cls->defineFunction("createFence", _SE(js_gfx_GFXDevice_createFence));
cls->defineFunction("createCommandAllocator", _SE(js_gfx_GFXDevice_createCommandAllocator));
cls->defineFunction("getDepthStencilFormat", _SE(js_gfx_GFXDevice_getDepthStencilFormat));
cls->defineFunction("createPipelineState", _SE(js_gfx_GFXDevice_createPipelineState));
cls->defineFunction("createCommandBuffer", _SE(js_gfx_GFXDevice_createCommandBuffer));
cls->defineFunction("present", _SE(js_gfx_GFXDevice_present));
cls->defineFunction("createTexture", _SE(js_gfx_GFXDevice_createTexture));
cls->defineFunction("destroy", _SE(js_gfx_GFXDevice_destroy));
cls->defineFunction("getColorFormat", _SE(js_gfx_GFXDevice_getColorFormat));
cls->defineFunction("createFramebuffer", _SE(js_gfx_GFXDevice_createFramebuffer));
cls->defineFunction("createRenderPass", _SE(js_gfx_GFXDevice_createRenderPass));
cls->defineFunction("createPipelineLayout", _SE(js_gfx_GFXDevice_createPipelineLayout));
@@ -282,13 +282,11 @@ bool register_all_gfx(se::Object* obj);
SE_DECLARE_FUNC(js_gfx_GFXDevice_hasFeature);
SE_DECLARE_FUNC(js_gfx_GFXDevice_createFence);
SE_DECLARE_FUNC(js_gfx_GFXDevice_createCommandAllocator);
SE_DECLARE_FUNC(js_gfx_GFXDevice_getDepthStencilFormat);
SE_DECLARE_FUNC(js_gfx_GFXDevice_createPipelineState);
SE_DECLARE_FUNC(js_gfx_GFXDevice_createCommandBuffer);
SE_DECLARE_FUNC(js_gfx_GFXDevice_present);
SE_DECLARE_FUNC(js_gfx_GFXDevice_createTexture);
SE_DECLARE_FUNC(js_gfx_GFXDevice_destroy);
SE_DECLARE_FUNC(js_gfx_GFXDevice_getColorFormat);
SE_DECLARE_FUNC(js_gfx_GFXDevice_createFramebuffer);
SE_DECLARE_FUNC(js_gfx_GFXDevice_createRenderPass);
SE_DECLARE_FUNC(js_gfx_GFXDevice_createPipelineLayout);
+1 -1
View File
@@ -63,7 +63,7 @@ skip = GFXBindingLayout::[GFXBindingLayout],
GFXDevice::[copyBuffersToTexture],
GFXBlendState::[targets]
getter_setter = GFXDevice::[gfxAPI deviceName width height nativeWidth nativeHeight memoryStatus context mainWindow queue commandAllocator renderer vendor numDrawCalls numInstances numTris maxVertexAttributes maxVertexUniformVectors maxFragmentUniformVectors maxTextureUnits maxVertexTextureUnits maxUniformBufferBindings maxUniformBlockSize maxTextureSize maxCubeMapTextureSize depthBits stencilBits reverseCW shaderIdGen minClipZ projectionSignY],
getter_setter = GFXDevice::[gfxAPI deviceName width height nativeWidth nativeHeight memoryStatus context mainWindow queue commandAllocator renderer vendor numDrawCalls numInstances numTris maxVertexAttributes maxVertexUniformVectors maxFragmentUniformVectors maxTextureUnits maxVertexTextureUnits maxUniformBufferBindings maxUniformBlockSize maxTextureSize maxCubeMapTextureSize depthBits stencilBits reverseCW shaderIdGen colorFormat depthStencilFormat minClipZ projectionSignY],
GFXWindow::[device title left top width height nativeWidth nativeHeight colorFormat isOffscreen/isOffscreen renderPass colorTexture colorTexView depthStencilTexture depthStencilTexView framebuffer],
GFXShader::[device name hash stages blocks samplers],
GFXTextureView::[device texture type format baseLevel levelCount baseLayer layerCount],