Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
9533a5cb
Commit
9533a5cb
authored
Sep 18, 2008
by
Henri Verbeet
Committed by
Alexandre Julliard
Sep 19, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Split off a function for applying an attachment's filter states.
parent
a2692366
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
70 deletions
+60
-70
context.c
dlls/wined3d/context.c
+60
-70
No files found.
dlls/wined3d/context.c
View file @
9533a5cb
...
...
@@ -72,55 +72,79 @@ static void context_destroy_fbo(IWineD3DDeviceImpl *This, const GLuint *fbo)
checkGLcall
(
"glDeleteFramebuffers()"
);
}
/* TODO: Handle stencil attachments */
void
context_attach_depth_stencil_fbo
(
IWineD3DDeviceImpl
*
This
,
GLenum
fbo_target
,
IWineD3DSurface
*
depth_stencil
,
BOOL
use_render_buffer
)
static
void
context_apply_attachment_filter_states
(
IWineD3DDevice
*
iface
,
IWineD3DSurface
*
surface
,
BOOL
force_preload
)
{
IWineD3DSurfaceImpl
*
depth_stencil_impl
=
(
IWineD3DSurfaceImpl
*
)
depth_stencil
;
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
const
IWineD3DSurfaceImpl
*
surface_impl
=
(
IWineD3DSurfaceImpl
*
)
surface
;
IWineD3DBaseTextureImpl
*
texture_impl
;
BOOL
update_minfilter
,
update_magfilter
;
if
(
use_render_buffer
&&
depth_stencil_impl
->
current_renderbuffer
)
/* Update base texture states array */
if
(
SUCCEEDED
(
IWineD3DSurface_GetContainer
(
surface
,
&
IID_IWineD3DBaseTexture
,
(
void
**
)
&
texture_impl
)))
{
GL_EXTCALL
(
glFramebufferRenderbufferEXT
(
fbo_target
,
GL_DEPTH_ATTACHMENT_EXT
,
GL_RENDERBUFFER_EXT
,
depth_stencil_impl
->
current_renderbuffer
->
id
));
checkGLcall
(
"glFramebufferRenderbufferEXT()"
);
}
else
{
IWineD3DBaseTextureImpl
*
texture_impl
;
GLenum
texttarget
,
target
;
GLint
old_binding
=
0
;
if
(
texture_impl
->
baseTexture
.
states
[
WINED3DTEXSTA_MINFILTER
]
!=
WINED3DTEXF_POINT
)
{
texture_impl
->
baseTexture
.
states
[
WINED3DTEXSTA_MINFILTER
]
=
WINED3DTEXF_POINT
;
update_minfilter
=
TRUE
;
}
if
(
texture_impl
->
baseTexture
.
states
[
WINED3DTEXSTA_MAGFILTER
]
!=
WINED3DTEXF_POINT
)
{
texture_impl
->
baseTexture
.
states
[
WINED3DTEXSTA_MAGFILTER
]
=
WINED3DTEXF_POINT
;
update_magfilter
=
TRUE
;
}
if
(
texture_impl
->
baseTexture
.
bindCount
)
{
WARN
(
"Render targets should not be bound to a sampler
\n
"
);
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_SAMPLER
(
texture_impl
->
baseTexture
.
sampler
));
}
texttarget
=
depth_stencil_impl
->
glDescription
.
target
;
if
(
texttarget
==
GL_TEXTURE_2D
)
IWineD3DBaseTexture_Release
((
IWineD3DBaseTexture
*
)
texture_impl
);
}
if
(
update_minfilter
||
update_magfilter
||
force_preload
)
{
GLenum
target
,
bind_target
;
GLint
old_binding
;
target
=
surface_impl
->
glDescription
.
target
;
if
(
target
==
GL_TEXTURE_2D
)
{
target
=
GL_TEXTURE_2D
;
bind_
target
=
GL_TEXTURE_2D
;
glGetIntegerv
(
GL_TEXTURE_BINDING_2D
,
&
old_binding
);
}
else
if
(
t
extt
arget
==
GL_TEXTURE_RECTANGLE_ARB
)
{
target
=
GL_TEXTURE_RECTANGLE_ARB
;
}
else
if
(
target
==
GL_TEXTURE_RECTANGLE_ARB
)
{
bind_
target
=
GL_TEXTURE_RECTANGLE_ARB
;
glGetIntegerv
(
GL_TEXTURE_BINDING_RECTANGLE_ARB
,
&
old_binding
);
}
else
{
target
=
GL_TEXTURE_CUBE_MAP_ARB
;
bind_
target
=
GL_TEXTURE_CUBE_MAP_ARB
;
glGetIntegerv
(
GL_TEXTURE_BINDING_CUBE_MAP_ARB
,
&
old_binding
);
}
IWineD3DSurface_PreLoad
(
depth_stencil
);
IWineD3DSurface_PreLoad
(
surface
);
glBindTexture
(
target
,
depth_stencil
_impl
->
glDescription
.
textureName
);
glTexParameteri
(
target
,
GL_TEXTURE_MIN_FILTER
,
GL_NEAREST
);
glTexParameteri
(
target
,
GL_TEXTURE_MAG_FILTER
,
GL_NEAREST
);
gl
TexParameteri
(
target
,
GL_DEPTH_TEXTURE_MODE_ARB
,
GL_LUMINANCE
);
glBindTexture
(
target
,
old_binding
);
glBindTexture
(
bind_target
,
surface
_impl
->
glDescription
.
textureName
);
if
(
update_minfilter
)
glTexParameteri
(
bind_
target
,
GL_TEXTURE_MIN_FILTER
,
GL_NEAREST
);
if
(
update_magfilter
)
glTexParameteri
(
bind_
target
,
GL_TEXTURE_MAG_FILTER
,
GL_NEAREST
);
gl
BindTexture
(
bind_target
,
old_binding
);
}
/* Update base texture states array */
if
(
SUCCEEDED
(
IWineD3DSurface_GetContainer
(
depth_stencil
,
&
IID_IWineD3DBaseTexture
,
(
void
**
)
&
texture_impl
)))
{
texture_impl
->
baseTexture
.
states
[
WINED3DTEXSTA_MINFILTER
]
=
WINED3DTEXF_POINT
;
texture_impl
->
baseTexture
.
states
[
WINED3DTEXSTA_MAGFILTER
]
=
WINED3DTEXF_POINT
;
if
(
texture_impl
->
baseTexture
.
bindCount
)
{
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_SAMPLER
(
texture_impl
->
baseTexture
.
sampler
));
}
checkGLcall
(
"apply_attachment_filter_states()"
);
}
IWineD3DBaseTexture_Release
((
IWineD3DBaseTexture
*
)
texture_impl
);
}
/* TODO: Handle stencil attachments */
void
context_attach_depth_stencil_fbo
(
IWineD3DDeviceImpl
*
This
,
GLenum
fbo_target
,
IWineD3DSurface
*
depth_stencil
,
BOOL
use_render_buffer
)
{
IWineD3DSurfaceImpl
*
depth_stencil_impl
=
(
IWineD3DSurfaceImpl
*
)
depth_stencil
;
if
(
use_render_buffer
&&
depth_stencil_impl
->
current_renderbuffer
)
{
GL_EXTCALL
(
glFramebufferRenderbufferEXT
(
fbo_target
,
GL_DEPTH_ATTACHMENT_EXT
,
GL_RENDERBUFFER_EXT
,
depth_stencil_impl
->
current_renderbuffer
->
id
));
checkGLcall
(
"glFramebufferRenderbufferEXT()"
);
}
else
{
context_apply_attachment_filter_states
((
IWineD3DDevice
*
)
This
,
depth_stencil
,
TRUE
);
GL_EXTCALL
(
glFramebufferTexture2DEXT
(
fbo_target
,
GL_DEPTH_ATTACHMENT_EXT
,
text
target
,
GL_EXTCALL
(
glFramebufferTexture2DEXT
(
fbo_target
,
GL_DEPTH_ATTACHMENT_EXT
,
depth_stencil_impl
->
glDescription
.
target
,
depth_stencil_impl
->
glDescription
.
textureName
,
depth_stencil_impl
->
glDescription
.
level
));
checkGLcall
(
"glFramebufferTexture2DEXT()"
);
}
...
...
@@ -129,44 +153,10 @@ void context_attach_depth_stencil_fbo(IWineD3DDeviceImpl *This, GLenum fbo_targe
void
context_attach_surface_fbo
(
IWineD3DDeviceImpl
*
This
,
GLenum
fbo_target
,
DWORD
idx
,
IWineD3DSurface
*
surface
)
{
const
IWineD3DSurfaceImpl
*
surface_impl
=
(
IWineD3DSurfaceImpl
*
)
surface
;
IWineD3DBaseTextureImpl
*
texture_impl
;
GLenum
texttarget
,
target
;
GLint
old_binding
;
texttarget
=
surface_impl
->
glDescription
.
target
;
if
(
texttarget
==
GL_TEXTURE_2D
)
{
target
=
GL_TEXTURE_2D
;
glGetIntegerv
(
GL_TEXTURE_BINDING_2D
,
&
old_binding
);
}
else
if
(
texttarget
==
GL_TEXTURE_RECTANGLE_ARB
)
{
target
=
GL_TEXTURE_RECTANGLE_ARB
;
glGetIntegerv
(
GL_TEXTURE_BINDING_RECTANGLE_ARB
,
&
old_binding
);
}
else
{
target
=
GL_TEXTURE_CUBE_MAP_ARB
;
glGetIntegerv
(
GL_TEXTURE_BINDING_CUBE_MAP_ARB
,
&
old_binding
);
}
IWineD3DSurface_PreLoad
(
surface
);
glBindTexture
(
target
,
surface_impl
->
glDescription
.
textureName
);
glTexParameteri
(
target
,
GL_TEXTURE_MIN_FILTER
,
GL_NEAREST
);
glTexParameteri
(
target
,
GL_TEXTURE_MAG_FILTER
,
GL_NEAREST
);
glBindTexture
(
target
,
old_binding
);
/* Update base texture states array */
if
(
SUCCEEDED
(
IWineD3DSurface_GetContainer
(
surface
,
&
IID_IWineD3DBaseTexture
,
(
void
**
)
&
texture_impl
)))
{
texture_impl
->
baseTexture
.
states
[
WINED3DTEXSTA_MINFILTER
]
=
WINED3DTEXF_POINT
;
texture_impl
->
baseTexture
.
states
[
WINED3DTEXSTA_MAGFILTER
]
=
WINED3DTEXF_POINT
;
if
(
texture_impl
->
baseTexture
.
bindCount
)
{
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_SAMPLER
(
texture_impl
->
baseTexture
.
sampler
));
}
IWineD3DBaseTexture_Release
((
IWineD3DBaseTexture
*
)
texture_impl
);
}
context_apply_attachment_filter_states
((
IWineD3DDevice
*
)
This
,
surface
,
TRUE
);
GL_EXTCALL
(
glFramebufferTexture2DEXT
(
fbo_target
,
GL_COLOR_ATTACHMENT0_EXT
+
idx
,
text
target
,
GL_EXTCALL
(
glFramebufferTexture2DEXT
(
fbo_target
,
GL_COLOR_ATTACHMENT0_EXT
+
idx
,
surface_impl
->
glDescription
.
target
,
surface_impl
->
glDescription
.
textureName
,
surface_impl
->
glDescription
.
level
));
checkGLcall
(
"attach_surface_fbo"
);
...
...
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