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
d64ec66b
Commit
d64ec66b
authored
Jun 26, 2014
by
Matteo Bruni
Committed by
Alexandre Julliard
Jun 26, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Correctly set parent_data for direct includes from the main file.
parent
b5db97ac
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
1 deletion
+35
-1
shader.c
dlls/d3dx9_36/shader.c
+35
-1
No files found.
dlls/d3dx9_36/shader.c
View file @
d64ec66b
...
...
@@ -219,6 +219,20 @@ HRESULT WINAPI D3DXAssembleShader(const char *data, UINT data_len, const D3DXMAC
return
hr
;
}
static
const
void
*
main_file_data
;
static
CRITICAL_SECTION
from_file_mutex
;
static
CRITICAL_SECTION_DEBUG
from_file_mutex_debug
=
{
0
,
0
,
&
from_file_mutex
,
{
&
from_file_mutex_debug
.
ProcessLocksList
,
&
from_file_mutex_debug
.
ProcessLocksList
},
0
,
0
,
{(
DWORD_PTR
)(
__FILE__
": from_file_mutex"
)}
};
static
CRITICAL_SECTION
from_file_mutex
=
{
&
from_file_mutex_debug
,
-
1
,
0
,
0
,
0
,
0
};
/* D3DXInclude private implementation, used to implement
* D3DXAssembleShaderFromFile() from D3DXAssembleShader(). */
/* To be able to correctly resolve include search paths we have to store the
...
...
@@ -233,8 +247,15 @@ static HRESULT WINAPI d3dincludefromfile_open(ID3DXInclude *iface, D3DXINCLUDE_T
HANDLE
file
;
UINT
size
;
if
(
parent_data
!=
NULL
)
if
(
parent_data
)
{
parent_name
=
*
((
const
char
**
)
parent_data
-
1
);
}
else
{
if
(
main_file_data
)
parent_name
=
*
((
const
char
**
)
main_file_data
-
1
);
}
TRACE
(
"Looking up for include file %s, parent %s
\n
"
,
debugstr_a
(
filename
),
debugstr_a
(
parent_name
));
...
...
@@ -265,6 +286,8 @@ static HRESULT WINAPI d3dincludefromfile_open(ID3DXInclude *iface, D3DXINCLUDE_T
goto
error
;
*
data
=
buffer
+
1
;
if
(
!
main_file_data
)
main_file_data
=
*
data
;
CloseHandle
(
file
);
return
S_OK
;
...
...
@@ -280,6 +303,8 @@ static HRESULT WINAPI d3dincludefromfile_close(ID3DXInclude *iface, const void *
{
HeapFree
(
GetProcessHeap
(),
0
,
*
((
char
**
)
data
-
1
));
HeapFree
(
GetProcessHeap
(),
0
,
(
char
**
)
data
-
1
);
if
(
main_file_data
==
data
)
main_file_data
=
NULL
;
return
S_OK
;
}
...
...
@@ -339,9 +364,11 @@ HRESULT WINAPI D3DXAssembleShaderFromFileW(const WCHAR *filename, const D3DXMACR
return
E_OUTOFMEMORY
;
WideCharToMultiByte
(
CP_ACP
,
0
,
filename
,
-
1
,
filename_a
,
len
,
NULL
,
NULL
);
EnterCriticalSection
(
&
from_file_mutex
);
hr
=
ID3DXInclude_Open
(
include
,
D3D_INCLUDE_LOCAL
,
filename_a
,
NULL
,
&
buffer
,
&
len
);
if
(
FAILED
(
hr
))
{
LeaveCriticalSection
(
&
from_file_mutex
);
HeapFree
(
GetProcessHeap
(),
0
,
filename_a
);
return
D3DXERR_INVALIDDATA
;
}
...
...
@@ -349,6 +376,7 @@ HRESULT WINAPI D3DXAssembleShaderFromFileW(const WCHAR *filename, const D3DXMACR
hr
=
D3DXAssembleShader
(
buffer
,
len
,
defines
,
include
,
flags
,
shader
,
error_messages
);
ID3DXInclude_Close
(
include
,
buffer
);
LeaveCriticalSection
(
&
from_file_mutex
);
HeapFree
(
GetProcessHeap
(),
0
,
filename_a
);
return
hr
;
}
...
...
@@ -471,9 +499,11 @@ HRESULT WINAPI D3DXCompileShaderFromFileW(const WCHAR *filename, const D3DXMACRO
return
E_OUTOFMEMORY
;
WideCharToMultiByte
(
CP_ACP
,
0
,
filename
,
-
1
,
filename_a
,
filename_len
,
NULL
,
NULL
);
EnterCriticalSection
(
&
from_file_mutex
);
hr
=
ID3DXInclude_Open
(
include
,
D3D_INCLUDE_LOCAL
,
filename_a
,
NULL
,
&
buffer
,
&
len
);
if
(
FAILED
(
hr
))
{
LeaveCriticalSection
(
&
from_file_mutex
);
HeapFree
(
GetProcessHeap
(),
0
,
filename_a
);
return
D3DXERR_INVALIDDATA
;
}
...
...
@@ -487,6 +517,7 @@ HRESULT WINAPI D3DXCompileShaderFromFileW(const WCHAR *filename, const D3DXMACRO
constant_table
);
ID3DXInclude_Close
(
include
,
buffer
);
LeaveCriticalSection
(
&
from_file_mutex
);
HeapFree
(
GetProcessHeap
(),
0
,
filename_a
);
return
hr
;
}
...
...
@@ -591,9 +622,11 @@ HRESULT WINAPI D3DXPreprocessShaderFromFileW(const WCHAR *filename, const D3DXMA
return
E_OUTOFMEMORY
;
WideCharToMultiByte
(
CP_ACP
,
0
,
filename
,
-
1
,
filename_a
,
len
,
NULL
,
NULL
);
EnterCriticalSection
(
&
from_file_mutex
);
hr
=
ID3DXInclude_Open
(
include
,
D3D_INCLUDE_LOCAL
,
filename_a
,
NULL
,
&
buffer
,
&
len
);
if
(
FAILED
(
hr
))
{
LeaveCriticalSection
(
&
from_file_mutex
);
HeapFree
(
GetProcessHeap
(),
0
,
filename_a
);
return
D3DXERR_INVALIDDATA
;
}
...
...
@@ -604,6 +637,7 @@ HRESULT WINAPI D3DXPreprocessShaderFromFileW(const WCHAR *filename, const D3DXMA
(
ID3DBlob
**
)
shader
,
(
ID3DBlob
**
)
error_messages
);
ID3DXInclude_Close
(
include
,
buffer
);
LeaveCriticalSection
(
&
from_file_mutex
);
HeapFree
(
GetProcessHeap
(),
0
,
filename_a
);
return
hr
;
}
...
...
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