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
cea41b0a
Commit
cea41b0a
authored
Jun 27, 2006
by
Stefan Dösinger
Committed by
Alexandre Julliard
Jun 27, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Vertex buffer can be locked multiple times.
parent
54c85d3d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
12 deletions
+48
-12
device.c
dlls/d3d8/tests/device.c
+14
-0
vertexbuffer.c
dlls/ddraw/vertexbuffer.c
+11
-9
vertexbuffer.c
dlls/wined3d/vertexbuffer.c
+22
-3
wined3d_private.h
dlls/wined3d/wined3d_private.h
+1
-0
No files found.
dlls/d3d8/tests/device.c
View file @
cea41b0a
...
...
@@ -267,6 +267,20 @@ static void test_refcount(void)
hr
=
IDirect3DDevice8_CreateAdditionalSwapChain
(
pDevice
,
&
d3dpp
,
&
pSwapChain
);
CHECK_CALL
(
hr
,
"CreateAdditionalSwapChain"
,
pDevice
,
refcount
+
1
);
if
(
pVertexBuffer
)
{
BYTE
*
data
;
/* Vertex buffers can be locked multiple times */
hr
=
IDirect3DVertexBuffer8_Lock
(
pVertexBuffer
,
0
,
0
,
&
data
,
0
);
ok
(
hr
==
D3D_OK
,
"IDirect3DVertexBuffer8::Lock failed with %08lx
\n
"
,
hr
);
hr
=
IDirect3DVertexBuffer8_Lock
(
pVertexBuffer
,
0
,
0
,
&
data
,
0
);
ok
(
hr
==
D3D_OK
,
"IDirect3DVertexBuffer8::Lock failed with %08lx
\n
"
,
hr
);
hr
=
IDirect3DVertexBuffer8_Unlock
(
pVertexBuffer
);
ok
(
hr
==
D3D_OK
,
"IDirect3DVertexBuffer8::Unlock failed with %08lx
\n
"
,
hr
);
hr
=
IDirect3DVertexBuffer8_Unlock
(
pVertexBuffer
);
ok
(
hr
==
D3D_OK
,
"IDirect3DVertexBuffer8::Unlock failed with %08lx
\n
"
,
hr
);
}
cleanup:
if
(
pDevice
)
IUnknown_Release
(
pDevice
);
...
...
dlls/ddraw/vertexbuffer.c
View file @
cea41b0a
...
...
@@ -214,20 +214,22 @@ IDirect3DVertexBufferImpl_Lock(IDirect3DVertexBuffer7 *iface,
HRESULT
hr
;
TRACE
(
"(%p)->(%08lx,%p,%p)
\n
"
,
This
,
Flags
,
Data
,
Size
);
/* Get the size, for returning it, and for locking */
hr
=
IWineD3DVertexBuffer_GetDesc
(
This
->
wineD3DVertexBuffer
,
&
Desc
);
if
(
hr
!=
D3D_OK
)
if
(
*
Size
)
{
ERR
(
"(%p) IWineD3DVertexBuffer::GetDesc failed with hr=%08lx
\n
"
,
This
,
hr
);
return
hr
;
/* Get the size, for returning it, and for locking */
hr
=
IWineD3DVertexBuffer_GetDesc
(
This
->
wineD3DVertexBuffer
,
&
Desc
);
if
(
hr
!=
D3D_OK
)
{
ERR
(
"(%p) IWineD3DVertexBuffer::GetDesc failed with hr=%08lx
\n
"
,
This
,
hr
);
return
hr
;
}
*
Size
=
Desc
.
Size
;
}
if
(
Size
)
*
Size
=
Desc
.
Size
;
return
IWineD3DVertexBuffer_Lock
(
This
->
wineD3DVertexBuffer
,
0
/* OffsetToLock */
,
Desc
.
Size
,
0
/* SizeToLock, 0 == Full lock */
,
(
BYTE
**
)
Data
,
Flags
);
}
...
...
dlls/wined3d/vertexbuffer.c
View file @
cea41b0a
...
...
@@ -145,8 +145,9 @@ static void WINAPI IWineD3DVertexBufferImpl_PreLoad(IWineD3DVertexBuffer *if
GL_EXTCALL
(
glBindBufferARB
(
GL_ARRAY_BUFFER_ARB
,
This
->
vbo
));
checkGLcall
(
"glBindBufferARB"
);
GL_EXTCALL
(
glBufferSubDataARB
(
GL_ARRAY_BUFFER_ARB
,
0
,
This
->
resource
.
size
,
This
->
resource
.
allocatedMemory
));
checkGLcall
(
"gl
UnmapBuffer gl
BufferSubDataARB"
);
checkGLcall
(
"glBufferSubDataARB"
);
LEAVE_GL
();
/* Lock directly into the VBO in the future */
HeapFree
(
GetProcessHeap
(),
0
,
This
->
resource
.
allocatedMemory
);
This
->
resource
.
allocatedMemory
=
NULL
;
This
->
Flags
&=
~
VBFLAG_DIRTY
;
...
...
@@ -334,12 +335,21 @@ static HRESULT WINAPI IWineD3DVertexBufferImpl_Lock(IWineD3DVertexBuffer *iface
BYTE
*
data
;
TRACE
(
"(%p)->%d, %d, %p, %08lx
\n
"
,
This
,
OffsetToLock
,
SizeToLock
,
ppbData
,
Flags
);
InterlockedIncrement
(
&
This
->
lockcount
);
if
(
This
->
Flags
&
VBFLAG_DIRTY
)
{
if
(
This
->
dirtystart
>
OffsetToLock
)
This
->
dirtystart
=
OffsetToLock
;
if
(
This
->
dirtyend
<
OffsetToLock
+
SizeToLock
)
This
->
dirtyend
=
OffsetToLock
+
SizeToLock
;
if
(
SizeToLock
)
{
if
(
This
->
dirtyend
<
OffsetToLock
+
SizeToLock
)
This
->
dirtyend
=
OffsetToLock
+
SizeToLock
;
}
else
{
This
->
dirtyend
=
This
->
resource
.
size
;
}
}
else
{
This
->
dirtystart
=
OffsetToLock
;
This
->
dirtyend
=
OffsetToLock
+
SizeToLock
;
if
(
SizeToLock
)
This
->
dirtyend
=
OffsetToLock
+
SizeToLock
;
else
This
->
dirtyend
=
OffsetToLock
+
This
->
resource
.
size
;
}
if
(
This
->
resource
.
allocatedMemory
)
{
...
...
@@ -375,7 +385,16 @@ static HRESULT WINAPI IWineD3DVertexBufferImpl_Lock(IWineD3DVertexBuffer *iface
}
HRESULT
WINAPI
IWineD3DVertexBufferImpl_Unlock
(
IWineD3DVertexBuffer
*
iface
)
{
IWineD3DVertexBufferImpl
*
This
=
(
IWineD3DVertexBufferImpl
*
)
iface
;
LONG
lockcount
;
TRACE
(
"(%p)
\n
"
,
This
);
lockcount
=
InterlockedDecrement
(
&
This
->
lockcount
);
if
(
lockcount
>
0
)
{
/* Delay loading the buffer until everything is unlocked */
TRACE
(
"Ignoring the unlock
\n
"
);
return
D3D_OK
;
}
if
(
!
This
->
resource
.
allocatedMemory
)
{
ENTER_GL
();
GL_EXTCALL
(
glBindBufferARB
(
GL_ARRAY_BUFFER_ARB
,
This
->
vbo
));
...
...
dlls/wined3d/wined3d_private.h
View file @
cea41b0a
...
...
@@ -633,6 +633,7 @@ typedef struct IWineD3DVertexBufferImpl
UINT
stream
;
UINT
dirtystart
,
dirtyend
;
LONG
lockcount
;
/* Last description of the buffer */
WineDirect3DVertexStridedData
strided
;
...
...
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