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
c1623d4e
Commit
c1623d4e
authored
Feb 12, 2007
by
Stefan Dösinger
Committed by
Alexandre Julliard
Feb 13, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Use the context manager to prepare for drawing.
parent
380930dc
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
95 additions
and
17 deletions
+95
-17
Makefile.in
dlls/wined3d/Makefile.in
+1
-0
context.c
dlls/wined3d/context.c
+82
-0
drawprim.c
dlls/wined3d/drawprim.c
+1
-15
wined3d_private.h
dlls/wined3d/wined3d_private.h
+11
-2
No files found.
dlls/wined3d/Makefile.in
View file @
c1623d4e
...
...
@@ -12,6 +12,7 @@ C_SRCS = \
arb_program_shader.c
\
baseshader.c
\
basetexture.c
\
context.c
\
cubetexture.c
\
device.c
\
directx.c
\
...
...
dlls/wined3d/context.c
0 → 100644
View file @
c1623d4e
/*
* Context and render target management in wined3d
*
* Copyright 2007 Stefan Dösinger for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <stdio.h>
#ifdef HAVE_FLOAT_H
# include <float.h>
#endif
#include "wined3d_private.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
d3d
);
/*****************************************************************************
* ActivateContext
*
* Finds a rendering context and drawable matching the device and render
* target for the current thread, activates them and puts them into the
* requested state.
*
* Params:
* This: Device to activate the context for
* target: Requested render target
* usage: Prepares the context for blitting, drawing or other actions
*
*****************************************************************************/
void
ActivateContext
(
IWineD3DDeviceImpl
*
This
,
IWineD3DSurface
*
target
,
ContextUsage
usage
)
{
DWORD
tid
=
This
->
createParms
.
BehaviorFlags
&
D3DCREATE_MULTITHREADED
?
GetCurrentThreadId
()
:
0
;
int
i
;
DWORD
dirtyState
,
idx
;
BYTE
shift
;
WineD3DContext
*
context
;
TRACE
(
"(%p): Selecting context for render target %p, thread %d
\n
"
,
This
,
target
,
tid
);
/* TODO: Render target selection */
/* TODO: Thread selection */
/* TODO: Activate the opengl context */
context
=
&
This
->
contexts
[
This
->
activeContext
];
switch
(
usage
)
{
case
CTXUSAGE_RESOURCELOAD
:
/* This does not require any special states to be set up */
break
;
case
CTXUSAGE_DRAWPRIM
:
/* This needs all dirty states applied */
for
(
i
=
0
;
i
<
context
->
numDirtyEntries
;
i
++
)
{
dirtyState
=
context
->
dirtyArray
[
i
];
idx
=
dirtyState
>>
5
;
shift
=
dirtyState
&
0x1f
;
context
->
isStateDirty
[
idx
]
&=
~
(
1
<<
shift
);
StateTable
[
dirtyState
].
apply
(
dirtyState
,
This
->
stateBlock
,
context
);
}
context
->
numDirtyEntries
=
0
;
/* This makes the whole list clean */
break
;
case
CTXUSAGE_BLIT
:
FIXME
(
"Setting up for blitting not supported yet
\n
"
);
break
;
default:
FIXME
(
"Unexpected context usage requested
\n
"
);
}
}
dlls/wined3d/drawprim.c
View file @
c1623d4e
...
...
@@ -1179,9 +1179,6 @@ void drawPrimitive(IWineD3DDevice *iface,
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
IWineD3DSwapChainImpl
*
swapchain
;
int
i
;
DWORD
dirtyState
,
idx
;
BYTE
shift
;
WineD3DContext
*
context
;
/* Signals other modules that a drawing is in progress and the stateblock finalized */
This
->
isInDraw
=
TRUE
;
...
...
@@ -1198,18 +1195,7 @@ void drawPrimitive(IWineD3DDevice *iface,
/* Ok, we will be updating the screen from here onwards so grab the lock */
ENTER_GL
();
/* TODO: Find the correct context for the render target / thread */
context
=
&
This
->
contexts
[
This
->
activeContext
];
/* Apply dirty states */
for
(
i
=
0
;
i
<
context
->
numDirtyEntries
;
i
++
)
{
dirtyState
=
context
->
dirtyArray
[
i
];
idx
=
dirtyState
>>
5
;
shift
=
dirtyState
&
0x1f
;
context
->
isStateDirty
[
idx
]
&=
~
(
1
<<
shift
);
StateTable
[
dirtyState
].
apply
(
dirtyState
,
This
->
stateBlock
,
context
);
}
context
->
numDirtyEntries
=
0
;
/* This makes the whole list clean */
ActivateContext
(
This
,
This
->
render_targets
[
0
],
CTXUSAGE_DRAWPRIM
);
if
(
TRACE_ON
(
d3d_draw
)
&&
wined3d_settings
.
offscreen_rendering_mode
==
ORM_FBO
)
{
check_fbo_status
(
iface
);
...
...
dlls/wined3d/wined3d_private.h
View file @
c1623d4e
...
...
@@ -290,6 +290,7 @@ do {
typedef
struct
IWineD3DStateBlockImpl
IWineD3DStateBlockImpl
;
typedef
struct
IWineD3DSurfaceImpl
IWineD3DSurfaceImpl
;
typedef
struct
IWineD3DPaletteImpl
IWineD3DPaletteImpl
;
typedef
struct
IWineD3DDeviceImpl
IWineD3DDeviceImpl
;
/* Tracking */
...
...
@@ -478,6 +479,14 @@ struct WineD3DContext {
GLenum
tracking_parm
;
/* Which source is tracking current colour */
};
typedef
enum
ContextUsage
{
CTXUSAGE_RESOURCELOAD
=
1
,
/* Only loads textures: No State is applied */
CTXUSAGE_DRAWPRIM
=
2
,
/* OpenGL states are set up for blitting DirectDraw surfacs */
CTXUSAGE_BLIT
=
3
,
/* OpenGL states are set up 3D drawing */
}
ContextUsage
;
void
ActivateContext
(
IWineD3DDeviceImpl
*
device
,
IWineD3DSurface
*
target
,
ContextUsage
usage
);
/* Routine to fill gl caps for swapchains and IWineD3D */
BOOL
IWineD3DImpl_FillGLCaps
(
IWineD3D
*
iface
,
Display
*
display
);
...
...
@@ -575,7 +584,7 @@ void dumpResources(ResourceList *resources);
/*****************************************************************************
* IWineD3DDevice implementation structure
*/
typedef
struct
IWineD3DDeviceImpl
struct
IWineD3DDeviceImpl
{
/* IUnknown fields */
const
IWineD3DDeviceVtbl
*
lpVtbl
;
...
...
@@ -688,7 +697,7 @@ typedef struct IWineD3DDeviceImpl
WineD3DContext
contexts
[
1
];
/* Dynamic array later */
UINT
activeContext
;
/* Only 0 for now */
UINT
numContexts
;
/* Always 1 for now */
}
IWineD3DDeviceImpl
;
};
extern
const
IWineD3DDeviceVtbl
IWineD3DDevice_Vtbl
;
...
...
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