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
309c92aa
Commit
309c92aa
authored
Jul 25, 2013
by
Geoff Lang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Framebuffer now uses mip level and texture layer for binding textures.
TRAC #23470 Signed-off-by: Jamie Madill Signed-off-by: Shannon Woods Author: Geoff Lang
parent
4907f2c4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
119 additions
and
44 deletions
+119
-44
Framebuffer.cpp
src/libGLESv2/Framebuffer.cpp
+82
-31
Framebuffer.h
src/libGLESv2/Framebuffer.h
+5
-5
libGLESv2.cpp
src/libGLESv2/libGLESv2.cpp
+32
-8
No files found.
src/libGLESv2/Framebuffer.cpp
View file @
309c92aa
...
@@ -42,38 +42,88 @@ Framebuffer::~Framebuffer()
...
@@ -42,38 +42,88 @@ Framebuffer::~Framebuffer()
mStencilbuffer
.
set
(
NULL
,
GL_NONE
,
0
,
0
);
mStencilbuffer
.
set
(
NULL
,
GL_NONE
,
0
,
0
);
}
}
Renderbuffer
*
Framebuffer
::
lookupRenderbuffer
(
GLenum
type
,
GLuint
handle
)
const
Renderbuffer
*
Framebuffer
::
lookupRenderbuffer
(
GLenum
type
,
GLuint
handle
,
GLint
level
,
GLint
layer
)
const
{
{
gl
::
Context
*
context
=
gl
::
getContext
();
gl
::
Context
*
context
=
gl
::
getContext
();
Renderbuffer
*
buffer
=
NULL
;
if
(
type
==
GL_NONE
)
switch
(
type
)
{
buffer
=
NULL
;
}
else
if
(
type
==
GL_RENDERBUFFER
)
{
buffer
=
context
->
getRenderbuffer
(
handle
);
}
else
if
(
IsInternalTextureTarget
(
type
))
{
buffer
=
context
->
getTexture
(
handle
)
->
getRenderbuffer
(
type
);
}
else
{
{
case
GL_NONE
:
return
NULL
;
case
GL_RENDERBUFFER
:
return
context
->
getRenderbuffer
(
handle
);
case
GL_TEXTURE_2D
:
{
Texture
*
texture
=
context
->
getTexture
(
handle
);
if
(
texture
&&
texture
->
getTarget
()
==
GL_TEXTURE_2D
)
{
return
static_cast
<
Texture2D
*>
(
texture
)
->
getRenderbuffer
(
type
);
}
else
{
return
NULL
;
}
}
case
GL_TEXTURE_CUBE_MAP_POSITIVE_X
:
case
GL_TEXTURE_CUBE_MAP_NEGATIVE_X
:
case
GL_TEXTURE_CUBE_MAP_POSITIVE_Y
:
case
GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
:
case
GL_TEXTURE_CUBE_MAP_POSITIVE_Z
:
case
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
:
{
Texture
*
texture
=
context
->
getTexture
(
handle
);
if
(
texture
&&
texture
->
getTarget
()
==
GL_TEXTURE_CUBE_MAP
)
{
return
static_cast
<
TextureCubeMap
*>
(
texture
)
->
getRenderbuffer
(
type
);
}
else
{
return
NULL
;
}
}
case
GL_TEXTURE_3D
:
{
Texture
*
texture
=
context
->
getTexture
(
handle
);
if
(
texture
&&
texture
->
getTarget
()
==
GL_TEXTURE_3D
)
{
return
static_cast
<
Texture3D
*>
(
texture
)
->
getRenderbuffer
(
type
);
}
else
{
return
NULL
;
}
}
case
GL_TEXTURE_2D_ARRAY
:
{
Texture
*
texture
=
context
->
getTexture
(
handle
);
if
(
texture
&&
texture
->
getTarget
()
==
GL_TEXTURE_2D_ARRAY
)
{
return
static_cast
<
Texture2DArray
*>
(
texture
)
->
getRenderbuffer
(
type
);
}
else
{
return
NULL
;
}
}
default
:
UNREACHABLE
();
UNREACHABLE
();
return
NULL
;
}
}
return
buffer
;
}
}
void
Framebuffer
::
setColorbuffer
(
unsigned
int
colorAttachment
,
GLenum
type
,
GLuint
colorbuffer
)
void
Framebuffer
::
setColorbuffer
(
unsigned
int
colorAttachment
,
GLenum
type
,
GLuint
colorbuffer
,
GLint
level
,
GLint
layer
)
{
{
ASSERT
(
colorAttachment
<
IMPLEMENTATION_MAX_DRAW_BUFFERS
);
ASSERT
(
colorAttachment
<
IMPLEMENTATION_MAX_DRAW_BUFFERS
);
Renderbuffer
*
renderBuffer
=
lookupRenderbuffer
(
type
,
colorbuffer
);
Renderbuffer
*
renderBuffer
=
lookupRenderbuffer
(
type
,
colorbuffer
,
level
,
layer
);
if
(
renderBuffer
)
if
(
renderBuffer
)
{
{
mColorbuffers
[
colorAttachment
].
set
(
renderBuffer
,
type
,
0
,
0
);
mColorbuffers
[
colorAttachment
].
set
(
renderBuffer
,
type
,
level
,
layer
);
}
}
else
else
{
{
...
@@ -81,12 +131,12 @@ void Framebuffer::setColorbuffer(unsigned int colorAttachment, GLenum type, GLui
...
@@ -81,12 +131,12 @@ void Framebuffer::setColorbuffer(unsigned int colorAttachment, GLenum type, GLui
}
}
}
}
void
Framebuffer
::
setDepthbuffer
(
GLenum
type
,
GLuint
depthbuffer
)
void
Framebuffer
::
setDepthbuffer
(
GLenum
type
,
GLuint
depthbuffer
,
GLint
level
,
GLint
layer
)
{
{
Renderbuffer
*
renderBuffer
=
lookupRenderbuffer
(
type
,
depthbuffer
);
Renderbuffer
*
renderBuffer
=
lookupRenderbuffer
(
type
,
depthbuffer
,
level
,
layer
);
if
(
renderBuffer
)
if
(
renderBuffer
)
{
{
mDepthbuffer
.
set
(
renderBuffer
,
type
,
0
,
0
);
mDepthbuffer
.
set
(
renderBuffer
,
type
,
level
,
layer
);
}
}
else
else
{
{
...
@@ -94,12 +144,12 @@ void Framebuffer::setDepthbuffer(GLenum type, GLuint depthbuffer)
...
@@ -94,12 +144,12 @@ void Framebuffer::setDepthbuffer(GLenum type, GLuint depthbuffer)
}
}
}
}
void
Framebuffer
::
setStencilbuffer
(
GLenum
type
,
GLuint
stencilbuffer
)
void
Framebuffer
::
setStencilbuffer
(
GLenum
type
,
GLuint
stencilbuffer
,
GLint
level
,
GLint
layer
)
{
{
Renderbuffer
*
renderBuffer
=
lookupRenderbuffer
(
type
,
stencilbuffer
);
Renderbuffer
*
renderBuffer
=
lookupRenderbuffer
(
type
,
stencilbuffer
,
level
,
layer
);
if
(
renderBuffer
)
if
(
renderBuffer
)
{
{
mStencilbuffer
.
set
(
renderBuffer
,
type
,
0
,
0
);
mStencilbuffer
.
set
(
renderBuffer
,
type
,
level
,
layer
);
}
}
else
else
{
{
...
@@ -107,13 +157,13 @@ void Framebuffer::setStencilbuffer(GLenum type, GLuint stencilbuffer)
...
@@ -107,13 +157,13 @@ void Framebuffer::setStencilbuffer(GLenum type, GLuint stencilbuffer)
}
}
}
}
void
Framebuffer
::
setDepthStencilBuffer
(
GLenum
type
,
GLuint
depthStencilBuffer
)
void
Framebuffer
::
setDepthStencilBuffer
(
GLenum
type
,
GLuint
depthStencilBuffer
,
GLint
level
,
GLint
layer
)
{
{
Renderbuffer
*
renderBuffer
=
lookupRenderbuffer
(
type
,
depthStencilBuffer
);
Renderbuffer
*
renderBuffer
=
lookupRenderbuffer
(
type
,
depthStencilBuffer
,
level
,
layer
);
if
(
renderBuffer
&&
renderBuffer
->
getDepthSize
()
>
0
&&
renderBuffer
->
getStencilSize
()
>
0
)
if
(
renderBuffer
&&
renderBuffer
->
getDepthSize
()
>
0
&&
renderBuffer
->
getStencilSize
()
>
0
)
{
{
mDepthbuffer
.
set
(
renderBuffer
,
type
,
0
,
0
);
mDepthbuffer
.
set
(
renderBuffer
,
type
,
level
,
layer
);
mStencilbuffer
.
set
(
renderBuffer
,
type
,
0
,
0
);
mStencilbuffer
.
set
(
renderBuffer
,
type
,
level
,
layer
);
}
}
else
else
{
{
...
@@ -126,7 +176,8 @@ void Framebuffer::detachTexture(GLuint texture)
...
@@ -126,7 +176,8 @@ void Framebuffer::detachTexture(GLuint texture)
{
{
for
(
unsigned
int
colorAttachment
=
0
;
colorAttachment
<
IMPLEMENTATION_MAX_DRAW_BUFFERS
;
colorAttachment
++
)
for
(
unsigned
int
colorAttachment
=
0
;
colorAttachment
<
IMPLEMENTATION_MAX_DRAW_BUFFERS
;
colorAttachment
++
)
{
{
if
(
mColorbuffers
[
colorAttachment
].
id
()
==
texture
&&
IsInternalTextureTarget
(
mColorbuffers
[
colorAttachment
].
type
()))
if
(
mColorbuffers
[
colorAttachment
].
id
()
==
texture
&&
IsInternalTextureTarget
(
mColorbuffers
[
colorAttachment
].
type
()))
{
{
mColorbuffers
[
colorAttachment
].
set
(
NULL
,
GL_NONE
,
0
,
0
);
mColorbuffers
[
colorAttachment
].
set
(
NULL
,
GL_NONE
,
0
,
0
);
}
}
...
...
src/libGLESv2/Framebuffer.h
View file @
309c92aa
...
@@ -34,10 +34,10 @@ class Framebuffer
...
@@ -34,10 +34,10 @@ class Framebuffer
virtual
~
Framebuffer
();
virtual
~
Framebuffer
();
void
setColorbuffer
(
unsigned
int
colorAttachment
,
GLenum
type
,
GLuint
colorbuffer
);
void
setColorbuffer
(
unsigned
int
colorAttachment
,
GLenum
type
,
GLuint
colorbuffer
,
GLint
level
,
GLint
layer
);
void
setDepthbuffer
(
GLenum
type
,
GLuint
depthbuffer
);
void
setDepthbuffer
(
GLenum
type
,
GLuint
depthbuffer
,
GLint
level
,
GLint
layer
);
void
setStencilbuffer
(
GLenum
type
,
GLuint
stencilbuffer
);
void
setStencilbuffer
(
GLenum
type
,
GLuint
stencilbuffer
,
GLint
level
,
GLint
layer
);
void
setDepthStencilBuffer
(
GLenum
type
,
GLuint
depthStencilBuffer
);
void
setDepthStencilBuffer
(
GLenum
type
,
GLuint
depthStencilBuffer
,
GLint
level
,
GLint
layer
);
void
detachTexture
(
GLuint
texture
);
void
detachTexture
(
GLuint
texture
);
void
detachRenderbuffer
(
GLuint
renderbuffer
);
void
detachRenderbuffer
(
GLuint
renderbuffer
);
...
@@ -98,7 +98,7 @@ class Framebuffer
...
@@ -98,7 +98,7 @@ class Framebuffer
private
:
private
:
DISALLOW_COPY_AND_ASSIGN
(
Framebuffer
);
DISALLOW_COPY_AND_ASSIGN
(
Framebuffer
);
Renderbuffer
*
lookupRenderbuffer
(
GLenum
type
,
GLuint
handle
)
const
;
Renderbuffer
*
lookupRenderbuffer
(
GLenum
type
,
GLuint
handle
,
GLint
level
,
GLint
layer
)
const
;
};
};
class
DefaultFramebuffer
:
public
Framebuffer
class
DefaultFramebuffer
:
public
Framebuffer
...
...
src/libGLESv2/libGLESv2.cpp
View file @
309c92aa
...
@@ -4114,17 +4114,17 @@ void __stdcall glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenu
...
@@ -4114,17 +4114,17 @@ void __stdcall glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenu
return
gl
::
error
(
GL_INVALID_VALUE
);
return
gl
::
error
(
GL_INVALID_VALUE
);
}
}
framebuffer
->
setColorbuffer
(
colorAttachment
,
GL_RENDERBUFFER
,
renderbuffer
);
framebuffer
->
setColorbuffer
(
colorAttachment
,
GL_RENDERBUFFER
,
renderbuffer
,
0
,
0
);
}
}
else
else
{
{
switch
(
attachment
)
switch
(
attachment
)
{
{
case
GL_DEPTH_ATTACHMENT
:
case
GL_DEPTH_ATTACHMENT
:
framebuffer
->
setDepthbuffer
(
GL_RENDERBUFFER
,
renderbuffer
);
framebuffer
->
setDepthbuffer
(
GL_RENDERBUFFER
,
renderbuffer
,
0
,
0
);
break
;
break
;
case
GL_STENCIL_ATTACHMENT
:
case
GL_STENCIL_ATTACHMENT
:
framebuffer
->
setStencilbuffer
(
GL_RENDERBUFFER
,
renderbuffer
);
framebuffer
->
setStencilbuffer
(
GL_RENDERBUFFER
,
renderbuffer
,
0
,
0
);
break
;
break
;
default
:
default
:
return
gl
::
error
(
GL_INVALID_ENUM
);
return
gl
::
error
(
GL_INVALID_ENUM
);
...
@@ -4266,15 +4266,15 @@ void __stdcall glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum t
...
@@ -4266,15 +4266,15 @@ void __stdcall glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum t
return
gl
::
error
(
GL_INVALID_VALUE
);
return
gl
::
error
(
GL_INVALID_VALUE
);
}
}
framebuffer
->
setColorbuffer
(
colorAttachment
,
textarget
,
texture
);
framebuffer
->
setColorbuffer
(
colorAttachment
,
textarget
,
texture
,
level
,
0
);
}
}
else
else
{
{
switch
(
attachment
)
switch
(
attachment
)
{
{
case
GL_DEPTH_ATTACHMENT
:
framebuffer
->
setDepthbuffer
(
textarget
,
texture
);
break
;
case
GL_DEPTH_ATTACHMENT
:
framebuffer
->
setDepthbuffer
(
textarget
,
texture
,
level
,
0
);
break
;
case
GL_STENCIL_ATTACHMENT
:
framebuffer
->
setStencilbuffer
(
textarget
,
texture
);
break
;
case
GL_STENCIL_ATTACHMENT
:
framebuffer
->
setStencilbuffer
(
textarget
,
texture
,
level
,
0
);
break
;
case
GL_DEPTH_STENCIL_ATTACHMENT
:
framebuffer
->
setDepthStencilBuffer
(
textarget
,
texture
);
break
;
case
GL_DEPTH_STENCIL_ATTACHMENT
:
framebuffer
->
setDepthStencilBuffer
(
textarget
,
texture
,
level
,
0
);
break
;
}
}
}
}
}
}
...
@@ -5047,6 +5047,8 @@ void __stdcall glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attac
...
@@ -5047,6 +5047,8 @@ void __stdcall glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attac
GLenum
attachmentType
;
GLenum
attachmentType
;
GLuint
attachmentHandle
;
GLuint
attachmentHandle
;
GLuint
attachmentLevel
;
GLuint
attachmentLayer
;
if
(
attachment
>=
GL_COLOR_ATTACHMENT0_EXT
&&
attachment
<=
GL_COLOR_ATTACHMENT15_EXT
)
if
(
attachment
>=
GL_COLOR_ATTACHMENT0_EXT
&&
attachment
<=
GL_COLOR_ATTACHMENT15_EXT
)
{
{
...
@@ -5059,6 +5061,8 @@ void __stdcall glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attac
...
@@ -5059,6 +5061,8 @@ void __stdcall glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attac
attachmentType
=
framebuffer
->
getColorbufferType
(
colorAttachment
);
attachmentType
=
framebuffer
->
getColorbufferType
(
colorAttachment
);
attachmentHandle
=
framebuffer
->
getColorbufferHandle
(
colorAttachment
);
attachmentHandle
=
framebuffer
->
getColorbufferHandle
(
colorAttachment
);
attachmentLevel
=
framebuffer
->
getColorbufferMipLevel
(
colorAttachment
);
attachmentLayer
=
framebuffer
->
getColorbufferLayer
(
colorAttachment
);
}
}
else
else
{
{
...
@@ -5067,10 +5071,14 @@ void __stdcall glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attac
...
@@ -5067,10 +5071,14 @@ void __stdcall glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attac
case
GL_DEPTH_ATTACHMENT
:
case
GL_DEPTH_ATTACHMENT
:
attachmentType
=
framebuffer
->
getDepthbufferType
();
attachmentType
=
framebuffer
->
getDepthbufferType
();
attachmentHandle
=
framebuffer
->
getDepthbufferHandle
();
attachmentHandle
=
framebuffer
->
getDepthbufferHandle
();
attachmentLevel
=
framebuffer
->
getDepthbufferMipLevel
();
attachmentLayer
=
framebuffer
->
getDepthbufferLayer
();
break
;
break
;
case
GL_STENCIL_ATTACHMENT
:
case
GL_STENCIL_ATTACHMENT
:
attachmentType
=
framebuffer
->
getStencilbufferType
();
attachmentType
=
framebuffer
->
getStencilbufferType
();
attachmentHandle
=
framebuffer
->
getStencilbufferHandle
();
attachmentHandle
=
framebuffer
->
getStencilbufferHandle
();
attachmentLevel
=
framebuffer
->
getStencilbufferMipLevel
();
attachmentLayer
=
framebuffer
->
getStencilbufferLayer
();
break
;
break
;
case
GL_DEPTH_STENCIL_ATTACHMENT
:
case
GL_DEPTH_STENCIL_ATTACHMENT
:
if
(
context
->
getClientVersion
()
<
3
)
if
(
context
->
getClientVersion
()
<
3
)
...
@@ -5083,6 +5091,8 @@ void __stdcall glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attac
...
@@ -5083,6 +5091,8 @@ void __stdcall glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attac
}
}
attachmentType
=
framebuffer
->
getDepthStencilbufferType
();
attachmentType
=
framebuffer
->
getDepthStencilbufferType
();
attachmentHandle
=
framebuffer
->
getDepthStencilbufferHandle
();
attachmentHandle
=
framebuffer
->
getDepthStencilbufferHandle
();
attachmentLevel
=
framebuffer
->
getDepthStencilbufferMipLevel
();
attachmentLayer
=
framebuffer
->
getDepthStencilbufferLayer
();
default
:
return
gl
::
error
(
GL_INVALID_ENUM
);
default
:
return
gl
::
error
(
GL_INVALID_ENUM
);
}
}
}
}
...
@@ -5120,7 +5130,7 @@ void __stdcall glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attac
...
@@ -5120,7 +5130,7 @@ void __stdcall glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attac
case
GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL
:
case
GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL
:
if
(
attachmentObjectType
==
GL_TEXTURE
)
if
(
attachmentObjectType
==
GL_TEXTURE
)
{
{
*
params
=
0
;
// FramebufferTexture2D will not allow level to be set to anything else in GL ES 2.0
*
params
=
attachmentLevel
;
}
}
else
else
{
{
...
@@ -5144,6 +5154,20 @@ void __stdcall glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attac
...
@@ -5144,6 +5154,20 @@ void __stdcall glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attac
return
gl
::
error
(
GL_INVALID_ENUM
);
return
gl
::
error
(
GL_INVALID_ENUM
);
}
}
break
;
break
;
case
GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER
:
if
(
context
->
getClientVersion
()
<
3
)
{
return
gl
::
error
(
GL_INVALID_ENUM
);
}
if
(
attachmentObjectType
==
GL_TEXTURE
)
{
*
params
=
attachmentLayer
;
}
else
{
return
gl
::
error
(
GL_INVALID_ENUM
);
}
break
;
default
:
default
:
return
gl
::
error
(
GL_INVALID_ENUM
);
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