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
9b0b803b
Commit
9b0b803b
authored
Aug 17, 2005
by
Oliver Stieber
Committed by
Alexandre Julliard
Aug 17, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for vertex shader constants to the stateblock.
parent
fae73a10
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
111 additions
and
19 deletions
+111
-19
device.c
dlls/wined3d/device.c
+96
-14
stateblock.c
dlls/wined3d/stateblock.c
+8
-5
wined3d_private.h
dlls/wined3d/wined3d_private.h
+7
-0
No files found.
dlls/wined3d/device.c
View file @
9b0b803b
...
...
@@ -3457,7 +3457,6 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShader(IWineD3DDevice *iface, IWineD3
* TODO: merge HAL shaders context switching from prototype
*/
return
D3D_OK
;
}
HRESULT
WINAPI
IWineD3DDeviceImpl_GetVertexShader
(
IWineD3DDevice
*
iface
,
IWineD3DVertexShader
**
ppShader
)
{
...
...
@@ -3469,43 +3468,126 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetVertexShader(IWineD3DDevice *iface, IWineD3
return
D3D_OK
;
}
HRESULT
WINAPI
IWineD3DDeviceImpl_SetVertexShaderConstantB
(
IWineD3DDevice
*
iface
,
UINT
StartRegister
,
CONST
BOOL
*
pConstantData
,
UINT
BoolCount
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
#define GET_SHADER_CONSTANT(_vertexshaderconstant, _count, _sizecount) \
int count = min(_count, MAX_VSHADER_CONSTANTS - (StartRegister + 1)); \
if (NULL == pConstantData || count < 0
/* || _count != count */
) \
return D3DERR_INVALIDCALL; \
memcpy(pConstantData, This->updateStateBlock->_vertexshaderconstant + (StartRegister * _sizecount), count * (sizeof(*pConstantData) * _sizecount));
TRACE
(
"(%p) : stub
\n
"
,
This
);
#define SET_SHADER_CONSTANT(_vertexshaderconstant, _count, _sizecount) \
int count = min(_count, MAX_VSHADER_CONSTANTS - (StartRegister + 1)); \
if (NULL == pConstantData || count < 0
/* || _count != count */
) \
return D3DERR_INVALIDCALL; \
memcpy(This->updateStateBlock->_vertexshaderconstant + (StartRegister * _sizecount), pConstantData, count * (sizeof(*pConstantData) * _sizecount)); \
This->updateStateBlock->changed.vertexShader = TRUE; \
This->updateStateBlock->set.vertexShader = TRUE;
HRESULT
WINAPI
IWineD3DDeviceImpl_SetVertexShaderConstantB
(
IWineD3DDevice
*
iface
,
UINT
StartRegister
,
CONST
BOOL
*
pConstantData
,
UINT
BoolCount
){
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
static
BOOL
showFixmes
=
TRUE
;
SET_SHADER_CONSTANT
(
vertexShaderConstantB
,
BoolCount
,
1
);
#if 0 /* TODO: a bitmasp to say which constant type we should load */
memset(This->updateStateBlock->vsibfBitmap + StartRegister, WINESHADER_CONSTANTB, BoolCount);
#endif
/* clean out the other constants? */
if
(
showFixmes
||
TRUE
)
{
FIXME
(
"(%p) : stub
\n
"
,
This
);
showFixmes
=
FALSE
;
}
return
D3D_OK
;
}
HRESULT
WINAPI
IWineD3DDeviceImpl_GetVertexShaderConstantB
(
IWineD3DDevice
*
iface
,
UINT
StartRegister
,
BOOL
*
pConstantData
,
UINT
BoolCount
)
{
HRESULT
WINAPI
IWineD3DDeviceImpl_GetVertexShaderConstantB
(
IWineD3DDevice
*
iface
,
UINT
StartRegister
,
BOOL
*
pConstantData
,
UINT
BoolCount
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
TRACE
(
"(%p) : stub
\n
"
,
This
);
static
BOOL
showFixmes
=
TRUE
;
#if 0 /* TODO: a bitmasp to say which constant type we should load */
for (i = 0; i < BoolCount; i++ ) {
if (This->updateStateBlock->vsibfBitmap[StartRegister + i] != WINESHADER_CONSTANTB) {
/* the constant for this register isn't a boolean */
return D3DERR_INVALIDCALL;
}
}
#endif
GET_SHADER_CONSTANT
(
vertexShaderConstantB
,
BoolCount
,
1
);
if
(
showFixmes
||
TRUE
)
{
FIXME
(
"(%p) : stub
\n
"
,
This
);
showFixmes
=
FALSE
;
}
return
D3D_OK
;
}
HRESULT
WINAPI
IWineD3DDeviceImpl_SetVertexShaderConstantI
(
IWineD3DDevice
*
iface
,
UINT
StartRegister
,
CONST
int
*
pConstantData
,
UINT
Vector4iCount
)
{
HRESULT
WINAPI
IWineD3DDeviceImpl_SetVertexShaderConstantI
(
IWineD3DDevice
*
iface
,
UINT
StartRegister
,
CONST
int
*
pConstantData
,
UINT
Vector4iCount
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
TRACE
(
"(%p) : stub
\n
"
,
This
);
static
BOOL
showFixmes
=
TRUE
;
#if 0 /* TODO: a bitmasp to say which constant type we should load */
memset(This->updateStateBlock->vsibfBitmap + StartRegister, WINESHADER_CONSTANTI, Vector4iCount);
#endif
SET_SHADER_CONSTANT
(
vertexShaderConstantI
,
Vector4iCount
,
4
);
/* clean out the other constants? */
if
(
showFixmes
||
TRUE
)
{
FIXME
(
"(%p) : stub
\n
"
,
This
);
showFixmes
=
FALSE
;
}
return
D3D_OK
;
}
HRESULT
WINAPI
IWineD3DDeviceImpl_GetVertexShaderConstantI
(
IWineD3DDevice
*
iface
,
UINT
StartRegister
,
int
*
pConstantData
,
UINT
Vector4iCount
)
{
HRESULT
WINAPI
IWineD3DDeviceImpl_GetVertexShaderConstantI
(
IWineD3DDevice
*
iface
,
UINT
StartRegister
,
int
*
pConstantData
,
UINT
Vector4iCount
){
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
TRACE
(
"(%p) : stub
\n
"
,
This
);
static
BOOL
showFixmes
=
TRUE
;
#if 0 /* TODO: a bitmap to say which constant type we should load */
for (i = 0; i < Vector4iCount; i++ ) {
if (This->updateStateBlock->vsibfBitmap[StartRegister + i] != WINESHADER_CONSTANTI) {
/* the constant for this register isn't a boolean */
return D3DERR_INVALIDCALL;
}
}
#endif
GET_SHADER_CONSTANT
(
vertexShaderConstantI
,
Vector4iCount
,
4
);
if
(
showFixmes
||
TRUE
)
{
FIXME
(
"(%p) : stub
\n
"
,
This
);
showFixmes
=
FALSE
;
}
return
D3D_OK
;
}
HRESULT
WINAPI
IWineD3DDeviceImpl_SetVertexShaderConstantF
(
IWineD3DDevice
*
iface
,
UINT
StartRegister
,
CONST
float
*
pConstantData
,
UINT
Vector4fCount
)
{
HRESULT
WINAPI
IWineD3DDeviceImpl_SetVertexShaderConstantF
(
IWineD3DDevice
*
iface
,
UINT
StartRegister
,
CONST
float
*
pConstantData
,
UINT
Vector4fCount
){
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
TRACE
(
"(%p) : stub
\n
"
,
This
);
static
BOOL
showFixmes
=
TRUE
;
#if 0 /* TODO: a bitmasp to say which constant type we should load */
memset(This->updateStateBlock->vsibfBitmap + StartRegister, WINESHADER_CONSTANTF, Vector4fCount);
#endif
SET_SHADER_CONSTANT
(
vertexShaderConstantF
,
Vector4fCount
,
4
);
/* clean out the other constants? */
if
(
showFixmes
)
{
TRACE
(
"(%p) : ConstantF isn't intergrated properly with the other constants.
\n
"
,
This
);
showFixmes
=
FALSE
;
}
return
D3D_OK
;
}
HRESULT
WINAPI
IWineD3DDeviceImpl_GetVertexShaderConstantF
(
IWineD3DDevice
*
iface
,
UINT
StartRegister
,
float
*
pConstantData
,
UINT
Vector4fCount
)
{
HRESULT
WINAPI
IWineD3DDeviceImpl_GetVertexShaderConstantF
(
IWineD3DDevice
*
iface
,
UINT
StartRegister
,
float
*
pConstantData
,
UINT
Vector4fCount
){
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
TRACE
(
"(%p) : stub
\n
"
,
This
);
static
BOOL
showFixmes
=
TRUE
;
#if 0 /* TODO: a bitmap to say which constant type we should load */
for (i = 0; i < Vector4fCount; i++ ) {
if (This->updateStateBlock->vsibfBitmap[StartRegister + i] != WINESHADER_CONSTANTF) {
/* the constant for this register isn't a boolean */
return D3DERR_INVALIDCALL;
}
}
#endif
GET_SHADER_CONSTANT
(
vertexShaderConstantF
,
Vector4fCount
,
4
);
if
(
showFixmes
)
{
TRACE
(
"(%p) : ConstantF isn't intergrated properly with the other constants.
\n
"
,
This
);
showFixmes
=
FALSE
;
}
return
D3D_OK
;
}
#undef SET_SHADER_CONSTANT
#undef GET_SHADER_CONSTANT
HRESULT
WINAPI
IWineD3DDeviceImpl_SetPixelShader
(
IWineD3DDevice
*
iface
,
IWineD3DPixelShader
*
pShader
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
TRACE
(
"(%p) : stub
\n
"
,
This
);
...
...
dlls/wined3d/stateblock.c
View file @
9b0b803b
...
...
@@ -152,7 +152,7 @@ HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface){
PLIGHTINFOEL
*
src
;
/* Recorded => Only update 'changed' values */
if
(
This
->
set
.
vertexShader
&&
This
->
vertexShader
!=
targetStateBlock
->
vertexShader
)
{
if
(
This
->
vertexShader
!=
targetStateBlock
->
vertexShader
)
{
This
->
vertexShader
=
targetStateBlock
->
vertexShader
;
TRACE
(
"Updating vertex shader to %p
\n
"
,
targetStateBlock
->
vertexShader
);
}
...
...
@@ -342,11 +342,14 @@ should really perform a delta so that only the changes get updated*/
toDo
=
toDo
->
next
;
}
#if 0 /*TODO: VertexShaders*/
if (This->set.vertexShader && This->changed.vertexShader)
if
(
This
->
changed
.
vertexShader
)
{
IWineD3DDevice_SetVertexShader
(
pDevice
,
This
->
vertexShader
);
/* TODO: Vertex Shader Constants */
#endif
/* TODO: Vertex Shader Constants */
IWineD3DDevice_SetVertexShaderConstantB
(
pDevice
,
0
,
This
->
vertexShaderConstantB
,
MAX_VSHADER_CONSTANTS
);
IWineD3DDevice_SetVertexShaderConstantI
(
pDevice
,
0
,
This
->
vertexShaderConstantI
,
MAX_VSHADER_CONSTANTS
);
IWineD3DDevice_SetVertexShaderConstantF
(
pDevice
,
0
,
This
->
vertexShaderConstantF
,
MAX_VSHADER_CONSTANTS
);
}
}
#if 0 /*TODO: Pixel Shaders*/
...
...
dlls/wined3d/wined3d_private.h
View file @
9b0b803b
...
...
@@ -51,6 +51,8 @@
#define MAX_CLIPPLANES D3DMAXUSERCLIPPLANES
#define MAX_LEVELS 256
#define MAX_VSHADER_CONSTANTS 96
/* Used for CreateStateBlock */
#define NUM_SAVEDPIXELSTATES_R 35
#define NUM_SAVEDPIXELSTATES_T 18
...
...
@@ -890,6 +892,11 @@ struct IWineD3DStateBlockImpl
void
*
vertexShader
;
/* @TODO: Replace void * with IWineD3DVertexShader * */
/* Vertex Shader Constants */
BOOL
vertexShaderConstantB
[
MAX_VSHADER_CONSTANTS
];
UINT
vertexShaderConstantI
[
MAX_VSHADER_CONSTANTS
*
4
];
float
vertexShaderConstantF
[
MAX_VSHADER_CONSTANTS
*
4
];
BOOL
softwareVertexProcessing
;
/* Stream Source */
...
...
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