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
ae4852a2
Commit
ae4852a2
authored
Jun 05, 2013
by
Geoff Lang
Committed by
Shannon Woods
Jul 19, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored glGenerateMipmap and added ES3 validation.
TRAC #23277 Signed-off-by: Jamie Madill Signed-off-by: Shannon Woods Author: Geoff Lang
parent
d42cf4ed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
22 deletions
+41
-22
libGLESv2.cpp
src/libGLESv2/libGLESv2.cpp
+41
-22
No files found.
src/libGLESv2/libGLESv2.cpp
View file @
ae4852a2
...
@@ -3880,35 +3880,36 @@ void __stdcall glGenerateMipmap(GLenum target)
...
@@ -3880,35 +3880,36 @@ void __stdcall glGenerateMipmap(GLenum target)
if
(
context
)
if
(
context
)
{
{
gl
::
Texture
*
texture
=
NULL
;
GLint
internalFormat
=
GL_NONE
;
bool
isCompressed
=
false
;
bool
isDepth
=
false
;
switch
(
target
)
switch
(
target
)
{
{
case
GL_TEXTURE_2D
:
case
GL_TEXTURE_2D
:
{
{
gl
::
Texture2D
*
tex2d
=
context
->
getTexture2D
();
gl
::
Texture2D
*
tex2d
=
context
->
getTexture2D
();
if
(
tex2d
)
if
(
tex2d
->
isCompressed
(
0
))
{
return
gl
::
error
(
GL_INVALID_OPERATION
);
}
if
(
tex2d
->
isDepth
(
0
))
{
{
return
gl
::
error
(
GL_INVALID_OPERATION
);
internalFormat
=
tex2d
->
getInternalFormat
(
0
);
isCompressed
=
tex2d
->
isCompressed
(
0
);
isDepth
=
tex2d
->
isDepth
(
0
);
texture
=
tex2d
;
}
}
tex2d
->
generateMipmaps
();
break
;
break
;
}
}
case
GL_TEXTURE_CUBE_MAP
:
case
GL_TEXTURE_CUBE_MAP
:
{
{
gl
::
TextureCubeMap
*
texcube
=
context
->
getTextureCubeMap
();
gl
::
TextureCubeMap
*
texcube
=
context
->
getTextureCubeMap
();
if
(
texcube
)
if
(
texcube
->
isCompressed
(
GL_TEXTURE_CUBE_MAP_POSITIVE_X
,
0
))
{
{
return
gl
::
error
(
GL_INVALID_OPERATION
);
internalFormat
=
texcube
->
getInternalFormat
(
GL_TEXTURE_CUBE_MAP_POSITIVE_X
,
0
);
isCompressed
=
texcube
->
isCompressed
(
GL_TEXTURE_CUBE_MAP_POSITIVE_X
,
0
);
isDepth
=
false
;
texture
=
texcube
;
}
}
texcube
->
generateMipmaps
();
break
;
break
;
}
}
...
@@ -3920,12 +3921,13 @@ void __stdcall glGenerateMipmap(GLenum target)
...
@@ -3920,12 +3921,13 @@ void __stdcall glGenerateMipmap(GLenum target)
}
}
gl
::
Texture3D
*
tex3D
=
context
->
getTexture3D
();
gl
::
Texture3D
*
tex3D
=
context
->
getTexture3D
();
if
(
tex3D
->
isCompressed
(
0
)
)
if
(
tex3D
)
{
{
return
gl
::
error
(
GL_INVALID_OPERATION
);
internalFormat
=
tex3D
->
getInternalFormat
(
0
);
isCompressed
=
tex3D
->
isCompressed
(
0
);
isDepth
=
tex3D
->
isDepth
(
0
);
texture
=
tex3D
;
}
}
tex3D
->
generateMipmaps
();
break
;
break
;
}
}
...
@@ -3937,18 +3939,35 @@ void __stdcall glGenerateMipmap(GLenum target)
...
@@ -3937,18 +3939,35 @@ void __stdcall glGenerateMipmap(GLenum target)
}
}
gl
::
Texture2DArray
*
tex2darr
=
context
->
getTexture2DArray
();
gl
::
Texture2DArray
*
tex2darr
=
context
->
getTexture2DArray
();
if
(
tex2darr
->
isCompressed
(
0
)
)
if
(
tex2darr
)
{
{
return
gl
::
error
(
GL_INVALID_OPERATION
);
internalFormat
=
tex2darr
->
getInternalFormat
(
0
);
isCompressed
=
tex2darr
->
isCompressed
(
0
);
isDepth
=
tex2darr
->
isDepth
(
0
);
texture
=
tex2darr
;
}
}
tex2darr
->
generateMipmaps
();
break
;
break
;
}
}
default
:
default
:
return
gl
::
error
(
GL_INVALID_ENUM
);
return
gl
::
error
(
GL_INVALID_ENUM
);
}
}
if
(
!
texture
)
{
return
gl
::
error
(
GL_INVALID_OPERATION
);
}
// Internally, all texture formats are sized so checking if the format
// is color renderable and filterable will not fail.
if
(
isDepth
||
isCompressed
||
!
gl
::
IsColorRenderingSupported
(
internalFormat
,
context
)
||
!
gl
::
IsTextureFilteringSupported
(
internalFormat
,
context
))
{
return
gl
::
error
(
GL_INVALID_OPERATION
);
}
texture
->
generateMipmaps
();
}
}
}
}
catch
(
std
::
bad_alloc
&
)
catch
(
std
::
bad_alloc
&
)
...
...
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