Commit f70e0237 by Luc Ferron Committed by Commit Bot

Vulkan: Finish implementing caps limitations for ES 2.0 support

Bug: angleproject:1577 Change-Id: Id22af039109b175f60f11cea1d6b8b2308c5cfff Reviewed-on: https://chromium-review.googlesource.com/891420 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 8efd1268
...@@ -10,9 +10,13 @@ ...@@ -10,9 +10,13 @@
#include "libANGLE/renderer/vulkan/vk_caps_utils.h" #include "libANGLE/renderer/vulkan/vk_caps_utils.h"
#include "libANGLE/Caps.h" #include "libANGLE/Caps.h"
namespace rx namespace
{ {
constexpr unsigned int kComponentsPerVector = 4;
}
namespace rx
{
namespace vk namespace vk
{ {
...@@ -22,15 +26,6 @@ void GenerateCaps(const VkPhysicalDeviceProperties &physicalDeviceProperties, ...@@ -22,15 +26,6 @@ void GenerateCaps(const VkPhysicalDeviceProperties &physicalDeviceProperties,
gl::Extensions *outExtensions, gl::Extensions *outExtensions,
gl::Limitations * /* outLimitations */) 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. // Enable this for simple buffer readback testing, but some functionality is missing.
// TODO(jmadill): Support full mapBufferRange extension. // TODO(jmadill): Support full mapBufferRange extension.
outExtensions->mapBuffer = true; outExtensions->mapBuffer = true;
...@@ -63,11 +58,66 @@ void GenerateCaps(const VkPhysicalDeviceProperties &physicalDeviceProperties, ...@@ -63,11 +58,66 @@ void GenerateCaps(const VkPhysicalDeviceProperties &physicalDeviceProperties,
outCaps->maxDepthTextureSamples = physicalDeviceProperties.limits.sampledImageDepthSampleCounts; outCaps->maxDepthTextureSamples = physicalDeviceProperties.limits.sampledImageDepthSampleCounts;
outCaps->maxIntegerSamples = physicalDeviceProperties.limits.sampledImageIntegerSampleCounts; outCaps->maxIntegerSamples = physicalDeviceProperties.limits.sampledImageIntegerSampleCounts;
outCaps->maxVertexAttributes = physicalDeviceProperties.limits.maxVertexInputAttributes;
outCaps->maxVertexAttribBindings = physicalDeviceProperties.limits.maxVertexInputBindings;
outCaps->maxVertexAttribRelativeOffset =
physicalDeviceProperties.limits.maxVertexInputAttributeOffset;
outCaps->maxVertexAttribStride = physicalDeviceProperties.limits.maxVertexInputBindingStride;
outCaps->maxElementsIndices = std::numeric_limits<GLuint>::max();
outCaps->maxElementsVertices = std::numeric_limits<GLuint>::max();
// Looks like all floats are IEEE according to the docs here:
// https://www.khronos.org/registry/vulkan/specs/1.0-wsi_extensions/html/vkspec.html#spirvenv-precision-operation
outCaps->vertexHighpFloat.setIEEEFloat();
outCaps->vertexMediumpFloat.setIEEEFloat();
outCaps->vertexLowpFloat.setIEEEFloat();
outCaps->fragmentHighpFloat.setIEEEFloat();
outCaps->fragmentMediumpFloat.setIEEEFloat();
outCaps->fragmentLowpFloat.setIEEEFloat();
// Can't find documentation on the int precision in Vulkan.
outCaps->vertexHighpInt.setTwosComplementInt(32);
outCaps->vertexMediumpInt.setTwosComplementInt(32);
outCaps->vertexLowpInt.setTwosComplementInt(32);
outCaps->fragmentHighpInt.setTwosComplementInt(32);
outCaps->fragmentMediumpInt.setTwosComplementInt(32);
outCaps->fragmentLowpInt.setTwosComplementInt(32);
// TODO(lucferron): This is something we'll need to implement custom in the back-end. // 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, // 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 // and we'll have to check that we've exceeded the max wait timeout. Also, this is ES 3.0 so
// we'll defer the implementation until we tackle the next version. // we'll defer the implementation until we tackle the next version.
// outCaps->maxServerWaitTimeout // outCaps->maxServerWaitTimeout
const GLuint maxUniformVectors = physicalDeviceProperties.limits.maxUniformBufferRange /
(sizeof(GLfloat) * kComponentsPerVector);
const GLuint maxUniformComponents = maxUniformVectors * kComponentsPerVector;
// Uniforms are implemented using a uniform buffer, so the max number of uniforms we can
// support is the max buffer range divided by the size of a single uniform (4X float).
outCaps->maxVertexUniformVectors = maxUniformVectors;
outCaps->maxVertexUniformComponents = maxUniformComponents;
outCaps->maxFragmentUniformVectors = maxUniformVectors;
outCaps->maxFragmentUniformComponents = maxUniformComponents;
// TODO(jmadill): this is an ES 3.0 property and we can skip implementing it for now.
// This is maxDescriptorSetUniformBuffers minus the number of uniform buffers we
// reserve for internal variables. We reserve one per shader stage for default uniforms
// and likely one per shader stage for ANGLE internal variables.
// outCaps->maxVertexUniformBlocks = ...
outCaps->maxVertexOutputComponents = physicalDeviceProperties.limits.maxVertexOutputComponents;
// we use the same bindings on each stage, so the limitation is the same combined or not.
outCaps->maxCombinedTextureImageUnits =
physicalDeviceProperties.limits.maxPerStageDescriptorSamplers;
outCaps->maxTextureImageUnits = physicalDeviceProperties.limits.maxPerStageDescriptorSamplers;
outCaps->maxVertexTextureImageUnits =
physicalDeviceProperties.limits.maxPerStageDescriptorSamplers;
// TODO(jmadill): count reserved varyings
outCaps->maxVaryingVectors = physicalDeviceProperties.limits.maxVertexOutputComponents / 4;
} }
} // namespace vk } // namespace vk
} // namespace rx } // namespace rx
\ No newline at end of file
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