Skip to content

Commit

Permalink
gapis/api/gles: Fix panic when calling DataTypeSize(GL_INT)
Browse files Browse the repository at this point in the history
Rename the file, and refactor another place we were calculating type size.
  • Loading branch information
ben-clayton committed Mar 9, 2018
1 parent a729b0c commit 4a19f18
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gapis/api/gles/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ go_library(
"compat_client.go",
"context.go",
"custom_replay.go",
"datatypes.go",
"dependency_graph_behaviour_provider.go",
"doc.go",
"draw_call.go",
Expand Down Expand Up @@ -77,7 +78,6 @@ go_library(
"tweaker.go",
"undefined_framebuffer.go",
"version.go",
"vertex_attribute_array.go",
"wireframe.go",
],
embed = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func DataTypeSize(t GLenum) int {
return 2
case GLenum_GL_FIXED,
GLenum_GL_FLOAT,
GLenum_GL_INT,
GLenum_GL_UNSIGNED_INT,
GLenum_GL_UNSIGNED_INT_2_10_10_10_REV:
return 4
Expand Down
6 changes: 1 addition & 5 deletions gapis/api/gles/draw_call.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,7 @@ func getIndices(
first, count GLsizei,
ptr IndicesPointer) (drawCallIndices, error) {

indexSize := map[GLenum]uint64{
GLenum_GL_UNSIGNED_BYTE: 1,
GLenum_GL_UNSIGNED_SHORT: 2,
GLenum_GL_UNSIGNED_INT: 4,
}[ty]
indexSize := uint64(DataTypeSize(ty))
indexBuffer := c.Bound.VertexArray.ElementArrayBuffer
size := uint64(count) * indexSize
offset := uint64(first) * indexSize
Expand Down

0 comments on commit 4a19f18

Please sign in to comment.