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
6ec6c941
Commit
6ec6c941
authored
Aug 25, 2007
by
Stefan Dösinger
Committed by
Alexandre Julliard
Aug 27, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: BaseVertexIndex can be negative.
parent
cc563b9c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
9 deletions
+32
-9
device.c
dlls/d3d8/device.c
+8
-1
device.c
dlls/wined3d/device.c
+2
-2
drawprim.c
dlls/wined3d/drawprim.c
+18
-2
wined3d_private.h
dlls/wined3d/wined3d_private.h
+2
-2
wined3d_interface.h
include/wine/wined3d_interface.h
+2
-2
No files found.
dlls/d3d8/device.c
View file @
6ec6c941
...
...
@@ -1803,6 +1803,12 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetIndices(LPDIRECT3DDEVICE8 iface, I
TRACE
(
"(%p) Relay
\n
"
,
This
);
EnterCriticalSection
(
&
d3d8_cs
);
/* WineD3D takes an INT(due to d3d9), but d3d8 uses UINTs. Do I have to add a check here that
* the UINT doesn't cause an overflow in the INT? It seems rather unlikely because such large
* vertex buffers can't be created to address them with an index that requires the 32nd bit
* (4 Byte minimum vertex size * 2^31-1 -> 8 gb buffer. The index sign would be the least
* problem)
*/
IWineD3DDevice_SetBaseVertexIndex
(
This
->
WineD3DDevice
,
baseVertexIndex
);
hr
=
IWineD3DDevice_SetIndices
(
This
->
WineD3DDevice
,
pIndexData
?
((
IDirect3DIndexBuffer8Impl
*
)
pIndexData
)
->
wineD3DIndexBuffer
:
NULL
);
...
...
@@ -1822,7 +1828,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetIndices(LPDIRECT3DDEVICE8 iface, I
}
EnterCriticalSection
(
&
d3d8_cs
);
IWineD3DDevice_GetBaseVertexIndex
(
This
->
WineD3DDevice
,
pBaseVertexIndex
);
/* The case from UINT to INT is safe because d3d8 will never set negative values */
IWineD3DDevice_GetBaseVertexIndex
(
This
->
WineD3DDevice
,
(
INT
*
)
pBaseVertexIndex
);
rc
=
IWineD3DDevice_GetIndices
(
This
->
WineD3DDevice
,
&
retIndexData
);
if
(
SUCCEEDED
(
rc
)
&&
retIndexData
)
{
IWineD3DIndexBuffer_GetParent
(
retIndexData
,
(
IUnknown
**
)
ppIndexData
);
...
...
dlls/wined3d/device.c
View file @
6ec6c941
...
...
@@ -2829,7 +2829,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetIndices(IWineD3DDevice *iface, IWine
}
/* Method to offer d3d9 a simple way to set the base vertex index without messing with the index buffer */
static
HRESULT
WINAPI
IWineD3DDeviceImpl_SetBaseVertexIndex
(
IWineD3DDevice
*
iface
,
U
INT
BaseIndex
)
{
static
HRESULT
WINAPI
IWineD3DDeviceImpl_SetBaseVertexIndex
(
IWineD3DDevice
*
iface
,
INT
BaseIndex
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
BaseIndex
);
...
...
@@ -2849,7 +2849,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetBaseVertexIndex(IWineD3DDevice *ifac
return
WINED3D_OK
;
}
static
HRESULT
WINAPI
IWineD3DDeviceImpl_GetBaseVertexIndex
(
IWineD3DDevice
*
iface
,
U
INT
*
base_index
)
{
static
HRESULT
WINAPI
IWineD3DDeviceImpl_GetBaseVertexIndex
(
IWineD3DDevice
*
iface
,
INT
*
base_index
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
TRACE
(
"(%p) : base_index %p
\n
"
,
This
,
base_index
);
...
...
dlls/wined3d/drawprim.c
View file @
6ec6c941
...
...
@@ -178,6 +178,7 @@ void primitiveDeclarationConvertToStridedData(
if
(
This
->
stateBlock
->
streamSource
[
element
->
Stream
]
==
NULL
)
continue
;
stride
=
This
->
stateBlock
->
streamStride
[
element
->
Stream
];
if
(
This
->
stateBlock
->
streamIsUP
)
{
TRACE
(
"Stream is up %d, %p
\n
"
,
element
->
Stream
,
This
->
stateBlock
->
streamSource
[
element
->
Stream
]);
streamVBO
=
0
;
...
...
@@ -185,6 +186,22 @@ void primitiveDeclarationConvertToStridedData(
}
else
{
TRACE
(
"Stream isn't up %d, %p
\n
"
,
element
->
Stream
,
This
->
stateBlock
->
streamSource
[
element
->
Stream
]);
data
=
IWineD3DVertexBufferImpl_GetMemory
(
This
->
stateBlock
->
streamSource
[
element
->
Stream
],
0
,
&
streamVBO
);
/* Can't use vbo's if the base vertex index is negative. OpenGL doesn't accept negative offsets
* (or rather offsets bigger than the vbo, because the pointer is unsigned), so use system memory
* sources. In most sane cases the pointer - offset will still be > 0, otherwise it will wrap
* around to some big value. Hope that with the indices, the driver wraps it back internally. If
* not, drawStridedSlow is needed, including a vertex buffer path.
*/
if
(
This
->
stateBlock
->
loadBaseVertexIndex
<
0
)
{
WARN
(
"loadBaseVertexIndex is < 0 (%d), not using vbos
\n
"
,
This
->
stateBlock
->
loadBaseVertexIndex
);
streamVBO
=
0
;
data
=
((
IWineD3DVertexBufferImpl
*
)
This
->
stateBlock
->
streamSource
[
element
->
Stream
])
->
resource
.
allocatedMemory
;
if
(
data
+
This
->
stateBlock
->
loadBaseVertexIndex
*
stride
<
0
)
{
FIXME
(
"System memory vertex data load offset is negative!
\n
"
);
}
}
if
(
fixup
)
{
if
(
streamVBO
!=
0
)
*
fixup
=
TRUE
;
else
if
(
*
fixup
&&
!
useVertexShaderFunction
&&
...
...
@@ -195,7 +212,6 @@ void primitiveDeclarationConvertToStridedData(
}
}
}
stride
=
This
->
stateBlock
->
streamStride
[
element
->
Stream
];
data
+=
element
->
Offset
;
reg
=
element
->
Reg
;
...
...
@@ -284,7 +300,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, WineDirect3DVertexStridedData
DWORD
specularColor
=
0
;
/* Specular Color */
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
UINT
*
streamOffset
=
This
->
stateBlock
->
streamOffset
;
DWORD
SkipnStrides
=
startVertex
+
This
->
stateBlock
->
loadBaseVertexIndex
;
long
SkipnStrides
=
startVertex
+
This
->
stateBlock
->
loadBaseVertexIndex
;
BYTE
*
texCoords
[
WINED3DDP_MAXTEXCOORD
];
BYTE
*
diffuse
=
NULL
,
*
specular
=
NULL
,
*
normal
=
NULL
,
*
position
=
NULL
;
...
...
dlls/wined3d/wined3d_private.h
View file @
6ec6c941
...
...
@@ -1343,8 +1343,8 @@ struct IWineD3DStateBlockImpl
/* Indices */
IWineD3DIndexBuffer
*
pIndexData
;
UINT
baseVertexIndex
;
UINT
loadBaseVertexIndex
;
/* non-indexed drawing needs 0 here, indexed baseVertexIndex */
INT
baseVertexIndex
;
INT
loadBaseVertexIndex
;
/* non-indexed drawing needs 0 here, indexed baseVertexIndex */
/* Transform */
WINED3DMATRIX
transforms
[
HIGHEST_TRANSFORMSTATE
+
1
];
...
...
include/wine/wined3d_interface.h
View file @
6ec6c941
...
...
@@ -405,8 +405,8 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase)
STDMETHOD_
(
void
,
GetGammaRamp
)(
THIS_
UINT
iSwapChain
,
WINED3DGAMMARAMP
*
pRamp
)
PURE
;
STDMETHOD
(
SetIndices
)(
THIS_
struct
IWineD3DIndexBuffer
*
pIndexData
)
PURE
;
STDMETHOD
(
GetIndices
)(
THIS_
struct
IWineD3DIndexBuffer
**
ppIndexData
)
PURE
;
STDMETHOD
(
SetBaseVertexIndex
)(
THIS_
U
INT
baseIndex
);
STDMETHOD
(
GetBaseVertexIndex
)(
THIS_
U
INT
*
baseIndex
);
STDMETHOD
(
SetBaseVertexIndex
)(
THIS_
INT
baseIndex
);
STDMETHOD
(
GetBaseVertexIndex
)(
THIS_
INT
*
baseIndex
);
STDMETHOD
(
SetLight
)(
THIS_
DWORD
Index
,
CONST
WINED3DLIGHT
*
pLight
)
PURE
;
STDMETHOD
(
GetLight
)(
THIS_
DWORD
Index
,
WINED3DLIGHT
*
pLight
)
PURE
;
STDMETHOD
(
SetLightEnable
)(
THIS_
DWORD
Index
,
BOOL
Enable
)
PURE
;
...
...
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