Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
be43c867
Commit
be43c867
authored
May 03, 2010
by
Henri Verbeet
Committed by
Alexandre Julliard
May 04, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Split context_apply_state() into separate functions for each usage.
parent
b8b1a565
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
124 additions
and
97 deletions
+124
-97
context.c
dlls/wined3d/context.c
+124
-97
No files found.
dlls/wined3d/context.c
View file @
be43c867
...
...
@@ -1977,117 +1977,124 @@ static void context_validate_onscreen_formats(IWineD3DDeviceImpl *device, struct
}
/* Context activation is done by the caller. */
static
void
context_apply_
state
(
struct
wined3d_context
*
context
,
IWineD3DDeviceImpl
*
device
,
enum
ContextUsage
usag
e
)
static
void
context_apply_
blit_state
(
struct
wined3d_context
*
context
,
IWineD3DDeviceImpl
*
devic
e
)
{
const
struct
StateEntry
*
state_table
=
device
->
StateTable
;
unsigned
int
i
;
if
(
wined3d_settings
.
offscreen_rendering_mode
==
ORM_FBO
)
{
if
(
context
->
render_offscreen
)
{
FIXME
(
"Applying blit state for an offscreen target with ORM_FBO. This should be avoided.
\n
"
);
surface_internal_preload
(
context
->
current_rt
,
SRGB_RGB
);
switch
(
usage
)
{
case
CTXUSAGE_CLEAR
:
case
CTXUSAGE_DRAWPRIM
:
if
(
wined3d_settings
.
offscreen_rendering_mode
==
ORM_FBO
)
{
if
(
!
context
->
render_offscreen
)
context_validate_onscreen_formats
(
device
,
context
);
ENTER_GL
();
context_apply_fbo_state
(
context
);
LEAVE_GL
();
}
if
(
context
->
draw_buffer_dirty
)
{
context_apply_draw_buffer
(
context
,
FALSE
);
context
->
draw_buffer_dirty
=
FALSE
;
}
break
;
ENTER_GL
();
context_bind_fbo
(
context
,
GL_FRAMEBUFFER
,
&
context
->
dst_fbo
);
context_attach_surface_fbo
(
context
,
GL_FRAMEBUFFER
,
0
,
context
->
current_rt
);
context_attach_depth_stencil_fbo
(
context
,
GL_FRAMEBUFFER
,
NULL
,
FALSE
);
LEAVE_GL
();
}
else
{
context_validate_onscreen_formats
(
device
,
context
);
case
CTXUSAGE_BLIT
:
if
(
wined3d_settings
.
offscreen_rendering_mode
==
ORM_FBO
)
{
if
(
!
context
->
render_offscreen
)
context_validate_onscreen_formats
(
device
,
context
);
if
(
context
->
render_offscreen
)
{
FIXME
(
"Activating for CTXUSAGE_BLIT for an offscreen target with ORM_FBO. This should be avoided.
\n
"
);
surface_internal_preload
(
context
->
current_rt
,
SRGB_RGB
);
ENTER_GL
();
context_bind_fbo
(
context
,
GL_FRAMEBUFFER
,
&
context
->
dst_fbo
);
context_attach_surface_fbo
(
context
,
GL_FRAMEBUFFER
,
0
,
context
->
current_rt
);
context_attach_depth_stencil_fbo
(
context
,
GL_FRAMEBUFFER
,
NULL
,
FALSE
);
LEAVE_GL
();
}
else
{
ENTER_GL
();
context_bind_fbo
(
context
,
GL_FRAMEBUFFER
,
NULL
);
LEAVE_GL
();
}
context
->
draw_buffer_dirty
=
TRUE
;
}
if
(
context
->
draw_buffer_dirty
)
{
context_apply_draw_buffer
(
context
,
TRUE
);
if
(
wined3d_settings
.
offscreen_rendering_mode
!=
ORM_FBO
)
{
context
->
draw_buffer_dirty
=
FALSE
;
}
}
break
;
ENTER_GL
();
context_bind_fbo
(
context
,
GL_FRAMEBUFFER
,
NULL
);
LEAVE_GL
();
}
default:
break
;
context
->
draw_buffer_dirty
=
TRUE
;
}
switch
(
usage
)
{
case
CTXUSAGE_RESOURCELOAD
:
/* This does not require any special states to be set up */
break
;
if
(
context
->
draw_buffer_dirty
)
{
context_apply_draw_buffer
(
context
,
TRUE
);
if
(
wined3d_settings
.
offscreen_rendering_mode
!=
ORM_FBO
)
context
->
draw_buffer_dirty
=
FALSE
;
}
case
CTXUSAGE_CLEAR
:
if
(
context
->
last_was_blit
)
{
device
->
frag_pipe
->
enable_extension
((
IWineD3DDevice
*
)
device
,
TRUE
);
}
SetupForBlit
(
device
,
context
);
}
/* Blending and clearing should be orthogonal, but tests on the nvidia driver show that disabling
* blending when clearing improves the clearing performance incredibly.
*/
ENTER_GL
();
glDisable
(
GL_BLEND
);
LEAVE_GL
();
Context_MarkStateDirty
(
context
,
STATE_RENDER
(
WINED3DRS_ALPHABLENDENABLE
),
state_table
);
/* Context activation is done by the caller. */
static
void
context_apply_clear_state
(
struct
wined3d_context
*
context
,
IWineD3DDeviceImpl
*
device
)
{
const
struct
StateEntry
*
state_table
=
device
->
StateTable
;
ENTER_GL
();
glEnable
(
GL_SCISSOR_TEST
);
checkGLcall
(
"glEnable GL_SCISSOR_TEST"
);
LEAVE_GL
();
context
->
last_was_blit
=
FALSE
;
Context_MarkStateDirty
(
context
,
STATE_RENDER
(
WINED3DRS_SCISSORTESTENABLE
),
state_table
);
Context_MarkStateDirty
(
context
,
STATE_SCISSORRECT
,
state_table
);
break
;
if
(
wined3d_settings
.
offscreen_rendering_mode
==
ORM_FBO
)
{
if
(
!
context
->
render_offscreen
)
context_validate_onscreen_formats
(
device
,
context
);
ENTER_GL
();
context_apply_fbo_state
(
context
);
LEAVE_GL
();
}
case
CTXUSAGE_DRAWPRIM
:
/* This needs all dirty states applied */
if
(
context
->
last_was_blit
)
{
device
->
frag_pipe
->
enable_extension
((
IWineD3DDevice
*
)
device
,
TRUE
)
;
}
if
(
context
->
draw_buffer_dirty
)
{
context_apply_draw_buffer
(
context
,
FALSE
);
context
->
draw_buffer_dirty
=
FALSE
;
}
IWineD3DDeviceImpl_FindTexUnitMap
(
device
);
device_preload_textures
(
device
);
if
(
isStateDirty
(
context
,
STATE_VDECL
))
device_update_stream_info
(
device
,
context
->
gl_info
);
if
(
context
->
last_was_blit
)
{
device
->
frag_pipe
->
enable_extension
((
IWineD3DDevice
*
)
device
,
TRUE
);
}
ENTER_GL
();
for
(
i
=
0
;
i
<
context
->
numDirtyEntries
;
++
i
)
{
DWORD
rep
=
context
->
dirtyArray
[
i
];
DWORD
idx
=
rep
/
(
sizeof
(
*
context
->
isStateDirty
)
*
CHAR_BIT
);
BYTE
shift
=
rep
&
((
sizeof
(
*
context
->
isStateDirty
)
*
CHAR_BIT
)
-
1
);
context
->
isStateDirty
[
idx
]
&=
~
(
1
<<
shift
);
state_table
[
rep
].
apply
(
rep
,
device
->
stateBlock
,
context
);
}
LEAVE_GL
();
context
->
numDirtyEntries
=
0
;
/* This makes the whole list clean */
context
->
last_was_blit
=
FALSE
;
break
;
/* Blending and clearing should be orthogonal, but tests on the nvidia
* driver show that disabling blending when clearing improves the clearing
* performance incredibly. */
ENTER_GL
();
glDisable
(
GL_BLEND
);
glEnable
(
GL_SCISSOR_TEST
);
checkGLcall
(
"glEnable GL_SCISSOR_TEST"
);
LEAVE_GL
();
case
CTXUSAGE_BLIT
:
SetupForBlit
(
device
,
context
);
break
;
context
->
last_was_blit
=
FALSE
;
Context_MarkStateDirty
(
context
,
STATE_RENDER
(
WINED3DRS_ALPHABLENDENABLE
),
state_table
);
Context_MarkStateDirty
(
context
,
STATE_RENDER
(
WINED3DRS_SCISSORTESTENABLE
),
state_table
);
Context_MarkStateDirty
(
context
,
STATE_SCISSORRECT
,
state_table
);
}
default:
FIXME
(
"Unexpected context usage requested
\n
"
);
/* Context activation is done by the caller. */
static
void
context_apply_draw_state
(
struct
wined3d_context
*
context
,
IWineD3DDeviceImpl
*
device
)
{
const
struct
StateEntry
*
state_table
=
device
->
StateTable
;
unsigned
int
i
;
if
(
wined3d_settings
.
offscreen_rendering_mode
==
ORM_FBO
)
{
if
(
!
context
->
render_offscreen
)
context_validate_onscreen_formats
(
device
,
context
);
ENTER_GL
();
context_apply_fbo_state
(
context
);
LEAVE_GL
();
}
if
(
context
->
draw_buffer_dirty
)
{
context_apply_draw_buffer
(
context
,
FALSE
);
context
->
draw_buffer_dirty
=
FALSE
;
}
if
(
context
->
last_was_blit
)
{
device
->
frag_pipe
->
enable_extension
((
IWineD3DDevice
*
)
device
,
TRUE
);
}
IWineD3DDeviceImpl_FindTexUnitMap
(
device
);
device_preload_textures
(
device
);
if
(
isStateDirty
(
context
,
STATE_VDECL
))
device_update_stream_info
(
device
,
context
->
gl_info
);
ENTER_GL
();
for
(
i
=
0
;
i
<
context
->
numDirtyEntries
;
++
i
)
{
DWORD
rep
=
context
->
dirtyArray
[
i
];
DWORD
idx
=
rep
/
(
sizeof
(
*
context
->
isStateDirty
)
*
CHAR_BIT
);
BYTE
shift
=
rep
&
((
sizeof
(
*
context
->
isStateDirty
)
*
CHAR_BIT
)
-
1
);
context
->
isStateDirty
[
idx
]
&=
~
(
1
<<
shift
);
state_table
[
rep
].
apply
(
rep
,
device
->
stateBlock
,
context
);
}
LEAVE_GL
();
context
->
numDirtyEntries
=
0
;
/* This makes the whole list clean */
context
->
last_was_blit
=
FALSE
;
}
static
void
context_setup_target
(
IWineD3DDeviceImpl
*
device
,
...
...
@@ -2220,7 +2227,27 @@ struct wined3d_context *context_acquire(IWineD3DDeviceImpl *device,
}
}
context_apply_state
(
context
,
device
,
usage
);
switch
(
usage
)
{
case
CTXUSAGE_BLIT
:
context_apply_blit_state
(
context
,
device
);
break
;
case
CTXUSAGE_CLEAR
:
context_apply_clear_state
(
context
,
device
);
break
;
case
CTXUSAGE_DRAWPRIM
:
context_apply_draw_state
(
context
,
device
);
break
;
case
CTXUSAGE_RESOURCELOAD
:
break
;
default:
FIXME
(
"Unexpected context usage requested.
\n
"
);
break
;
}
return
context
;
}
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