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
c1f8b16b
Commit
c1f8b16b
authored
Oct 07, 2013
by
Jamie Madill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move validation of API errors out of Texture*::generateMipmaps() to the API.
TRAC #23959 Signed-off-by: Geoff Lang Signed-off-by: Shannon Woods
parent
35d1501b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
26 deletions
+28
-26
Texture.cpp
src/libGLESv2/Texture.cpp
+10
-25
Texture.h
src/libGLESv2/Texture.h
+1
-1
libGLESv2.cpp
src/libGLESv2/libGLESv2.cpp
+17
-0
No files found.
src/libGLESv2/Texture.cpp
View file @
c1f8b16b
...
...
@@ -843,14 +843,6 @@ void Texture2D::convertToRenderTarget()
void
Texture2D
::
generateMipmaps
()
{
if
(
!
mRenderer
->
getNonPower2TextureSupport
())
{
if
(
!
isPow2
(
getBaseLevelWidth
())
||
!
isPow2
(
getBaseLevelHeight
()))
{
return
gl
::
error
(
GL_INVALID_OPERATION
);
}
}
// Purge array levels 1 through q and reset them to represent the generated mipmap levels.
unsigned
int
q
=
log2
(
std
::
max
(
getBaseLevelWidth
(),
getBaseLevelHeight
()));
for
(
unsigned
int
i
=
1
;
i
<=
q
;
i
++
)
...
...
@@ -1132,16 +1124,22 @@ bool TextureCubeMap::isSamplerComplete(const SamplerState &samplerState) const
// Tests for cube texture completeness. [OpenGL ES 2.0.24] section 3.7.10 page 81.
bool
TextureCubeMap
::
isCubeComplete
()
const
{
if
(
getBaseLevelWidth
()
<=
0
||
getBaseLevelHeight
()
!=
getBaseLevelWidth
())
int
baseWidth
=
getBaseLevelWidth
();
int
baseHeight
=
getBaseLevelHeight
();
GLenum
baseFormat
=
getBaseLevelInternalFormat
();
if
(
baseWidth
<=
0
||
baseWidth
!=
baseHeight
)
{
return
false
;
}
for
(
unsigned
int
face
=
1
;
face
<
6
;
face
++
)
{
if
(
mImageArray
[
face
][
0
]
->
getWidth
()
!=
getBaseLevelWidth
()
||
mImageArray
[
face
][
0
]
->
getWidth
()
!=
getBaseLevelHeight
()
||
mImageArray
[
face
][
0
]
->
getInternalFormat
()
!=
getBaseLevelInternalFormat
())
const
rx
::
Image
&
faceBaseImage
=
*
mImageArray
[
face
][
0
];
if
(
faceBaseImage
.
getWidth
()
!=
baseWidth
||
faceBaseImage
.
getHeight
()
!=
baseHeight
||
faceBaseImage
.
getInternalFormat
()
!=
baseFormat
)
{
return
false
;
}
...
...
@@ -1489,19 +1487,6 @@ void TextureCubeMap::storage(GLsizei levels, GLenum internalformat, GLsizei size
void
TextureCubeMap
::
generateMipmaps
()
{
if
(
!
isCubeComplete
())
{
return
gl
::
error
(
GL_INVALID_OPERATION
);
}
if
(
!
mRenderer
->
getNonPower2TextureSupport
())
{
if
(
!
isPow2
(
getBaseLevelWidth
()))
{
return
gl
::
error
(
GL_INVALID_OPERATION
);
}
}
// Purge array levels 1 through q and reset them to represent the generated mipmap levels.
unsigned
int
q
=
log2
(
getBaseLevelWidth
());
for
(
unsigned
int
f
=
0
;
f
<
6
;
f
++
)
...
...
src/libGLESv2/Texture.h
View file @
c1f8b16b
...
...
@@ -243,6 +243,7 @@ class TextureCubeMap : public Texture
void
storage
(
GLsizei
levels
,
GLenum
internalformat
,
GLsizei
size
);
virtual
bool
isSamplerComplete
(
const
SamplerState
&
samplerState
)
const
;
bool
isCubeComplete
()
const
;
virtual
void
generateMipmaps
();
...
...
@@ -266,7 +267,6 @@ class TextureCubeMap : public Texture
virtual
rx
::
TextureStorageInterface
*
getStorage
(
bool
renderTarget
);
virtual
const
rx
::
Image
*
getBaseLevelImage
()
const
;
bool
isCubeComplete
()
const
;
bool
isMipmapCubeComplete
()
const
;
bool
isFaceLevelComplete
(
int
face
,
int
level
)
const
;
void
updateTextureFaceLevel
(
int
face
,
int
level
);
...
...
src/libGLESv2/libGLESv2.cpp
View file @
c1f8b16b
...
...
@@ -2223,6 +2223,23 @@ void __stdcall glGenerateMipmap(GLenum target)
return
gl
::
error
(
GL_INVALID_OPERATION
);
}
// Non-power of 2 ES2 check
if
(
!
context
->
supportsNonPower2Texture
()
&&
(
!
gl
::
isPow2
(
texture
->
getBaseLevelWidth
())
||
!
gl
::
isPow2
(
texture
->
getBaseLevelHeight
())))
{
ASSERT
(
context
->
getClientVersion
()
<=
2
&&
(
target
==
GL_TEXTURE_2D
||
target
==
GL_TEXTURE_CUBE_MAP
));
return
gl
::
error
(
GL_INVALID_OPERATION
);
}
// Cube completeness check
if
(
target
==
GL_TEXTURE_CUBE_MAP
)
{
gl
::
TextureCubeMap
*
textureCube
=
static_cast
<
gl
::
TextureCubeMap
*>
(
texture
);
if
(
!
textureCube
->
isCubeComplete
())
{
return
gl
::
error
(
GL_INVALID_OPERATION
);
}
}
texture
->
generateMipmaps
();
}
}
...
...
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