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
aff71508
Commit
aff71508
authored
Jul 02, 2013
by
Jamie Madill
Committed by
Shannon Woods
Jul 19, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor the validation for GetAttrib functions to a single shared method.
TRAC #23391 Signed-off-by: Shannon Woods Signed-off-by: Geoff Lang Authored-by: Jamie Madill
parent
efb3bd1a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
66 deletions
+76
-66
VertexAttribute.h
src/libGLESv2/VertexAttribute.h
+25
-0
libGLESv2.cpp
src/libGLESv2/libGLESv2.cpp
+51
-66
No files found.
src/libGLESv2/VertexAttribute.h
View file @
aff71508
...
@@ -58,6 +58,31 @@ class VertexAttribute
...
@@ -58,6 +58,31 @@ class VertexAttribute
mPointer
=
pointer
;
mPointer
=
pointer
;
}
}
template
<
typename
T
>
T
querySingleParameter
(
GLenum
pname
)
const
{
switch
(
pname
)
{
case
GL_VERTEX_ATTRIB_ARRAY_ENABLED
:
return
static_cast
<
T
>
(
mArrayEnabled
?
GL_TRUE
:
GL_FALSE
);
case
GL_VERTEX_ATTRIB_ARRAY_SIZE
:
return
static_cast
<
T
>
(
mSize
);
case
GL_VERTEX_ATTRIB_ARRAY_STRIDE
:
return
static_cast
<
T
>
(
mStride
);
case
GL_VERTEX_ATTRIB_ARRAY_TYPE
:
return
static_cast
<
T
>
(
mType
);
case
GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
:
return
static_cast
<
T
>
(
mNormalized
?
GL_TRUE
:
GL_FALSE
);
case
GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING
:
return
static_cast
<
T
>
(
mBoundBuffer
.
id
());
case
GL_VERTEX_ATTRIB_ARRAY_DIVISOR
:
return
static_cast
<
T
>
(
mDivisor
);
default
:
UNREACHABLE
();
return
static_cast
<
T
>
(
0
);
}
}
// From glVertexAttribPointer
// From glVertexAttribPointer
GLenum
mType
;
GLenum
mType
;
GLint
mSize
;
GLint
mSize
;
...
...
src/libGLESv2/libGLESv2.cpp
View file @
aff71508
...
@@ -1923,6 +1923,30 @@ bool validateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint
...
@@ -1923,6 +1923,30 @@ bool validateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint
return
true
;
return
true
;
}
}
bool
validateGetVertexAttribParameters
(
GLenum
pname
,
int
clientVersion
)
{
switch
(
pname
)
{
case
GL_VERTEX_ATTRIB_ARRAY_ENABLED
:
case
GL_VERTEX_ATTRIB_ARRAY_SIZE
:
case
GL_VERTEX_ATTRIB_ARRAY_STRIDE
:
case
GL_VERTEX_ATTRIB_ARRAY_TYPE
:
case
GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
:
case
GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING
:
case
GL_CURRENT_VERTEX_ATTRIB
:
return
true
;
case
GL_VERTEX_ATTRIB_ARRAY_DIVISOR
:
// Don't verify ES3 context because GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE uses
// the same constant.
META_ASSERT
(
GL_VERTEX_ATTRIB_ARRAY_DIVISOR
==
GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE
);
return
true
;
default:
return
gl
::
error
(
GL_INVALID_ENUM
,
false
);
}
}
extern
"C"
extern
"C"
{
{
...
@@ -5858,41 +5882,22 @@ void __stdcall glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
...
@@ -5858,41 +5882,22 @@ void __stdcall glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
const
gl
::
VertexAttribute
&
attribState
=
context
->
getVertexAttribState
(
index
);
const
gl
::
VertexAttribute
&
attribState
=
context
->
getVertexAttribState
(
index
);
switch
(
pname
)
if
(
!
validateGetVertexAttribParameters
(
pname
,
context
->
getClientVersion
())
)
{
{
case
GL_VERTEX_ATTRIB_ARRAY_ENABLED
:
return
;
*
params
=
(
GLfloat
)(
attribState
.
mArrayEnabled
?
GL_TRUE
:
GL_FALSE
);
}
break
;
case
GL_VERTEX_ATTRIB_ARRAY_SIZE
:
if
(
pname
==
GL_CURRENT_VERTEX_ATTRIB
)
*
params
=
(
GLfloat
)
attribState
.
mSize
;
{
break
;
const
gl
::
VertexAttribCurrentValueData
&
currentValueData
=
context
->
getVertexAttribCurrentValue
(
index
);
case
GL_VERTEX_ATTRIB_ARRAY_STRIDE
:
for
(
int
i
=
0
;
i
<
4
;
++
i
)
*
params
=
(
GLfloat
)
attribState
.
mStride
;
break
;
case
GL_VERTEX_ATTRIB_ARRAY_TYPE
:
*
params
=
(
GLfloat
)
attribState
.
mType
;
break
;
case
GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
:
*
params
=
(
GLfloat
)(
attribState
.
mNormalized
?
GL_TRUE
:
GL_FALSE
);
break
;
case
GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING
:
*
params
=
(
GLfloat
)
attribState
.
mBoundBuffer
.
id
();
break
;
case
GL_CURRENT_VERTEX_ATTRIB
:
{
{
const
gl
::
VertexAttribCurrentValueData
&
currentValueData
=
context
->
getVertexAttribCurrentValue
(
index
);
params
[
i
]
=
currentValueData
.
FloatValues
[
i
];
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
params
[
i
]
=
currentValueData
.
FloatValues
[
i
];
}
}
}
break
;
}
case
GL_VERTEX_ATTRIB_ARRAY_DIVISOR
:
else
// Don't verify ES3 context because GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE uses
{
// the same constant.
*
params
=
attribState
.
querySingleParameter
<
GLfloat
>
(
pname
);
*
params
=
(
GLfloat
)
attribState
.
mDivisor
;
break
;
default
:
return
gl
::
error
(
GL_INVALID_ENUM
);
}
}
}
}
}
}
...
@@ -5919,43 +5924,23 @@ void __stdcall glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
...
@@ -5919,43 +5924,23 @@ void __stdcall glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
const
gl
::
VertexAttribute
&
attribState
=
context
->
getVertexAttribState
(
index
);
const
gl
::
VertexAttribute
&
attribState
=
context
->
getVertexAttribState
(
index
);
switch
(
pname
)
if
(
!
validateGetVertexAttribParameters
(
pname
,
context
->
getClientVersion
())
)
{
{
case
GL_VERTEX_ATTRIB_ARRAY_ENABLED
:
return
;
*
params
=
(
attribState
.
mArrayEnabled
?
GL_TRUE
:
GL_FALSE
);
}
break
;
case
GL_VERTEX_ATTRIB_ARRAY_SIZE
:
if
(
pname
==
GL_CURRENT_VERTEX_ATTRIB
)
*
params
=
attribState
.
mSize
;
{
break
;
const
gl
::
VertexAttribCurrentValueData
&
currentValueData
=
context
->
getVertexAttribCurrentValue
(
index
);
case
GL_VERTEX_ATTRIB_ARRAY_STRIDE
:
for
(
int
i
=
0
;
i
<
4
;
++
i
)
*
params
=
attribState
.
mStride
;
break
;
case
GL_VERTEX_ATTRIB_ARRAY_TYPE
:
*
params
=
attribState
.
mType
;
break
;
case
GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
:
*
params
=
(
attribState
.
mNormalized
?
GL_TRUE
:
GL_FALSE
);
break
;
case
GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING
:
*
params
=
attribState
.
mBoundBuffer
.
id
();
break
;
case
GL_CURRENT_VERTEX_ATTRIB
:
{
{
const
gl
::
VertexAttribCurrentValueData
&
currentValueData
=
context
->
getVertexAttribCurrentValue
(
index
);
float
currentValue
=
currentValueData
.
FloatValues
[
i
];
for
(
int
i
=
0
;
i
<
4
;
++
i
)
params
[
i
]
=
(
GLint
)(
currentValue
>
0.0
f
?
floor
(
currentValue
+
0.5
f
)
:
ceil
(
currentValue
-
0.5
f
));
{
float
currentValue
=
currentValueData
.
FloatValues
[
i
];
params
[
i
]
=
(
GLint
)(
currentValue
>
0.0
f
?
floor
(
currentValue
+
0.5
f
)
:
ceil
(
currentValue
-
0.5
f
));
}
}
}
break
;
}
case
GL_VERTEX_ATTRIB_ARRAY_DIVISOR
:
else
// Don't verify ES3 context because GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE uses
{
// the same constant.
*
params
=
attribState
.
querySingleParameter
<
GLint
>
(
pname
);
META_ASSERT
(
GL_VERTEX_ATTRIB_ARRAY_DIVISOR
==
GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE
);
*
params
=
(
GLint
)
attribState
.
mDivisor
;
break
;
default
:
return
gl
::
error
(
GL_INVALID_ENUM
);
}
}
}
}
}
}
...
...
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