Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
angle
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
angle
Commits
f1e1c1e4
Commit
f1e1c1e4
authored
Jul 31, 2013
by
Geoff Lang
Committed by
Geoff Lang
Aug 01, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix additional overflow and underflow issues with triangle fans and line loops.
Issue #444 Signed-off-by: Shannon Woods Signed-off-by: Chris Evans Author: Geoff Lang
parent
688f78a6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
16 deletions
+30
-16
version.h
src/common/version.h
+1
-1
Renderer11.cpp
src/libGLESv2/renderer/Renderer11.cpp
+19
-11
Renderer9.cpp
src/libGLESv2/renderer/Renderer9.cpp
+10
-4
No files found.
src/common/version.h
View file @
f1e1c1e4
#define MAJOR_VERSION 1
#define MAJOR_VERSION 1
#define MINOR_VERSION 2
#define MINOR_VERSION 2
#define BUILD_VERSION 0
#define BUILD_VERSION 0
#define BUILD_REVISION 24
29
#define BUILD_REVISION 24
30
#define STRINGIFY(x) #x
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
#define MACRO_STRINGIFY(x) STRINGIFY(x)
...
...
src/libGLESv2/renderer/Renderer11.cpp
View file @
f1e1c1e4
...
@@ -835,16 +835,18 @@ bool Renderer11::applyPrimitiveType(GLenum mode, GLsizei count)
...
@@ -835,16 +835,18 @@ bool Renderer11::applyPrimitiveType(GLenum mode, GLsizei count)
{
{
D3D11_PRIMITIVE_TOPOLOGY
primitiveTopology
=
D3D_PRIMITIVE_TOPOLOGY_UNDEFINED
;
D3D11_PRIMITIVE_TOPOLOGY
primitiveTopology
=
D3D_PRIMITIVE_TOPOLOGY_UNDEFINED
;
GLsizei
minCount
=
0
;
switch
(
mode
)
switch
(
mode
)
{
{
case
GL_POINTS
:
primitiveTopology
=
D3D11_PRIMITIVE_TOPOLOGY_POINTLIST
;
break
;
case
GL_POINTS
:
primitiveTopology
=
D3D11_PRIMITIVE_TOPOLOGY_POINTLIST
;
minCount
=
1
;
break
;
case
GL_LINES
:
primitiveTopology
=
D3D_PRIMITIVE_TOPOLOGY_LINELIST
;
break
;
case
GL_LINES
:
primitiveTopology
=
D3D_PRIMITIVE_TOPOLOGY_LINELIST
;
minCount
=
2
;
break
;
case
GL_LINE_LOOP
:
primitiveTopology
=
D3D_PRIMITIVE_TOPOLOGY_LINESTRIP
;
break
;
case
GL_LINE_LOOP
:
primitiveTopology
=
D3D_PRIMITIVE_TOPOLOGY_LINESTRIP
;
minCount
=
2
;
break
;
case
GL_LINE_STRIP
:
primitiveTopology
=
D3D_PRIMITIVE_TOPOLOGY_LINESTRIP
;
break
;
case
GL_LINE_STRIP
:
primitiveTopology
=
D3D_PRIMITIVE_TOPOLOGY_LINESTRIP
;
minCount
=
2
;
break
;
case
GL_TRIANGLES
:
primitiveTopology
=
D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST
;
break
;
case
GL_TRIANGLES
:
primitiveTopology
=
D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST
;
minCount
=
3
;
break
;
case
GL_TRIANGLE_STRIP
:
primitiveTopology
=
D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP
;
break
;
case
GL_TRIANGLE_STRIP
:
primitiveTopology
=
D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP
;
minCount
=
3
;
break
;
// emulate fans via rewriting index buffer
// emulate fans via rewriting index buffer
case
GL_TRIANGLE_FAN
:
primitiveTopology
=
D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST
;
break
;
case
GL_TRIANGLE_FAN
:
primitiveTopology
=
D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST
;
minCount
=
3
;
break
;
default
:
default
:
return
gl
::
error
(
GL_INVALID_ENUM
,
false
);
return
gl
::
error
(
GL_INVALID_ENUM
,
false
);
}
}
...
@@ -855,7 +857,7 @@ bool Renderer11::applyPrimitiveType(GLenum mode, GLsizei count)
...
@@ -855,7 +857,7 @@ bool Renderer11::applyPrimitiveType(GLenum mode, GLsizei count)
mCurrentPrimitiveTopology
=
primitiveTopology
;
mCurrentPrimitiveTopology
=
primitiveTopology
;
}
}
return
count
>
0
;
return
count
>
=
minCount
;
}
}
bool
Renderer11
::
applyRenderTarget
(
gl
::
Framebuffer
*
framebuffer
)
bool
Renderer11
::
applyRenderTarget
(
gl
::
Framebuffer
*
framebuffer
)
...
@@ -1131,13 +1133,16 @@ void Renderer11::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices,
...
@@ -1131,13 +1133,16 @@ void Renderer11::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices,
}
}
}
}
if
(
static_cast
<
unsigned
int
>
(
count
+
1
)
>
(
std
::
numeric_limits
<
unsigned
int
>::
max
()
/
sizeof
(
unsigned
int
)))
// Checked by Renderer11::applyPrimitiveType
ASSERT
(
count
>=
0
);
if
(
static_cast
<
unsigned
int
>
(
count
)
+
1
>
(
std
::
numeric_limits
<
unsigned
int
>::
max
()
/
sizeof
(
unsigned
int
)))
{
{
ERR
(
"Could not create a 32-bit looping index buffer for GL_LINE_LOOP, too many indices required."
);
ERR
(
"Could not create a 32-bit looping index buffer for GL_LINE_LOOP, too many indices required."
);
return
gl
::
error
(
GL_OUT_OF_MEMORY
);
return
gl
::
error
(
GL_OUT_OF_MEMORY
);
}
}
const
unsigned
int
spaceNeeded
=
(
count
+
1
)
*
sizeof
(
unsigned
int
);
const
unsigned
int
spaceNeeded
=
(
static_cast
<
unsigned
int
>
(
count
)
+
1
)
*
sizeof
(
unsigned
int
);
if
(
!
mLineLoopIB
->
reserveBufferSpace
(
spaceNeeded
,
GL_UNSIGNED_INT
))
if
(
!
mLineLoopIB
->
reserveBufferSpace
(
spaceNeeded
,
GL_UNSIGNED_INT
))
{
{
ERR
(
"Could not reserve enough space in looping index buffer for GL_LINE_LOOP."
);
ERR
(
"Could not reserve enough space in looping index buffer for GL_LINE_LOOP."
);
...
@@ -1231,9 +1236,12 @@ void Renderer11::drawTriangleFan(GLsizei count, GLenum type, const GLvoid *indic
...
@@ -1231,9 +1236,12 @@ void Renderer11::drawTriangleFan(GLsizei count, GLenum type, const GLvoid *indic
}
}
}
}
// Checked by Renderer11::applyPrimitiveType
ASSERT
(
count
>=
3
);
const
unsigned
int
numTris
=
count
-
2
;
const
unsigned
int
numTris
=
count
-
2
;
if
(
numTris
*
3
>
(
std
::
numeric_limits
<
unsigned
int
>::
max
()
/
sizeof
(
unsigned
int
)))
if
(
numTris
>
(
std
::
numeric_limits
<
unsigned
int
>::
max
()
/
(
sizeof
(
unsigned
int
)
*
3
)))
{
{
ERR
(
"Could not create a scratch index buffer for GL_TRIANGLE_FAN, too many indices required."
);
ERR
(
"Could not create a scratch index buffer for GL_TRIANGLE_FAN, too many indices required."
);
return
gl
::
error
(
GL_OUT_OF_MEMORY
);
return
gl
::
error
(
GL_OUT_OF_MEMORY
);
...
...
src/libGLESv2/renderer/Renderer9.cpp
View file @
f1e1c1e4
...
@@ -1471,13 +1471,16 @@ void Renderer9::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices,
...
@@ -1471,13 +1471,16 @@ void Renderer9::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices,
}
}
}
}
if
(
static_cast
<
unsigned
int
>
(
count
+
1
)
>
(
std
::
numeric_limits
<
unsigned
int
>::
max
()
/
sizeof
(
unsigned
int
)))
if
(
static_cast
<
unsigned
int
>
(
count
)
+
1
>
(
std
::
numeric_limits
<
unsigned
int
>::
max
()
/
sizeof
(
unsigned
int
)))
{
{
ERR
(
"Could not create a 32-bit looping index buffer for GL_LINE_LOOP, too many indices required."
);
ERR
(
"Could not create a 32-bit looping index buffer for GL_LINE_LOOP, too many indices required."
);
return
gl
::
error
(
GL_OUT_OF_MEMORY
);
return
gl
::
error
(
GL_OUT_OF_MEMORY
);
}
}
const
unsigned
int
spaceNeeded
=
(
count
+
1
)
*
sizeof
(
unsigned
int
);
// Checked by Renderer9::applyPrimitiveType
ASSERT
(
count
>=
0
);
const
unsigned
int
spaceNeeded
=
(
static_cast
<
unsigned
int
>
(
count
)
+
1
)
*
sizeof
(
unsigned
int
);
if
(
!
mLineLoopIB
->
reserveBufferSpace
(
spaceNeeded
,
GL_UNSIGNED_INT
))
if
(
!
mLineLoopIB
->
reserveBufferSpace
(
spaceNeeded
,
GL_UNSIGNED_INT
))
{
{
ERR
(
"Could not reserve enough space in looping index buffer for GL_LINE_LOOP."
);
ERR
(
"Could not reserve enough space in looping index buffer for GL_LINE_LOOP."
);
...
@@ -1549,13 +1552,16 @@ void Renderer9::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices,
...
@@ -1549,13 +1552,16 @@ void Renderer9::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices,
}
}
}
}
if
(
static_cast
<
unsigned
int
>
(
count
+
1
)
>
(
std
::
numeric_limits
<
unsigned
short
>::
max
()
/
sizeof
(
unsigned
short
)))
// Checked by Renderer9::applyPrimitiveType
ASSERT
(
count
>=
0
);
if
(
static_cast
<
unsigned
int
>
(
count
)
+
1
>
(
std
::
numeric_limits
<
unsigned
short
>::
max
()
/
sizeof
(
unsigned
short
)))
{
{
ERR
(
"Could not create a 16-bit looping index buffer for GL_LINE_LOOP, too many indices required."
);
ERR
(
"Could not create a 16-bit looping index buffer for GL_LINE_LOOP, too many indices required."
);
return
gl
::
error
(
GL_OUT_OF_MEMORY
);
return
gl
::
error
(
GL_OUT_OF_MEMORY
);
}
}
const
int
spaceNeeded
=
(
count
+
1
)
*
sizeof
(
unsigned
short
);
const
unsigned
int
spaceNeeded
=
(
static_cast
<
unsigned
int
>
(
count
)
+
1
)
*
sizeof
(
unsigned
short
);
if
(
!
mLineLoopIB
->
reserveBufferSpace
(
spaceNeeded
,
GL_UNSIGNED_SHORT
))
if
(
!
mLineLoopIB
->
reserveBufferSpace
(
spaceNeeded
,
GL_UNSIGNED_SHORT
))
{
{
ERR
(
"Could not reserve enough space in looping index buffer for GL_LINE_LOOP."
);
ERR
(
"Could not reserve enough space in looping index buffer for GL_LINE_LOOP."
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment