aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/vk
diff options
context:
space:
mode:
authorGravatar Ruiqi Mao <ruiqimao@google.com>2018-07-17 10:19:38 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-17 15:08:40 +0000
commitb609e6dc6a02336aed04caaddcdd5ccfbe7ba9ec (patch)
tree052d6e5c5c7835481f5a0e0bead6ec575679b76f /src/gpu/vk
parent6dd4b209091b876832218e8adf1909669960bf98 (diff)
added byte and ubyte types to SKSL
created new GMs for skinning Bug: skia: Change-Id: I15fb2bd02fba8beb6dd2dd3f3716da016ea92192 Reviewed-on: https://skia-review.googlesource.com/140241 Commit-Queue: Ruiqi Mao <ruiqimao@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/gpu/vk')
-rw-r--r--src/gpu/vk/GrVkCaps.cpp3
-rw-r--r--src/gpu/vk/GrVkPipeline.cpp16
-rw-r--r--src/gpu/vk/GrVkUniformHandler.cpp27
-rw-r--r--src/gpu/vk/GrVkVaryingHandler.cpp12
4 files changed, 56 insertions, 2 deletions
diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp
index 8181569af3..8503bea5d6 100644
--- a/src/gpu/vk/GrVkCaps.cpp
+++ b/src/gpu/vk/GrVkCaps.cpp
@@ -399,6 +399,9 @@ void GrVkCaps::initShaderCaps(const VkPhysicalDeviceProperties& properties, uint
shaderCaps->fFloatIs32Bits = true;
shaderCaps->fHalfIs32Bits = false;
+ // SPIR-V supports unsigned integers.
+ shaderCaps->fUnsignedSupport = true;
+
shaderCaps->fMaxVertexSamplers =
shaderCaps->fMaxGeometrySamplers =
shaderCaps->fMaxFragmentSamplers = SkTMin(
diff --git a/src/gpu/vk/GrVkPipeline.cpp b/src/gpu/vk/GrVkPipeline.cpp
index 91f42ade37..60e7f43259 100644
--- a/src/gpu/vk/GrVkPipeline.cpp
+++ b/src/gpu/vk/GrVkPipeline.cpp
@@ -34,6 +34,22 @@ static inline VkFormat attrib_type_to_vkformat(GrVertexAttribType type) {
return VK_FORMAT_R32G32B32_SINT;
case kInt4_GrVertexAttribType:
return VK_FORMAT_R32G32B32A32_SINT;
+ case kByte_GrVertexAttribType:
+ return VK_FORMAT_R8_SINT;
+ case kByte2_GrVertexAttribType:
+ return VK_FORMAT_R8G8_SINT;
+ case kByte3_GrVertexAttribType:
+ return VK_FORMAT_R8G8B8_SINT;
+ case kByte4_GrVertexAttribType:
+ return VK_FORMAT_R8G8B8A8_SINT;
+ case kUByte_GrVertexAttribType:
+ return VK_FORMAT_R8_UINT;
+ case kUByte2_GrVertexAttribType:
+ return VK_FORMAT_R8G8_UINT;
+ case kUByte3_GrVertexAttribType:
+ return VK_FORMAT_R8G8B8_UINT;
+ case kUByte4_GrVertexAttribType:
+ return VK_FORMAT_R8G8B8A8_UINT;
case kUByte_norm_GrVertexAttribType:
return VK_FORMAT_R8_UNORM;
case kUByte4_norm_GrVertexAttribType:
diff --git a/src/gpu/vk/GrVkUniformHandler.cpp b/src/gpu/vk/GrVkUniformHandler.cpp
index d92d8d2fd6..848d52a5cd 100644
--- a/src/gpu/vk/GrVkUniformHandler.cpp
+++ b/src/gpu/vk/GrVkUniformHandler.cpp
@@ -18,6 +18,17 @@
// https://www.khronos.org/registry/vulkan/specs/1.0-wsi_extensions/html/vkspec.html#interfaces-resources-layout
uint32_t grsltype_to_alignment_mask(GrSLType type) {
switch(type) {
+ case kByte_GrSLType: // fall through
+ case kUByte_GrSLType:
+ return 0x0;
+ case kByte2_GrSLType: // fall through
+ case kUByte2_GrSLType:
+ return 0x1;
+ case kByte3_GrSLType: // fall through
+ case kByte4_GrSLType:
+ case kUByte3_GrSLType:
+ case kUByte4_GrSLType:
+ return 0x3;
case kShort_GrSLType: // fall through
case kUShort_GrSLType:
return 0x1;
@@ -80,6 +91,22 @@ uint32_t grsltype_to_alignment_mask(GrSLType type) {
/** Returns the size in bytes taken up in vulkanbuffers for GrSLTypes. */
static inline uint32_t grsltype_to_vk_size(GrSLType type) {
switch(type) {
+ case kByte_GrSLType:
+ return sizeof(int8_t);
+ case kByte2_GrSLType:
+ return 2 * sizeof(int8_t);
+ case kByte3_GrSLType:
+ return 3 * sizeof(int8_t);
+ case kByte4_GrSLType:
+ return 4 * sizeof(int8_t);
+ case kUByte_GrSLType:
+ return sizeof(uint8_t);
+ case kUByte2_GrSLType:
+ return 2 * sizeof(uint8_t);
+ case kUByte3_GrSLType:
+ return 3 * sizeof(uint8_t);
+ case kUByte4_GrSLType:
+ return 4 * sizeof(uint8_t);
case kShort_GrSLType:
return sizeof(int16_t);
case kShort2_GrSLType:
diff --git a/src/gpu/vk/GrVkVaryingHandler.cpp b/src/gpu/vk/GrVkVaryingHandler.cpp
index c8c56c2aa2..d210aba18f 100644
--- a/src/gpu/vk/GrVkVaryingHandler.cpp
+++ b/src/gpu/vk/GrVkVaryingHandler.cpp
@@ -30,14 +30,20 @@ static inline int grsltype_to_location_size(GrSLType type) {
case kInt2_GrSLType:
case kShort2_GrSLType:
case kUShort2_GrSLType:
+ case kByte2_GrSLType:
+ case kUByte2_GrSLType:
return 1;
case kInt3_GrSLType:
case kShort3_GrSLType:
case kUShort3_GrSLType:
+ case kByte3_GrSLType:
+ case kUByte3_GrSLType:
return 1;
case kInt4_GrSLType:
case kShort4_GrSLType:
case kUShort4_GrSLType:
+ case kByte4_GrSLType:
+ case kUByte4_GrSLType:
return 1;
case kFloat2x2_GrSLType:
case kHalf2x2_GrSLType:
@@ -60,9 +66,11 @@ static inline int grsltype_to_location_size(GrSLType type) {
return 1;
case kInt_GrSLType: // fall through
case kShort_GrSLType:
+ case kByte_GrSLType:
return 1;
- case kUint_GrSLType:
- case kUShort_GrSLType: // fall through
+ case kUint_GrSLType: // fall through
+ case kUShort_GrSLType:
+ case kUByte_GrSLType:
return 1;
case kTexture2D_GrSLType:
return 0;