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
8094c556
Commit
8094c556
authored
Jun 05, 2010
by
Matteo Bruni
Committed by
Alexandre Julliard
Jun 07, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Allow D3DXAssembleShader calls with NULL parameters.
parent
0dfedd50
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
30 deletions
+59
-30
shader.c
dlls/d3dx9_36/shader.c
+40
-30
asm.c
dlls/d3dx9_36/tests/asm.c
+19
-0
No files found.
dlls/d3dx9_36/shader.c
View file @
8094c556
...
...
@@ -411,25 +411,28 @@ HRESULT assemble_shader(const char *preprocShader, const char *preprocMessages,
TRACE
(
"Shader source:
\n
"
);
TRACE
(
"%s
\n
"
,
debugstr_a
(
preprocShader
));
size
=
(
messages
?
strlen
(
messages
)
:
0
)
+
(
preprocMessages
?
strlen
(
preprocMessages
)
:
0
)
+
1
;
hr
=
D3DXCreateBuffer
(
size
,
&
buffer
);
if
(
FAILED
(
hr
))
{
HeapFree
(
GetProcessHeap
(),
0
,
messages
);
if
(
shader
)
SlDeleteShader
(
shader
);
return
hr
;
}
pos
=
ID3DXBuffer_GetBufferPointer
(
buffer
);
if
(
preprocMessages
)
if
(
ppErrorMsgs
)
{
CopyMemory
(
pos
,
preprocMessages
,
strlen
(
preprocMessages
)
+
1
);
pos
+=
strlen
(
preprocMessages
);
}
if
(
messages
)
CopyMemory
(
pos
,
messages
,
strlen
(
messages
)
+
1
);
size
=
(
messages
?
strlen
(
messages
)
:
0
)
+
(
preprocMessages
?
strlen
(
preprocMessages
)
:
0
)
+
1
;
hr
=
D3DXCreateBuffer
(
size
,
&
buffer
);
if
(
FAILED
(
hr
))
{
HeapFree
(
GetProcessHeap
(),
0
,
messages
);
if
(
shader
)
SlDeleteShader
(
shader
);
return
hr
;
}
pos
=
ID3DXBuffer_GetBufferPointer
(
buffer
);
if
(
preprocMessages
)
{
CopyMemory
(
pos
,
preprocMessages
,
strlen
(
preprocMessages
)
+
1
);
pos
+=
strlen
(
preprocMessages
);
}
if
(
messages
)
CopyMemory
(
pos
,
messages
,
strlen
(
messages
)
+
1
);
*
ppErrorMsgs
=
buffer
;
*
ppErrorMsgs
=
buffer
;
}
HeapFree
(
GetProcessHeap
(),
0
,
messages
);
}
...
...
@@ -448,15 +451,18 @@ HRESULT assemble_shader(const char *preprocShader, const char *preprocMessages,
return
D3DXERR_INVALIDDATA
;
}
size
=
HeapSize
(
GetProcessHeap
(),
0
,
res
);
hr
=
D3DXCreateBuffer
(
size
,
&
buffer
);
if
(
FAILED
(
hr
))
if
(
ppShader
)
{
HeapFree
(
GetProcessHeap
(),
0
,
res
);
return
hr
;
size
=
HeapSize
(
GetProcessHeap
(),
0
,
res
);
hr
=
D3DXCreateBuffer
(
size
,
&
buffer
);
if
(
FAILED
(
hr
))
{
HeapFree
(
GetProcessHeap
(),
0
,
res
);
return
hr
;
}
CopyMemory
(
ID3DXBuffer_GetBufferPointer
(
buffer
),
res
,
size
);
*
ppShader
=
buffer
;
}
CopyMemory
(
ID3DXBuffer_GetBufferPointer
(
buffer
),
res
,
size
);
*
ppShader
=
buffer
;
HeapFree
(
GetProcessHeap
(),
0
,
res
);
...
...
@@ -500,7 +506,8 @@ HRESULT WINAPI D3DXAssembleShader(LPCSTR data,
}
current_include
=
include
;
*
shader
=
*
error_messages
=
NULL
;
if
(
shader
)
*
shader
=
NULL
;
if
(
error_messages
)
*
error_messages
=
NULL
;
wpp_output_size
=
wpp_output_capacity
=
0
;
wpp_output
=
NULL
;
...
...
@@ -525,11 +532,14 @@ HRESULT WINAPI D3DXAssembleShader(LPCSTR data,
TRACE
(
"Preprocessor messages:
\n
"
);
TRACE
(
"%s"
,
wpp_messages
);
size
=
strlen
(
wpp_messages
)
+
1
;
hr
=
D3DXCreateBuffer
(
size
,
&
buffer
);
if
(
FAILED
(
hr
))
goto
cleanup
;
CopyMemory
(
ID3DXBuffer_GetBufferPointer
(
buffer
),
wpp_messages
,
size
);
*
error_messages
=
buffer
;
if
(
error_messages
)
{
size
=
strlen
(
wpp_messages
)
+
1
;
hr
=
D3DXCreateBuffer
(
size
,
&
buffer
);
if
(
FAILED
(
hr
))
goto
cleanup
;
CopyMemory
(
ID3DXBuffer_GetBufferPointer
(
buffer
),
wpp_messages
,
size
);
*
error_messages
=
buffer
;
}
}
if
(
data
)
{
...
...
dlls/d3dx9_36/tests/asm.c
View file @
8094c556
...
...
@@ -1435,6 +1435,25 @@ static void assembleshader_test(void) {
}
if
(
shader
)
ID3DXBuffer_Release
(
shader
);
/* NULL messages test */
shader
=
NULL
;
hr
=
D3DXAssembleShader
(
test1
,
strlen
(
test1
),
defines
,
NULL
,
D3DXSHADER_SKIPVALIDATION
,
&
shader
,
NULL
);
ok
(
hr
==
D3D_OK
,
"NULL messages test failed with error 0x%x - %d
\n
"
,
hr
,
hr
&
0x0000FFFF
);
if
(
shader
)
ID3DXBuffer_Release
(
shader
);
/* NULL shader test */
messages
=
NULL
;
hr
=
D3DXAssembleShader
(
test1
,
strlen
(
test1
),
defines
,
NULL
,
D3DXSHADER_SKIPVALIDATION
,
NULL
,
&
messages
);
ok
(
hr
==
D3D_OK
,
"NULL shader test failed with error 0x%x - %d
\n
"
,
hr
,
hr
&
0x0000FFFF
);
if
(
messages
)
{
trace
(
"D3DXAssembleShader messages:
\n
%s"
,
(
char
*
)
ID3DXBuffer_GetBufferPointer
(
messages
));
ID3DXBuffer_Release
(
messages
);
}
/* pInclude test */
shader
=
NULL
;
messages
=
NULL
;
...
...
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