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
0fa0df78
Commit
0fa0df78
authored
Mar 27, 2008
by
Stefan Dösinger
Committed by
Alexandre Julliard
Mar 28, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d8: Reject broken normal declaration types with fixed function.
parent
a1fbd550
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
1 deletion
+57
-1
d3d8_private.h
dlls/d3d8/d3d8_private.h
+1
-0
device.c
dlls/d3d8/device.c
+17
-0
device.c
dlls/d3d8/tests/device.c
+38
-0
vertexdeclaration.c
dlls/d3d8/vertexdeclaration.c
+1
-1
No files found.
dlls/d3d8/d3d8_private.h
View file @
0fa0df78
...
...
@@ -635,6 +635,7 @@ typedef struct IDirect3DPixelShader8Impl {
*/
void
load_local_constants
(
const
DWORD
*
d3d8_elements
,
IWineD3DVertexShader
*
wined3d_vertex_shader
);
UINT
convert_to_wined3d_declaration
(
const
DWORD
*
d3d8_elements
,
DWORD
*
d3d8_elements_size
,
WINED3DVERTEXELEMENT
**
wined3d_elements
);
size_t
parse_token
(
const
DWORD
*
pToken
);
/* Callbacks */
extern
HRESULT
WINAPI
D3D8CB_CreateSurface
(
IUnknown
*
device
,
IUnknown
*
pSuperior
,
UINT
Width
,
UINT
Height
,
...
...
dlls/d3d8/device.c
View file @
0fa0df78
...
...
@@ -1522,6 +1522,23 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateVertexShader(LPDIRECT3DDEVICE8
HRESULT
hrc
=
D3D_OK
;
IDirect3DVertexShader8Impl
*
object
;
IWineD3DVertexDeclaration
*
wined3d_vertex_declaration
;
const
DWORD
*
token
=
pDeclaration
;
/* Test if the vertex declaration is valid */
while
(
D3DVSD_END
()
!=
*
token
)
{
D3DVSD_TOKENTYPE
token_type
=
((
*
token
&
D3DVSD_TOKENTYPEMASK
)
>>
D3DVSD_TOKENTYPESHIFT
);
if
(
token_type
==
D3DVSD_TOKEN_STREAMDATA
&&
!
(
token_type
&
0x10000000
))
{
DWORD
type
=
((
*
token
&
D3DVSD_DATATYPEMASK
)
>>
D3DVSD_DATATYPESHIFT
);
DWORD
reg
=
((
*
token
&
D3DVSD_VERTEXREGMASK
)
>>
D3DVSD_VERTEXREGSHIFT
);
if
(
reg
==
D3DVSDE_NORMAL
&&
type
!=
D3DVSDT_FLOAT3
&&
!
pFunction
)
{
WARN
(
"Attempt to use a non-FLOAT3 normal with the fixed function function
\n
"
);
return
D3DERR_INVALIDCALL
;
}
}
token
+=
parse_token
(
token
);
}
/* Setup a stub object for now */
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
));
...
...
dlls/d3d8/tests/device.c
View file @
0fa0df78
...
...
@@ -880,6 +880,27 @@ static void test_shader(void)
D3DVSD_REG
(
D3DVSDE_POSITION
,
D3DVSDT_FLOAT3
),
D3DVSD_END
()
};
DWORD
decl_normal_float2
[]
=
{
D3DVSD_STREAM
(
0
),
D3DVSD_REG
(
D3DVSDE_POSITION
,
D3DVSDT_FLOAT3
),
/* D3DVSDE_POSITION, Register v0 */
D3DVSD_REG
(
D3DVSDE_NORMAL
,
D3DVSDT_FLOAT2
),
/* D3DVSDE_NORMAL, Register v1 */
D3DVSD_END
()
};
DWORD
decl_normal_float4
[]
=
{
D3DVSD_STREAM
(
0
),
D3DVSD_REG
(
D3DVSDE_POSITION
,
D3DVSDT_FLOAT3
),
/* D3DVSDE_POSITION, Register v0 */
D3DVSD_REG
(
D3DVSDE_NORMAL
,
D3DVSDT_FLOAT4
),
/* D3DVSDE_NORMAL, Register v1 */
D3DVSD_END
()
};
DWORD
decl_normal_d3dcolor
[]
=
{
D3DVSD_STREAM
(
0
),
D3DVSD_REG
(
D3DVSDE_POSITION
,
D3DVSDT_FLOAT3
),
/* D3DVSDE_POSITION, Register v0 */
D3DVSD_REG
(
D3DVSDE_NORMAL
,
D3DVSDT_D3DCOLOR
),
/* D3DVSDE_NORMAL, Register v1 */
D3DVSD_END
()
};
const
DWORD
vertex_decl_size
=
sizeof
(
dwVertexDecl
);
const
DWORD
simple_vs_size
=
sizeof
(
simple_vs
);
const
DWORD
simple_ps_size
=
sizeof
(
simple_ps
);
...
...
@@ -962,6 +983,23 @@ static void test_shader(void)
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice8_GetVertexShader returned %#08x
\n
"
,
hr
);
ok
(
hTempHandle
==
0
,
"Vertex Shader %d is set, expected shader %d
\n
"
,
hTempHandle
,
0
);
/* Test a broken declaration. 3DMark2001 tries to use normals with 2 components
* First try the fixed function shader function, then a custom one
*/
hr
=
IDirect3DDevice8_CreateVertexShader
(
pDevice
,
decl_normal_float2
,
0
,
&
hVertexShader
,
0
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"IDirect3DDevice8_CreateVertexShader returned %#08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
IDirect3DDevice8_DeleteVertexShader
(
pDevice
,
hVertexShader
);
hr
=
IDirect3DDevice8_CreateVertexShader
(
pDevice
,
decl_normal_float4
,
0
,
&
hVertexShader
,
0
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"IDirect3DDevice8_CreateVertexShader returned %#08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
IDirect3DDevice8_DeleteVertexShader
(
pDevice
,
hVertexShader
);
hr
=
IDirect3DDevice8_CreateVertexShader
(
pDevice
,
decl_normal_d3dcolor
,
0
,
&
hVertexShader
,
0
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"IDirect3DDevice8_CreateVertexShader returned %#08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
IDirect3DDevice8_DeleteVertexShader
(
pDevice
,
hVertexShader
);
hr
=
IDirect3DDevice8_CreateVertexShader
(
pDevice
,
decl_normal_float2
,
simple_vs
,
&
hVertexShader
,
0
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice8_CreateVertexShader returned %#08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
IDirect3DDevice8_DeleteVertexShader
(
pDevice
,
hVertexShader
);
if
(
caps
.
PixelShaderVersion
>=
D3DPS_VERSION
(
1
,
0
))
{
/* The same with a pixel shader */
...
...
dlls/d3d8/vertexdeclaration.c
View file @
0fa0df78
...
...
@@ -118,7 +118,7 @@ static const char *debug_d3dvsde_register(D3DVSDE_REGISTER d3dvsde_register)
}
}
s
tatic
s
ize_t
parse_token
(
const
DWORD
*
pToken
)
size_t
parse_token
(
const
DWORD
*
pToken
)
{
const
DWORD
token
=
*
pToken
;
size_t
tokenlen
=
1
;
...
...
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