diff options
author | Chris Dalton <csmartdalton@google.com> | 2017-10-24 13:22:10 -0600 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-10-25 15:44:05 +0000 |
commit | a045eea29eb79254248d7e2666825a1ca7d23d4e (patch) | |
tree | 4a0a55d8476a100c1fa5b54ca5212a02723a148f /src/gpu | |
parent | d204eb80abb0172b024664cf9f05d66d15574a24 (diff) |
CCPR: use 16-bit ints for the atlas offset attrib
Bug: skia:
Change-Id: I053e8416ced317b6ebc46cc8189840d60c7f91e8
Reviewed-on: https://skia-review.googlesource.com/62060
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/ccpr/GrCCPRPathProcessor.cpp | 4 | ||||
-rw-r--r-- | src/gpu/ccpr/GrCCPRPathProcessor.h | 4 | ||||
-rw-r--r-- | src/gpu/gl/GrGLVertexArray.cpp | 12 | ||||
-rw-r--r-- | src/gpu/vk/GrVkPipeline.cpp | 6 |
4 files changed, 15 insertions, 11 deletions
diff --git a/src/gpu/ccpr/GrCCPRPathProcessor.cpp b/src/gpu/ccpr/GrCCPRPathProcessor.cpp index 6608ce8114..ff3c60c134 100644 --- a/src/gpu/ccpr/GrCCPRPathProcessor.cpp +++ b/src/gpu/ccpr/GrCCPRPathProcessor.cpp @@ -56,9 +56,7 @@ GrCCPRPathProcessor::GrCCPRPathProcessor(GrResourceProvider* rp, sk_sp<GrTexture this->addInstanceAttrib("devbounds45", kFloat4_GrVertexAttribType); this->addInstanceAttrib("view_matrix", kFloat4_GrVertexAttribType); this->addInstanceAttrib("view_translate", kFloat2_GrVertexAttribType); - // FIXME: this could be a vector of two shorts if it were supported by Ganesh. - // Note: this should be doable now with kUShort2_GrVertexAttribType - this->addInstanceAttrib("atlas_offset", kInt2_GrVertexAttribType); + this->addInstanceAttrib("atlas_offset", kShort2_GrVertexAttribType); this->addInstanceAttrib("color", kUByte4_norm_GrVertexAttribType); SkASSERT(offsetof(Instance, fDevBounds) == diff --git a/src/gpu/ccpr/GrCCPRPathProcessor.h b/src/gpu/ccpr/GrCCPRPathProcessor.h index dbc1e5847e..82711756ee 100644 --- a/src/gpu/ccpr/GrCCPRPathProcessor.h +++ b/src/gpu/ccpr/GrCCPRPathProcessor.h @@ -46,13 +46,13 @@ public: // | 1 1 | std::array<float, 4> fViewMatrix; // {kScaleX, kSkewy, kSkewX, kScaleY} std::array<float, 2> fViewTranslate; - std::array<int32_t, 2> fAtlasOffset; + std::array<int16_t, 2> fAtlasOffset; uint32_t fColor; GR_STATIC_ASSERT(SK_SCALAR_IS_FLOAT); }; - GR_STATIC_ASSERT(4 * 17 == sizeof(Instance)); // FIXME: 4 * 16 by making fAtlasOffset int16_t's. + GR_STATIC_ASSERT(4 * 16 == sizeof(Instance)); GrCCPRPathProcessor(GrResourceProvider*, sk_sp<GrTextureProxy> atlas, SkPath::FillType, const GrShaderCaps&); diff --git a/src/gpu/gl/GrGLVertexArray.cpp b/src/gpu/gl/GrGLVertexArray.cpp index a903e7d2f1..fa318c58bf 100644 --- a/src/gpu/gl/GrGLVertexArray.cpp +++ b/src/gpu/gl/GrGLVertexArray.cpp @@ -45,10 +45,12 @@ static AttribLayout attrib_layout(GrVertexAttribType type) { return {true, 1, GR_GL_UNSIGNED_BYTE}; case kUByte4_norm_GrVertexAttribType: return {true, 4, GR_GL_UNSIGNED_BYTE}; - case kUShort2_norm_GrVertexAttribType: - return {true, 2, GR_GL_UNSIGNED_SHORT}; + case kShort2_GrVertexAttribType: + return {false, 2, GR_GL_SHORT}; case kUShort2_GrVertexAttribType: return {false, 2, GR_GL_UNSIGNED_SHORT}; + case kUShort2_norm_GrVertexAttribType: + return {true, 2, GR_GL_UNSIGNED_SHORT}; case kInt_GrVertexAttribType: return {false, 1, GR_GL_INT}; case kUint_GrVertexAttribType: @@ -87,10 +89,12 @@ static bool GrVertexAttribTypeIsIntType(const GrShaderCaps* shaderCaps, return false; case kUByte4_norm_GrVertexAttribType: return false; + case kShort2_GrVertexAttribType: + return true; + case kUShort2_GrVertexAttribType: + return shaderCaps->integerSupport(); // FIXME: caller should handle this. case kUShort2_norm_GrVertexAttribType: return false; - case kUShort2_GrVertexAttribType: - return shaderCaps->integerSupport(); case kInt_GrVertexAttribType: return true; case kUint_GrVertexAttribType: diff --git a/src/gpu/vk/GrVkPipeline.cpp b/src/gpu/vk/GrVkPipeline.cpp index ba64532c4e..a247078f72 100644 --- a/src/gpu/vk/GrVkPipeline.cpp +++ b/src/gpu/vk/GrVkPipeline.cpp @@ -38,10 +38,12 @@ static inline VkFormat attrib_type_to_vkformat(GrVertexAttribType type) { return VK_FORMAT_R8_UNORM; case kUByte4_norm_GrVertexAttribType: return VK_FORMAT_R8G8B8A8_UNORM; - case kUShort2_norm_GrVertexAttribType: - return VK_FORMAT_R16G16_UNORM; + case kShort2_GrVertexAttribType: + return VK_FORMAT_R16G16_SINT; case kUShort2_GrVertexAttribType: return VK_FORMAT_R16G16_UINT; + case kUShort2_norm_GrVertexAttribType: + return VK_FORMAT_R16G16_UNORM; case kInt_GrVertexAttribType: return VK_FORMAT_R32_SINT; case kUint_GrVertexAttribType: |