Commit e4741fd0 by Luc Ferron Committed by Commit Bot

Vulkan: Begin implementing caps mappings

Bug: angleproject:1577 Change-Id: Ibed36dee9120e9182362bc9858cf513f798079cf Reviewed-on: https://chromium-review.googlesource.com/887225 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent d1434c04
......@@ -24,6 +24,7 @@
#include "libANGLE/renderer/vulkan/ProgramVk.h"
#include "libANGLE/renderer/vulkan/TextureVk.h"
#include "libANGLE/renderer/vulkan/VertexArrayVk.h"
#include "libANGLE/renderer/vulkan/vk_caps_utils.h"
#include "libANGLE/renderer/vulkan/vk_format_utils.h"
#include "platform/Platform.h"
......@@ -54,14 +55,14 @@ VkResult VerifyExtensionsPresent(const std::vector<VkExtensionProperties> &exten
return VK_SUCCESS;
}
VKAPI_ATTR VkBool32 VKAPI_CALL DebugReportCallback(VkDebugReportFlagsEXT flags,
VkDebugReportObjectTypeEXT objectType,
uint64_t object,
size_t location,
int32_t messageCode,
const char *layerPrefix,
const char *message,
void *userData)
VkBool32 VKAPI_CALL DebugReportCallback(VkDebugReportFlagsEXT flags,
VkDebugReportObjectTypeEXT objectType,
uint64_t object,
size_t location,
int32_t messageCode,
const char *layerPrefix,
const char *message,
void *userData)
{
if ((flags & VK_DEBUG_REPORT_ERROR_BIT_EXT) != 0)
{
......@@ -546,35 +547,12 @@ void RendererVk::ensureCapsInitialized() const
{
if (!mCapsInitialized)
{
generateCaps(&mNativeCaps, &mNativeTextureCaps, &mNativeExtensions, &mNativeLimitations);
vk::GenerateCaps(mPhysicalDeviceProperties, &mNativeCaps, &mNativeTextureCaps,
&mNativeExtensions, &mNativeLimitations);
mCapsInitialized = true;
}
}
void RendererVk::generateCaps(gl::Caps *outCaps,
gl::TextureCapsMap * /*outTextureCaps*/,
gl::Extensions *outExtensions,
gl::Limitations * /* outLimitations */) const
{
// TODO(jmadill): Caps.
outCaps->maxDrawBuffers = 1;
outCaps->maxVertexAttributes = gl::MAX_VERTEX_ATTRIBS;
outCaps->maxVertexAttribBindings = gl::MAX_VERTEX_ATTRIB_BINDINGS;
outCaps->maxVaryingVectors = 16;
outCaps->maxTextureImageUnits = 1;
outCaps->maxCombinedTextureImageUnits = 1;
outCaps->max2DTextureSize = 1024;
outCaps->maxElementIndex = std::numeric_limits<GLuint>::max() - 1;
outCaps->maxFragmentUniformVectors = 8;
outCaps->maxVertexUniformVectors = 8;
outCaps->maxColorAttachments = 1;
// Enable this for simple buffer readback testing, but some functionality is missing.
// TODO(jmadill): Support full mapBufferRange extension.
outExtensions->mapBuffer = true;
outExtensions->mapBufferRange = true;
}
const gl::Caps &RendererVk::getNativeCaps() const
{
ensureCapsInitialized();
......
//
// Copyright 2018 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// vk_utils:
// Helper functions for the Vulkan Caps.
//
#include "libANGLE/renderer/vulkan/vk_caps_utils.h"
#include "libANGLE/Caps.h"
namespace rx
{
namespace vk
{
void GenerateCaps(const VkPhysicalDeviceProperties &physicalDeviceProperties,
gl::Caps *outCaps,
gl::TextureCapsMap * /*outTextureCaps*/,
gl::Extensions *outExtensions,
gl::Limitations * /* outLimitations */)
{
// TODO(jmadill): Caps.
outCaps->maxVertexAttributes = gl::MAX_VERTEX_ATTRIBS;
outCaps->maxVertexAttribBindings = gl::MAX_VERTEX_ATTRIB_BINDINGS;
outCaps->maxVaryingVectors = 16;
outCaps->maxTextureImageUnits = 1;
outCaps->maxCombinedTextureImageUnits = 1;
outCaps->maxFragmentUniformVectors = 8;
outCaps->maxVertexUniformVectors = 8;
// Enable this for simple buffer readback testing, but some functionality is missing.
// TODO(jmadill): Support full mapBufferRange extension.
outExtensions->mapBuffer = true;
outExtensions->mapBufferRange = true;
// TODO(lucferron): Eventually remove everything above this line in this function as the caps
// get implemented.
// https://vulkan.lunarg.com/doc/view/1.0.30.0/linux/vkspec.chunked/ch31s02.html
outCaps->maxElementIndex = std::numeric_limits<GLuint>::max() - 1;
outCaps->max3DTextureSize = physicalDeviceProperties.limits.maxImageDimension3D;
outCaps->max2DTextureSize = physicalDeviceProperties.limits.maxImageDimension2D;
outCaps->maxArrayTextureLayers = physicalDeviceProperties.limits.maxImageArrayLayers;
outCaps->maxLODBias = physicalDeviceProperties.limits.maxSamplerLodBias;
outCaps->maxCubeMapTextureSize = physicalDeviceProperties.limits.maxImageDimensionCube;
outCaps->maxRenderbufferSize = outCaps->max2DTextureSize;
outCaps->minAliasedPointSize = physicalDeviceProperties.limits.pointSizeRange[0];
outCaps->maxAliasedPointSize = physicalDeviceProperties.limits.pointSizeRange[1];
outCaps->minAliasedLineWidth = physicalDeviceProperties.limits.lineWidthRange[0];
outCaps->maxAliasedLineWidth = physicalDeviceProperties.limits.lineWidthRange[1];
outCaps->maxDrawBuffers =
std::min<uint32_t>(physicalDeviceProperties.limits.maxColorAttachments,
physicalDeviceProperties.limits.maxFragmentOutputAttachments);
outCaps->maxFramebufferWidth = physicalDeviceProperties.limits.maxFramebufferWidth;
outCaps->maxFramebufferHeight = physicalDeviceProperties.limits.maxFramebufferHeight;
outCaps->maxColorAttachments = physicalDeviceProperties.limits.maxColorAttachments;
outCaps->maxViewportWidth = physicalDeviceProperties.limits.maxViewportDimensions[0];
outCaps->maxViewportHeight = physicalDeviceProperties.limits.maxViewportDimensions[1];
outCaps->maxSampleMaskWords = physicalDeviceProperties.limits.maxSampleMaskWords;
outCaps->maxColorTextureSamples = physicalDeviceProperties.limits.sampledImageColorSampleCounts;
outCaps->maxDepthTextureSamples = physicalDeviceProperties.limits.sampledImageDepthSampleCounts;
outCaps->maxIntegerSamples = physicalDeviceProperties.limits.sampledImageIntegerSampleCounts;
// TODO(lucferron): This is something we'll need to implement custom in the back-end.
// Vulkan doesn't do any waiting for you, our back-end code is going to manage sync objects,
// and we'll have to check that we've exceeded the max wait timeout. Alsom this is ES 3.0 so
// we'll defer the implementation until we tackle the next version.
// outCaps->maxServerWaitTimeout
}
} // namespace vk
} // namespace rx
\ No newline at end of file
//
// Copyright 2018 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// vk_utils:
// Helper functions for the Vulkan Caps.
//
#ifndef LIBANGLE_RENDERER_VULKAN_VK_CAPS_UTILS_H_
#define LIBANGLE_RENDERER_VULKAN_VK_CAPS_UTILS_H_
#include <vulkan/vulkan.h>
namespace gl
{
struct Limitations;
struct Extensions;
class TextureCapsMap;
struct Caps;
}
namespace rx
{
namespace vk
{
void GenerateCaps(const VkPhysicalDeviceProperties &physicalDeviceProperties,
gl::Caps *outCaps,
gl::TextureCapsMap * /*outTextureCaps*/,
gl::Extensions *outExtensions,
gl::Limitations * /* outLimitations */);
} // namespace vk
} // namespace rx
#endif
\ No newline at end of file
......@@ -757,6 +757,8 @@
'libANGLE/renderer/vulkan/VertexArrayVk.h',
'libANGLE/renderer/vulkan/vk_cache_utils.cpp',
'libANGLE/renderer/vulkan/vk_cache_utils.h',
'libANGLE/renderer/vulkan/vk_caps_utils.cpp',
'libANGLE/renderer/vulkan/vk_caps_utils.h',
'libANGLE/renderer/vulkan/vk_format_table_autogen.cpp',
'libANGLE/renderer/vulkan/vk_format_utils.h',
'libANGLE/renderer/vulkan/vk_format_utils.cpp',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment