aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLVertexArray.cpp
diff options
context:
space:
mode:
authorGravatar dcheng <dcheng@chromium.org>2016-02-06 15:08:54 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-06 15:08:55 -0800
commitc4d196c9c87f226eb33b8091dc50053c45c4e752 (patch)
treed4850f4715af4c3d5364e311f95fe6524d9a682b /src/gpu/gl/GrGLVertexArray.cpp
parent964eec67760196585954203ba625e440607f7e92 (diff)
Revert of Improve GLSL integer support (patchset #1 id:1 of https://codereview.chromium.org/1669853002/ )
Reason for revert: MSAN bots are unhappy with this change: https://build.chromium.org/p/chromium.memory.fyi/builders/Linux%20ChromeOS%20MSan%20Tests/builds/7068 Original issue's description: > Improve GLSL integer support > > - Adds shader types for uint. > - Adds a cap for integer support. > - Uses glVertexAttribIPointer for integer attribs. > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1669853002 > > Committed: https://skia.googlesource.com/skia/+/3a2caf8ecf38124f4ad21a0f6c4dabfcfa17911a TBR=bsalomon@google.com,egdaniel@google.com,ethannicholas@google.com,cdalton@nvidia.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1674813004
Diffstat (limited to 'src/gpu/gl/GrGLVertexArray.cpp')
-rw-r--r--src/gpu/gl/GrGLVertexArray.cpp60
1 files changed, 14 insertions, 46 deletions
diff --git a/src/gpu/gl/GrGLVertexArray.cpp b/src/gpu/gl/GrGLVertexArray.cpp
index fdb395d37a..8cfa8d6550 100644
--- a/src/gpu/gl/GrGLVertexArray.cpp
+++ b/src/gpu/gl/GrGLVertexArray.cpp
@@ -8,38 +8,14 @@
#include "GrGLVertexArray.h"
#include "GrGLGpu.h"
-struct AttribLayout {
- GrGLint fCount;
- GrGLenum fType;
- GrGLboolean fNormalized; // Only used by floating point types.
-};
-static const AttribLayout gLayouts[kGrVertexAttribTypeCount] = {
- {1, GR_GL_FLOAT, false}, // kFloat_GrVertexAttribType
- {2, GR_GL_FLOAT, false}, // kVec2f_GrVertexAttribType
- {3, GR_GL_FLOAT, false}, // kVec3f_GrVertexAttribType
- {4, GR_GL_FLOAT, false}, // kVec4f_GrVertexAttribType
- {1, GR_GL_UNSIGNED_BYTE, true}, // kUByte_GrVertexAttribType
- {4, GR_GL_UNSIGNED_BYTE, true}, // kVec4ub_GrVertexAttribType
- {2, GR_GL_SHORT, false}, // kVec2s_GrVertexAttribType
- {1, GR_GL_INT, false}, // kInt_GrVertexAttribType
- {1, GR_GL_UNSIGNED_INT, false}, // kUint_GrVertexAttribType
-};
-
-GR_STATIC_ASSERT(0 == kFloat_GrVertexAttribType);
-GR_STATIC_ASSERT(1 == kVec2f_GrVertexAttribType);
-GR_STATIC_ASSERT(2 == kVec3f_GrVertexAttribType);
-GR_STATIC_ASSERT(3 == kVec4f_GrVertexAttribType);
-GR_STATIC_ASSERT(4 == kUByte_GrVertexAttribType);
-GR_STATIC_ASSERT(5 == kVec4ub_GrVertexAttribType);
-GR_STATIC_ASSERT(6 == kVec2s_GrVertexAttribType);
-GR_STATIC_ASSERT(7 == kInt_GrVertexAttribType);
-GR_STATIC_ASSERT(8 == kUint_GrVertexAttribType);
void GrGLAttribArrayState::set(GrGLGpu* gpu,
int index,
GrGLuint vertexBufferID,
- GrVertexAttribType type,
+ GrGLint size,
+ GrGLenum type,
+ GrGLboolean normalized,
GrGLsizei stride,
GrGLvoid* offset) {
SkASSERT(index >= 0 && index < fAttribArrayStates.count());
@@ -51,31 +27,23 @@ void GrGLAttribArrayState::set(GrGLGpu* gpu,
}
if (!array->fAttribPointerIsValid ||
array->fVertexBufferID != vertexBufferID ||
- array->fType != type ||
+ array->fSize != size ||
+ array->fNormalized != normalized ||
array->fStride != stride ||
array->fOffset != offset) {
gpu->bindVertexBuffer(vertexBufferID);
- const AttribLayout& layout = gLayouts[type];
- if (!GrVertexAttribTypeIsIntType(type)) {
- GR_GL_CALL(gpu->glInterface(), VertexAttribPointer(index,
- layout.fCount,
- layout.fType,
- layout.fNormalized,
- stride,
- offset));
- } else {
- SkASSERT(gpu->caps()->shaderCaps()->integerSupport());
- SkASSERT(!layout.fNormalized);
- GR_GL_CALL(gpu->glInterface(), VertexAttribIPointer(index,
- layout.fCount,
- layout.fType,
- stride,
- offset));
- }
+ GR_GL_CALL(gpu->glInterface(), VertexAttribPointer(index,
+ size,
+ type,
+ normalized,
+ stride,
+ offset));
array->fAttribPointerIsValid = true;
array->fVertexBufferID = vertexBufferID;
- array->fType = type;
+ array->fSize = size;
+ array->fNormalized = normalized;
+ array->fStride = stride;
array->fOffset = offset;
}
}