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
363d8a31
Commit
363d8a31
authored
Nov 29, 2010
by
Henri Verbeet
Committed by
Alexandre Julliard
Nov 30, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Pass an IWineD3DDeviceImpl pointer to drawPrimitive().
parent
6476ef59
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
39 deletions
+34
-39
device.c
dlls/wined3d/device.c
+6
-6
drawprim.c
dlls/wined3d/drawprim.c
+27
-32
wined3d_private.h
dlls/wined3d/wined3d_private.h
+1
-1
No files found.
dlls/wined3d/device.c
View file @
363d8a31
...
@@ -4797,7 +4797,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitive(IWineD3DDevice *iface, UI
...
@@ -4797,7 +4797,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitive(IWineD3DDevice *iface, UI
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_STREAMSRC
);
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_STREAMSRC
);
}
}
/* Account for the loading offset due to index buffers. Instead of reloading all sources correct it with the startvertex parameter */
/* Account for the loading offset due to index buffers. Instead of reloading all sources correct it with the startvertex parameter */
drawPrimitive
(
iface
,
vertex_count
,
StartVertex
/* start_idx */
,
0
/* indxSize */
,
NULL
/* indxData */
);
drawPrimitive
(
This
,
vertex_count
,
StartVertex
/* start_idx */
,
0
/* indxSize */
,
NULL
/* indxData */
);
return
WINED3D_OK
;
return
WINED3D_OK
;
}
}
...
@@ -4845,7 +4845,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice *if
...
@@ -4845,7 +4845,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice *if
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_STREAMSRC
);
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_STREAMSRC
);
}
}
drawPrimitive
(
iface
,
index_count
,
startIndex
,
idxStride
,
drawPrimitive
(
This
,
index_count
,
startIndex
,
idxStride
,
vbo
?
NULL
:
index_buffer
->
resource
.
allocatedMemory
);
vbo
?
NULL
:
index_buffer
->
resource
.
allocatedMemory
);
return
WINED3D_OK
;
return
WINED3D_OK
;
...
@@ -4880,7 +4880,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveUP(IWineD3DDevice *iface,
...
@@ -4880,7 +4880,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveUP(IWineD3DDevice *iface,
/* TODO: Only mark dirty if drawing from a different UP address */
/* TODO: Only mark dirty if drawing from a different UP address */
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_STREAMSRC
);
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_STREAMSRC
);
drawPrimitive
(
iface
,
vertex_count
,
0
/* start_idx */
,
0
/* indxSize*/
,
NULL
/* indxData */
);
drawPrimitive
(
This
,
vertex_count
,
0
/* start_idx */
,
0
/* indxSize*/
,
NULL
/* indxData */
);
/* MSDN specifies stream zero settings must be set to NULL */
/* MSDN specifies stream zero settings must be set to NULL */
stream
->
buffer
=
NULL
;
stream
->
buffer
=
NULL
;
...
@@ -4932,7 +4932,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *
...
@@ -4932,7 +4932,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_VDECL
);
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_VDECL
);
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_INDEXBUFFER
);
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_INDEXBUFFER
);
drawPrimitive
(
iface
,
index_count
,
0
/* start_idx */
,
idxStride
,
pIndexData
);
drawPrimitive
(
This
,
index_count
,
0
/* start_idx */
,
idxStride
,
pIndexData
);
/* MSDN specifies stream zero settings and index buffer must be set to NULL */
/* MSDN specifies stream zero settings and index buffer must be set to NULL */
stream
->
buffer
=
NULL
;
stream
->
buffer
=
NULL
;
...
@@ -4963,7 +4963,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveStrided(IWineD3DDevice *if
...
@@ -4963,7 +4963,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveStrided(IWineD3DDevice *if
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_INDEXBUFFER
);
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_INDEXBUFFER
);
This
->
stateBlock
->
state
.
base_vertex_index
=
0
;
This
->
stateBlock
->
state
.
base_vertex_index
=
0
;
This
->
up_strided
=
DrawPrimStrideData
;
This
->
up_strided
=
DrawPrimStrideData
;
drawPrimitive
(
iface
,
vertex_count
,
0
,
0
,
NULL
);
drawPrimitive
(
This
,
vertex_count
,
0
,
0
,
NULL
);
This
->
up_strided
=
NULL
;
This
->
up_strided
=
NULL
;
return
WINED3D_OK
;
return
WINED3D_OK
;
}
}
...
@@ -4984,7 +4984,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveStrided(IWineD3DDev
...
@@ -4984,7 +4984,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveStrided(IWineD3DDev
This
->
stateBlock
->
state
.
user_stream
=
TRUE
;
This
->
stateBlock
->
state
.
user_stream
=
TRUE
;
This
->
stateBlock
->
state
.
base_vertex_index
=
0
;
This
->
stateBlock
->
state
.
base_vertex_index
=
0
;
This
->
up_strided
=
DrawPrimStrideData
;
This
->
up_strided
=
DrawPrimStrideData
;
drawPrimitive
(
iface
,
vertex_count
,
0
/* start_idx */
,
idxSize
,
pIndexData
);
drawPrimitive
(
This
,
vertex_count
,
0
/* start_idx */
,
idxSize
,
pIndexData
);
This
->
up_strided
=
NULL
;
This
->
up_strided
=
NULL
;
return
WINED3D_OK
;
return
WINED3D_OK
;
}
}
...
...
dlls/wined3d/drawprim.c
View file @
363d8a31
...
@@ -558,11 +558,9 @@ static void remove_vbos(const struct wined3d_gl_info *gl_info,
...
@@ -558,11 +558,9 @@ static void remove_vbos(const struct wined3d_gl_info *gl_info,
}
}
/* Routine common to the draw primitive and draw indexed primitive routines */
/* Routine common to the draw primitive and draw indexed primitive routines */
void
drawPrimitive
(
IWineD3DDevice
*
ifa
ce
,
UINT
index_count
,
UINT
StartIdx
,
UINT
idxSize
,
const
void
*
idxData
)
void
drawPrimitive
(
IWineD3DDevice
Impl
*
devi
ce
,
UINT
index_count
,
UINT
StartIdx
,
UINT
idxSize
,
const
void
*
idxData
)
{
{
const
struct
wined3d_state
*
state
=
&
device
->
stateBlock
->
state
;
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
const
struct
wined3d_state
*
state
=
&
This
->
stateBlock
->
state
;
struct
wined3d_context
*
context
;
struct
wined3d_context
*
context
;
unsigned
int
i
;
unsigned
int
i
;
...
@@ -571,9 +569,9 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT
...
@@ -571,9 +569,9 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT
if
(
state
->
render_states
[
WINED3DRS_COLORWRITEENABLE
])
if
(
state
->
render_states
[
WINED3DRS_COLORWRITEENABLE
])
{
{
/* Invalidate the back buffer memory so LockRect will read it the next time */
/* Invalidate the back buffer memory so LockRect will read it the next time */
for
(
i
=
0
;
i
<
This
->
adapter
->
gl_info
.
limits
.
buffers
;
++
i
)
for
(
i
=
0
;
i
<
device
->
adapter
->
gl_info
.
limits
.
buffers
;
++
i
)
{
{
IWineD3DSurfaceImpl
*
target
=
This
->
render_targets
[
i
];
IWineD3DSurfaceImpl
*
target
=
device
->
render_targets
[
i
];
if
(
target
)
if
(
target
)
{
{
surface_load_location
(
target
,
SFLAG_INDRAWABLE
,
NULL
);
surface_load_location
(
target
,
SFLAG_INDRAWABLE
,
NULL
);
...
@@ -583,9 +581,9 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT
...
@@ -583,9 +581,9 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT
}
}
/* Signals other modules that a drawing is in progress and the stateblock finalized */
/* Signals other modules that a drawing is in progress and the stateblock finalized */
This
->
isInDraw
=
TRUE
;
device
->
isInDraw
=
TRUE
;
context
=
context_acquire
(
This
,
This
->
render_targets
[
0
]);
context
=
context_acquire
(
device
,
device
->
render_targets
[
0
]);
if
(
!
context
->
valid
)
if
(
!
context
->
valid
)
{
{
context_release
(
context
);
context_release
(
context
);
...
@@ -593,42 +591,39 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT
...
@@ -593,42 +591,39 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT
return
;
return
;
}
}
context_apply_draw_state
(
context
,
This
);
context_apply_draw_state
(
context
,
device
);
if
(
This
->
depth_stencil
)
if
(
device
->
depth_stencil
)
{
{
/* Note that this depends on the context_acquire() call above to set
/* Note that this depends on the context_acquire() call above to set
*
This
->render_offscreen properly. We don't currently take the
*
context
->render_offscreen properly. We don't currently take the
* Z-compare function into account, but we could skip loading the
* Z-compare function into account, but we could skip loading the
* depthstencil for D3DCMP_NEVER and D3DCMP_ALWAYS as well. Also note
* depthstencil for D3DCMP_NEVER and D3DCMP_ALWAYS as well. Also note
* that we never copy the stencil data.*/
* that we never copy the stencil data.*/
DWORD
location
=
context
->
render_offscreen
?
SFLAG_DS_OFFSCREEN
:
SFLAG_DS_ONSCREEN
;
DWORD
location
=
context
->
render_offscreen
?
SFLAG_DS_OFFSCREEN
:
SFLAG_DS_ONSCREEN
;
if
(
state
->
render_states
[
WINED3DRS_ZWRITEENABLE
]
||
state
->
render_states
[
WINED3DRS_ZENABLE
])
if
(
state
->
render_states
[
WINED3DRS_ZWRITEENABLE
]
||
state
->
render_states
[
WINED3DRS_ZENABLE
])
{
{
IWineD3DSurfaceImpl
*
ds
=
device
->
depth_stencil
;
RECT
current_rect
,
draw_rect
,
r
;
RECT
current_rect
,
draw_rect
,
r
;
if
(
location
==
SFLAG_DS_ONSCREEN
&&
This
->
depth_stencil
!=
This
->
onscreen_depth_stencil
)
if
(
location
==
SFLAG_DS_ONSCREEN
&&
ds
!=
device
->
onscreen_depth_stencil
)
device_switch_onscreen_ds
(
This
,
context
,
This
->
depth_stencil
);
device_switch_onscreen_ds
(
device
,
context
,
ds
);
if
(
This
->
depth_stencil
->
flags
&
location
)
if
(
ds
->
flags
&
location
)
SetRect
(
&
current_rect
,
0
,
0
,
SetRect
(
&
current_rect
,
0
,
0
,
ds
->
ds_current_size
.
cx
,
ds
->
ds_current_size
.
cy
);
This
->
depth_stencil
->
ds_current_size
.
cx
,
This
->
depth_stencil
->
ds_current_size
.
cy
);
else
else
SetRectEmpty
(
&
current_rect
);
SetRectEmpty
(
&
current_rect
);
device_get_draw_rect
(
This
,
&
draw_rect
);
device_get_draw_rect
(
device
,
&
draw_rect
);
IntersectRect
(
&
r
,
&
draw_rect
,
&
current_rect
);
IntersectRect
(
&
r
,
&
draw_rect
,
&
current_rect
);
if
(
!
EqualRect
(
&
r
,
&
draw_rect
))
if
(
!
EqualRect
(
&
r
,
&
draw_rect
))
surface_load_ds_location
(
This
->
depth_stencil
,
context
,
location
);
surface_load_ds_location
(
ds
,
context
,
location
);
if
(
state
->
render_states
[
WINED3DRS_ZWRITEENABLE
])
if
(
state
->
render_states
[
WINED3DRS_ZWRITEENABLE
])
{
{
surface_modify_ds_location
(
This
->
depth_stencil
,
location
,
surface_modify_ds_location
(
ds
,
location
,
ds
->
ds_current_size
.
cx
,
ds
->
ds_current_size
.
cy
);
This
->
depth_stencil
->
ds_current_size
.
cx
,
surface_modify_location
(
ds
,
SFLAG_INDRAWABLE
,
TRUE
);
This
->
depth_stencil
->
ds_current_size
.
cy
);
surface_modify_location
(
This
->
depth_stencil
,
SFLAG_INDRAWABLE
,
TRUE
);
}
}
}
}
}
}
...
@@ -647,12 +642,12 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT
...
@@ -647,12 +642,12 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT
{
{
GLenum
glPrimType
=
state
->
gl_primitive_type
;
GLenum
glPrimType
=
state
->
gl_primitive_type
;
BOOL
emulation
=
FALSE
;
BOOL
emulation
=
FALSE
;
const
struct
wined3d_stream_info
*
stream_info
=
&
This
->
strided_streams
;
const
struct
wined3d_stream_info
*
stream_info
=
&
device
->
strided_streams
;
struct
wined3d_stream_info
stridedlcl
;
struct
wined3d_stream_info
stridedlcl
;
if
(
!
use_vs
(
state
))
if
(
!
use_vs
(
state
))
{
{
if
(
!
This
->
strided_streams
.
position_transformed
&&
context
->
num_untracked_materials
if
(
!
stream_info
->
position_transformed
&&
context
->
num_untracked_materials
&&
state
->
render_states
[
WINED3DRS_LIGHTING
])
&&
state
->
render_states
[
WINED3DRS_LIGHTING
])
{
{
static
BOOL
warned
;
static
BOOL
warned
;
...
@@ -681,12 +676,12 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT
...
@@ -681,12 +676,12 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT
if
(
emulation
)
{
if
(
emulation
)
{
stream_info
=
&
stridedlcl
;
stream_info
=
&
stridedlcl
;
memcpy
(
&
stridedlcl
,
&
This
->
strided_streams
,
sizeof
(
stridedlcl
));
memcpy
(
&
stridedlcl
,
&
device
->
strided_streams
,
sizeof
(
stridedlcl
));
remove_vbos
(
context
->
gl_info
,
state
,
&
stridedlcl
);
remove_vbos
(
context
->
gl_info
,
state
,
&
stridedlcl
);
}
}
}
}
if
(
This
->
useDrawStridedSlow
||
emulation
)
if
(
device
->
useDrawStridedSlow
||
emulation
)
{
{
/* Immediate mode drawing */
/* Immediate mode drawing */
if
(
use_vs
(
state
))
if
(
use_vs
(
state
))
...
@@ -703,11 +698,11 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT
...
@@ -703,11 +698,11 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT
}
}
else
else
{
{
drawStridedSlow
(
This
,
context
,
stream_info
,
index_count
,
drawStridedSlow
(
device
,
context
,
stream_info
,
index_count
,
glPrimType
,
idxData
,
idxSize
,
StartIdx
);
glPrimType
,
idxData
,
idxSize
,
StartIdx
);
}
}
}
}
else
if
(
This
->
instancedDraw
)
else
if
(
device
->
instancedDraw
)
{
{
/* Instancing emulation with mixing immediate mode and arrays */
/* Instancing emulation with mixing immediate mode and arrays */
drawStridedInstanced
(
context
->
gl_info
,
state
,
stream_info
,
drawStridedInstanced
(
context
->
gl_info
,
state
,
stream_info
,
...
@@ -722,9 +717,9 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT
...
@@ -722,9 +717,9 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT
/* Finished updating the screen, restore lock */
/* Finished updating the screen, restore lock */
LEAVE_GL
();
LEAVE_GL
();
for
(
i
=
0
;
i
<
This
->
num_buffer_queries
;
i
++
)
for
(
i
=
0
;
i
<
device
->
num_buffer_queries
;
++
i
)
{
{
wined3d_event_query_issue
(
This
->
buffer_queries
[
i
],
This
);
wined3d_event_query_issue
(
device
->
buffer_queries
[
i
],
device
);
}
}
if
(
wined3d_settings
.
strict_draw_ordering
)
wglFlush
();
/* Flush to ensure ordering across contexts. */
if
(
wined3d_settings
.
strict_draw_ordering
)
wglFlush
();
/* Flush to ensure ordering across contexts. */
...
@@ -734,7 +729,7 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT
...
@@ -734,7 +729,7 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT
TRACE
(
"Done all gl drawing
\n
"
);
TRACE
(
"Done all gl drawing
\n
"
);
/* Control goes back to the device, stateblock values may change again */
/* Control goes back to the device, stateblock values may change again */
This
->
isInDraw
=
FALSE
;
device
->
isInDraw
=
FALSE
;
}
}
static
void
normalize_normal
(
float
*
n
)
{
static
void
normalize_normal
(
float
*
n
)
{
...
...
dlls/wined3d/wined3d_private.h
View file @
363d8a31
...
@@ -920,7 +920,7 @@ struct wined3d_stream_info
...
@@ -920,7 +920,7 @@ struct wined3d_stream_info
*/
*/
/* Routine common to the draw primitive and draw indexed primitive routines */
/* Routine common to the draw primitive and draw indexed primitive routines */
void
drawPrimitive
(
IWineD3DDevice
*
ifa
ce
,
UINT
index_count
,
void
drawPrimitive
(
IWineD3DDevice
Impl
*
devi
ce
,
UINT
index_count
,
UINT
start_idx
,
UINT
idxBytes
,
const
void
*
idxData
)
DECLSPEC_HIDDEN
;
UINT
start_idx
,
UINT
idxBytes
,
const
void
*
idxData
)
DECLSPEC_HIDDEN
;
DWORD
get_flexible_vertex_size
(
DWORD
d3dvtVertexType
)
DECLSPEC_HIDDEN
;
DWORD
get_flexible_vertex_size
(
DWORD
d3dvtVertexType
)
DECLSPEC_HIDDEN
;
...
...
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