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
902630ef
Commit
902630ef
authored
Sep 20, 2010
by
Henri Verbeet
Committed by
Alexandre Julliard
Sep 21, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Move index buffer state to wined3d_state.
parent
153d8d43
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
39 deletions
+43
-39
device.c
dlls/wined3d/device.c
+21
-20
drawprim.c
dlls/wined3d/drawprim.c
+2
-2
state.c
dlls/wined3d/state.c
+5
-3
stateblock.c
dlls/wined3d/stateblock.c
+13
-11
wined3d_private.h
dlls/wined3d/wined3d_private.h
+2
-3
No files found.
dlls/wined3d/device.c
View file @
902630ef
...
...
@@ -2922,11 +2922,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetIndexBuffer(IWineD3DDevice *iface,
IWineD3DBuffer
*
oldIdxs
;
TRACE
(
"(%p) : Setting to %p
\n
"
,
This
,
pIndexData
);
oldIdxs
=
This
->
updateStateBlock
->
pIndexData
;
oldIdxs
=
(
IWineD3DBuffer
*
)
This
->
updateStateBlock
->
state
.
index_buffer
;
This
->
updateStateBlock
->
changed
.
indices
=
TRUE
;
This
->
updateStateBlock
->
pIndexData
=
pIndexData
;
This
->
updateStateBlock
->
IndexFm
t
=
fmt
;
This
->
updateStateBlock
->
state
.
index_buffer
=
(
struct
wined3d_buffer
*
)
pIndexData
;
This
->
updateStateBlock
->
state
.
index_forma
t
=
fmt
;
/* Handle recording of state blocks */
if
(
This
->
isRecordingState
)
{
...
...
@@ -2955,7 +2955,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetIndexBuffer(IWineD3DDevice *iface, I
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
*
ppIndexData
=
This
->
stateBlock
->
pIndexData
;
*
ppIndexData
=
(
IWineD3DBuffer
*
)
This
->
stateBlock
->
state
.
index_buffer
;
/* up ref count on ppindexdata */
if
(
*
ppIndexData
)
{
...
...
@@ -4699,13 +4699,14 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitive(IWineD3DDevice *iface, UI
static
HRESULT
WINAPI
IWineD3DDeviceImpl_DrawIndexedPrimitive
(
IWineD3DDevice
*
iface
,
UINT
startIndex
,
UINT
index_count
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
struct
wined3d_buffer
*
index_buffer
;
UINT
idxStride
=
2
;
IWineD3DBuffer
*
pIB
;
GLuint
vbo
;
pIB
=
This
->
stateBlock
->
pIndexData
;
if
(
!
pIB
)
{
index_buffer
=
This
->
stateBlock
->
state
.
index_buffer
;
if
(
!
index_buffer
)
{
/* D3D9 returns D3DERR_INVALIDCALL when DrawIndexedPrimitive is called
* without an index buffer set. (The first time at least...)
* D3D8 simply dies, but I doubt it can do much harm to return
...
...
@@ -4725,15 +4726,14 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice *if
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_INDEXBUFFER
);
This
->
stateBlock
->
state
.
user_stream
=
FALSE
;
}
vbo
=
((
struct
wined3d_buffer
*
)
pIB
)
->
buffer_object
;
vbo
=
index_buffer
->
buffer_object
;
TRACE
(
"(%p) : startIndex %u, index count %u.
\n
"
,
This
,
startIndex
,
index_count
);
if
(
This
->
stateBlock
->
IndexFmt
==
WINED3DFMT_R16_UINT
)
{
if
(
This
->
stateBlock
->
state
.
index_format
==
WINED3DFMT_R16_UINT
)
idxStride
=
2
;
}
else
{
else
idxStride
=
4
;
}
if
(
This
->
stateBlock
->
loadBaseVertexIndex
!=
This
->
stateBlock
->
baseVertexIndex
)
{
This
->
stateBlock
->
loadBaseVertexIndex
=
This
->
stateBlock
->
baseVertexIndex
;
...
...
@@ -4741,7 +4741,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice *if
}
drawPrimitive
(
iface
,
index_count
,
startIndex
,
idxStride
,
vbo
?
NULL
:
((
struct
wined3d_buffer
*
)
pIB
)
->
resource
.
allocatedMemory
);
vbo
?
NULL
:
index_buffer
->
resource
.
allocatedMemory
);
return
WINED3D_OK
;
}
...
...
@@ -4832,10 +4832,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *
/* MSDN specifies stream zero settings and index buffer must be set to NULL */
stream
->
buffer
=
NULL
;
stream
->
stride
=
0
;
ib
=
This
->
stateBlock
->
pIndexData
;
if
(
ib
)
{
ib
=
(
IWineD3DBuffer
*
)
This
->
stateBlock
->
state
.
index_buffer
;
if
(
ib
)
{
IWineD3DBuffer_Release
(
ib
);
This
->
stateBlock
->
pIndexData
=
NULL
;
This
->
stateBlock
->
state
.
index_buffer
=
NULL
;
}
/* No need to mark the stream source state dirty here. Either the app calls UP drawing again, or it has to call
* SetStreamSource to specify a vertex buffer
...
...
@@ -6640,19 +6641,19 @@ void device_resource_released(IWineD3DDeviceImpl *device, IWineD3DResource *reso
}
if
(
device
->
stateBlock
&&
device
->
stateBlock
->
pIndexData
==
(
IWineD3DB
uffer
*
)
resource
)
if
(
device
->
stateBlock
&&
device
->
stateBlock
->
state
.
index_buffer
==
(
struct
wined3d_b
uffer
*
)
resource
)
{
ERR
(
"Buffer %p is still in use by stateblock %p as index buffer.
\n
"
,
resource
,
device
->
stateBlock
);
device
->
stateBlock
->
pIndexData
=
NULL
;
device
->
stateBlock
->
state
.
index_buffer
=
NULL
;
}
if
(
device
->
updateStateBlock
!=
device
->
stateBlock
&&
device
->
updateStateBlock
->
pIndexData
==
(
IWineD3DB
uffer
*
)
resource
)
&&
device
->
updateStateBlock
->
state
.
index_buffer
==
(
struct
wined3d_b
uffer
*
)
resource
)
{
ERR
(
"Buffer %p is still in use by stateblock %p as index buffer.
\n
"
,
resource
,
device
->
updateStateBlock
);
device
->
updateStateBlock
->
pIndexData
=
NULL
;
device
->
updateStateBlock
->
state
.
index_buffer
=
NULL
;
}
break
;
...
...
dlls/wined3d/drawprim.c
View file @
902630ef
...
...
@@ -91,7 +91,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
* supported or other reason), or with user pointer drawing idxData
* will be non-NULL. */
if
(
!
idxData
)
idxData
=
buffer_get_sysmem
(
(
struct
wined3d_buffer
*
)
This
->
stateBlock
->
pIndexData
,
gl_info
);
idxData
=
buffer_get_sysmem
(
This
->
stateBlock
->
state
.
index_buffer
,
gl_info
);
if
(
idxSize
==
2
)
pIdxBufS
=
idxData
;
else
pIdxBufL
=
idxData
;
...
...
@@ -437,7 +437,7 @@ static void drawStridedSlowVs(IWineD3DDevice *iface, const struct wined3d_stream
* supported or other reason), or with user pointer drawing idxData
* will be non-NULL. */
if
(
!
idxData
)
idxData
=
buffer_get_sysmem
(
(
struct
wined3d_buffer
*
)
This
->
stateBlock
->
pIndexData
,
gl_info
);
idxData
=
buffer_get_sysmem
(
This
->
stateBlock
->
state
.
index_buffer
,
gl_info
);
if
(
idxSize
==
2
)
pIdxBufS
=
idxData
;
else
pIdxBufL
=
idxData
;
...
...
dlls/wined3d/state.c
View file @
902630ef
...
...
@@ -4950,11 +4950,13 @@ static void indexbuffer(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
{
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
if
(
stateblock
->
state
.
user_stream
||
!
stateblock
->
pIndexData
)
if
(
stateblock
->
state
.
user_stream
||
!
stateblock
->
state
.
index_buffer
)
{
GL_EXTCALL
(
glBindBufferARB
(
GL_ELEMENT_ARRAY_BUFFER_ARB
,
0
));
}
else
{
struct
wined3d_buffer
*
ib
=
(
struct
wined3d_buffer
*
)
stateblock
->
pIndexData
;
}
else
{
struct
wined3d_buffer
*
ib
=
stateblock
->
state
.
index_buffer
;
GL_EXTCALL
(
glBindBufferARB
(
GL_ELEMENT_ARRAY_BUFFER_ARB
,
ib
->
buffer_object
));
}
}
...
...
dlls/wined3d/stateblock.c
View file @
902630ef
...
...
@@ -512,7 +512,7 @@ static ULONG WINAPI IWineD3DStateBlockImpl_Release(IWineD3DStateBlock *iface) {
}
}
}
if
(
This
->
pIndexData
)
IWineD3DBuffer_Release
(
This
->
pIndexData
);
if
(
This
->
state
.
index_buffer
)
IWineD3DBuffer_Release
((
IWineD3DBuffer
*
)
This
->
state
.
index_buffer
);
if
(
This
->
state
.
vertex_shader
)
IWineD3DVertexShader_Release
((
IWineD3DVertexShader
*
)
This
->
state
.
vertex_shader
);
if
(
This
->
state
.
pixel_shader
)
IWineD3DPixelShader_Release
((
IWineD3DPixelShader
*
)
This
->
state
.
pixel_shader
);
...
...
@@ -721,18 +721,20 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
if
(
This
->
changed
.
primitive_type
)
This
->
gl_primitive_type
=
targetStateBlock
->
gl_primitive_type
;
if
(
This
->
changed
.
indices
&&
((
This
->
pIndexData
!=
targetStateBlock
->
pIndexData
)
&&
((
This
->
state
.
index_buffer
!=
targetStateBlock
->
state
.
index_buffer
)
||
(
This
->
baseVertexIndex
!=
targetStateBlock
->
baseVertexIndex
)
||
(
This
->
IndexFmt
!=
targetStateBlock
->
IndexFm
t
)))
||
(
This
->
state
.
index_format
!=
targetStateBlock
->
state
.
index_forma
t
)))
{
TRACE
(
"Updating pIndexData to %p, baseVertexIndex to %d.
\n
"
,
targetStateBlock
->
pIndexData
,
targetStateBlock
->
baseVertexIndex
);
if
(
targetStateBlock
->
pIndexData
)
IWineD3DBuffer_AddRef
(
targetStateBlock
->
pIndexData
);
if
(
This
->
pIndexData
)
IWineD3DBuffer_Release
(
This
->
pIndexData
);
This
->
pIndexData
=
targetStateBlock
->
pIndexData
;
TRACE
(
"Updating index buffer to %p, baseVertexIndex to %d.
\n
"
,
targetStateBlock
->
state
.
index_buffer
,
targetStateBlock
->
baseVertexIndex
);
if
(
targetStateBlock
->
state
.
index_buffer
)
IWineD3DBuffer_AddRef
((
IWineD3DBuffer
*
)
targetStateBlock
->
state
.
index_buffer
);
if
(
This
->
state
.
index_buffer
)
IWineD3DBuffer_Release
((
IWineD3DBuffer
*
)
This
->
state
.
index_buffer
);
This
->
state
.
index_buffer
=
targetStateBlock
->
state
.
index_buffer
;
This
->
baseVertexIndex
=
targetStateBlock
->
baseVertexIndex
;
This
->
IndexFmt
=
targetStateBlock
->
IndexFm
t
;
This
->
state
.
index_format
=
targetStateBlock
->
state
.
index_forma
t
;
}
if
(
This
->
changed
.
vertexDecl
&&
This
->
state
.
vertex_declaration
!=
targetStateBlock
->
state
.
vertex_declaration
)
...
...
@@ -998,7 +1000,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Apply(IWineD3DStateBlock *iface)
if
(
This
->
changed
.
indices
)
{
IWineD3DDevice_SetIndexBuffer
(
device
,
This
->
pIndexData
,
This
->
IndexFm
t
);
IWineD3DDevice_SetIndexBuffer
(
device
,
(
IWineD3DBuffer
*
)
This
->
state
.
index_buffer
,
This
->
state
.
index_forma
t
);
IWineD3DDevice_SetBaseVertexIndex
(
device
,
This
->
baseVertexIndex
);
}
...
...
dlls/wined3d/wined3d_private.h
View file @
902630ef
...
...
@@ -2352,6 +2352,8 @@ struct wined3d_state
IWineD3DVertexDeclarationImpl
*
vertex_declaration
;
struct
wined3d_stream_state
streams
[
MAX_STREAMS
+
1
/* tesselated pseudo-stream */
];
BOOL
user_stream
;
struct
wined3d_buffer
*
index_buffer
;
enum
wined3d_format_id
index_format
;
struct
IWineD3DVertexShaderImpl
*
vertex_shader
;
BOOL
vs_consts_b
[
MAX_CONST_B
];
...
...
@@ -2393,9 +2395,6 @@ struct IWineD3DStateBlockImpl
/* primitive type */
GLenum
gl_primitive_type
;
/* Indices */
IWineD3DBuffer
*
pIndexData
;
enum
wined3d_format_id
IndexFmt
;
INT
baseVertexIndex
;
INT
loadBaseVertexIndex
;
/* non-indexed drawing needs 0 here, indexed baseVertexIndex */
...
...
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