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
46572f68
Commit
46572f68
authored
Dec 15, 2008
by
Henri Verbeet
Committed by
Alexandre Julliard
Dec 16, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Refuse to create shaders with a NULL function.
parent
62497e87
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
18 deletions
+58
-18
device.c
dlls/d3d8/device.c
+43
-16
vertexshader.c
dlls/d3d8/vertexshader.c
+1
-1
shader.c
dlls/d3d9/tests/shader.c
+9
-1
device.c
dlls/wined3d/device.c
+5
-0
No files found.
dlls/d3d8/device.c
View file @
46572f68
...
...
@@ -1599,20 +1599,28 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateVertexShader(LPDIRECT3DDEVICE8
wined3d_vertex_declaration
=
((
IDirect3DVertexDeclaration8Impl
*
)
object
->
vertex_declaration
)
->
wined3d_vertex_declaration
;
/* Usage is missing ... Use SetRenderState to set the sw vp render state in SetVertexShader */
hrc
=
IWineD3DDevice_CreateVertexShader
(
This
->
WineD3DDevice
,
wined3d_vertex_declaration
,
pFunction
,
&
object
->
wineD3DVertexShader
,
(
IUnknown
*
)
object
);
if
(
pFunction
)
{
/* Usage is missing ... Use SetRenderState to set the sw vp render state in SetVertexShader */
hrc
=
IWineD3DDevice_CreateVertexShader
(
This
->
WineD3DDevice
,
wined3d_vertex_declaration
,
pFunction
,
&
object
->
wineD3DVertexShader
,
(
IUnknown
*
)
object
);
if
(
FAILED
(
hrc
))
{
/* free up object */
FIXME
(
"Call to IWineD3DDevice_CreateVertexShader failed
\n
"
);
free_shader_handle
(
This
,
handle
);
IDirect3DVertexDeclaration8_Release
(
object
->
vertex_declaration
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
*
ppShader
=
0
;
}
else
{
load_local_constants
(
pDeclaration
,
object
->
wineD3DVertexShader
);
TRACE
(
"(%p) : returning %p (handle %#x)
\n
"
,
This
,
object
,
*
ppShader
);
if
(
FAILED
(
hrc
))
{
/* free up object */
FIXME
(
"Call to IWineD3DDevice_CreateVertexShader failed
\n
"
);
free_shader_handle
(
This
,
handle
);
IDirect3DVertexDeclaration8_Release
(
object
->
vertex_declaration
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
*
ppShader
=
0
;
}
else
{
load_local_constants
(
pDeclaration
,
object
->
wineD3DVertexShader
);
TRACE
(
"(%p) : returning %p (handle %#x)
\n
"
,
This
,
object
,
*
ppShader
);
}
}
LeaveCriticalSection
(
&
d3d8_cs
);
return
hrc
;
...
...
@@ -1706,9 +1714,19 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShader(LPDIRECT3DDEVICE8 ifa
hrc
=
D3DERR_INVALIDCALL
;
}
else
{
IDirect3DVertexShader8Impl
*
shader
=
This
->
shader_handles
[
pShader
-
(
VS_HIGHESTFIXEDFXF
+
1
)];
IWineD3DDevice_SetVertexDeclaration
(
This
->
WineD3DDevice
,
shader
?
((
IDirect3DVertexDeclaration8Impl
*
)
shader
->
vertex_declaration
)
->
wined3d_vertex_declaration
:
NULL
);
hrc
=
IWineD3DDevice_SetVertexShader
(
This
->
WineD3DDevice
,
0
==
shader
?
NULL
:
shader
->
wineD3DVertexShader
);
if
(
shader
)
{
hrc
=
IWineD3DDevice_SetVertexDeclaration
(
This
->
WineD3DDevice
,
((
IDirect3DVertexDeclaration8Impl
*
)
shader
->
vertex_declaration
)
->
wined3d_vertex_declaration
);
if
(
SUCCEEDED
(
hrc
))
hrc
=
IWineD3DDevice_SetVertexShader
(
This
->
WineD3DDevice
,
shader
->
wineD3DVertexShader
);
}
else
{
hrc
=
IWineD3DDevice_SetVertexDeclaration
(
This
->
WineD3DDevice
,
NULL
);
if
(
SUCCEEDED
(
hrc
))
hrc
=
IWineD3DDevice_SetVertexShader
(
This
->
WineD3DDevice
,
NULL
);
}
}
}
TRACE
(
"(%p) : returning hr(%u)
\n
"
,
This
,
hrc
);
...
...
@@ -1860,7 +1878,16 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShaderFunction(LPDIRECT3DDEV
}
shader
=
This
->
shader_handles
[
pVertexShader
-
(
VS_HIGHESTFIXEDFXF
+
1
)];
hr
=
IWineD3DVertexShader_GetFunction
(
shader
->
wineD3DVertexShader
,
pData
,
pSizeOfData
);
if
(
shader
->
wineD3DVertexShader
)
{
hr
=
IWineD3DVertexShader_GetFunction
(
shader
->
wineD3DVertexShader
,
pData
,
pSizeOfData
);
}
else
{
*
pSizeOfData
=
0
;
hr
=
D3D_OK
;
}
LeaveCriticalSection
(
&
d3d8_cs
);
return
hr
;
}
...
...
dlls/d3d8/vertexshader.c
View file @
46572f68
...
...
@@ -57,7 +57,7 @@ static ULONG WINAPI IDirect3DVertexShader8Impl_Release(IDirect3DVertexShader8 *i
if
(
ref
==
0
)
{
IDirect3DVertexDeclaration8_Release
(
This
->
vertex_declaration
);
IWineD3DVertexShader_Release
(
This
->
wineD3DVertexShader
);
if
(
This
->
wineD3DVertexShader
)
IWineD3DVertexShader_Release
(
This
->
wineD3DVertexShader
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
return
ref
;
...
...
dlls/d3d9/tests/shader.c
View file @
46572f68
...
...
@@ -90,7 +90,11 @@ static void test_get_set_vertex_shader(IDirect3DDevice9 *device_ptr)
HRESULT
hret
=
0
;
int
shader_refcount
=
0
;
int
i
=
0
;
hret
=
IDirect3DDevice9_CreateVertexShader
(
device_ptr
,
NULL
,
&
shader_ptr
);
ok
(
hret
==
D3DERR_INVALIDCALL
,
"CreateVertexShader returned %#x, expected D3DERR_INVALIDCALL (%#x).
\n
"
,
hret
,
D3DERR_INVALIDCALL
);
hret
=
IDirect3DDevice9_CreateVertexShader
(
device_ptr
,
simple_vs
,
&
shader_ptr
);
ok
(
hret
==
D3D_OK
&&
shader_ptr
!=
NULL
,
"CreateVertexShader returned: hret 0x%x, shader_ptr %p. "
"Expected hret 0x%x, shader_ptr != %p. Aborting.
\n
"
,
hret
,
shader_ptr
,
D3D_OK
,
NULL
);
...
...
@@ -155,6 +159,10 @@ static void test_get_set_pixel_shader(IDirect3DDevice9 *device_ptr)
int
shader_refcount
=
0
;
int
i
=
0
;
hret
=
IDirect3DDevice9_CreatePixelShader
(
device_ptr
,
NULL
,
&
shader_ptr
);
ok
(
hret
==
D3DERR_INVALIDCALL
,
"CreatePixelShader returned %#x, expected D3DERR_INVALIDCALL (%#x).
\n
"
,
hret
,
D3DERR_INVALIDCALL
);
hret
=
IDirect3DDevice9_CreatePixelShader
(
device_ptr
,
simple_ps
,
&
shader_ptr
);
ok
(
hret
==
D3D_OK
&&
shader_ptr
!=
NULL
,
"CreatePixelShader returned: hret 0x%x, shader_ptr %p. "
"Expected hret 0x%x, shader_ptr != %p. Aborting.
\n
"
,
hret
,
shader_ptr
,
D3D_OK
,
NULL
);
...
...
dlls/wined3d/device.c
View file @
46572f68
...
...
@@ -1874,6 +1874,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *ifac
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
IWineD3DVertexShaderImpl
*
object
;
/* NOTE: impl usage is ok, this is a create */
HRESULT
hr
=
WINED3D_OK
;
if
(
!
pFunction
)
return
WINED3DERR_INVALIDCALL
;
D3DCREATESHADEROBJECTINSTANCE
(
object
,
VertexShader
)
object
->
baseShader
.
shader_ins
=
IWineD3DVertexShaderImpl_shader_ins
;
...
...
@@ -1900,6 +1903,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreatePixelShader(IWineD3DDevice *iface
IWineD3DPixelShaderImpl
*
object
;
/* NOTE: impl allowed, this is a create */
HRESULT
hr
=
WINED3D_OK
;
if
(
!
pFunction
)
return
WINED3DERR_INVALIDCALL
;
D3DCREATESHADEROBJECTINSTANCE
(
object
,
PixelShader
)
object
->
baseShader
.
shader_ins
=
IWineD3DPixelShaderImpl_shader_ins
;
hr
=
IWineD3DPixelShader_SetFunction
(
*
ppPixelShader
,
pFunction
);
...
...
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