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
9ba4c100
Commit
9ba4c100
authored
Nov 21, 2023
by
Alex Henrie
Committed by
Alexandre Julliard
Nov 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dcompiler_43: Use CRT allocation functions.
parent
101bb94a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
125 additions
and
159 deletions
+125
-159
asmparser.c
dlls/d3dcompiler_43/asmparser.c
+13
-13
asmshader.y
dlls/d3dcompiler_43/asmshader.y
+4
-4
blob.c
dlls/d3dcompiler_43/blob.c
+9
-9
bytecodewriter.c
dlls/d3dcompiler_43/bytecodewriter.c
+38
-39
compiler.c
dlls/d3dcompiler_43/compiler.c
+12
-12
d3dcompiler_private.h
dlls/d3dcompiler_43/d3dcompiler_private.h
+0
-18
reflection.c
dlls/d3dcompiler_43/reflection.c
+47
-62
utils.c
dlls/d3dcompiler_43/utils.c
+2
-2
No files found.
dlls/d3dcompiler_43/asmparser.c
View file @
9ba4c100
...
...
@@ -1432,7 +1432,7 @@ static void gen_oldps_input(struct bwriter_shader *shader, uint32_t texcoords)
void
create_vs10_parser
(
struct
asm_parser
*
ret
)
{
TRACE_
(
parsed_shader
)(
"vs_1_0
\n
"
);
ret
->
shader
=
d3dcompiler_alloc
(
sizeof
(
*
ret
->
shader
));
ret
->
shader
=
calloc
(
1
,
sizeof
(
*
ret
->
shader
));
if
(
!
ret
->
shader
)
{
ERR
(
"Failed to allocate memory for the shader
\n
"
);
set_parse_status
(
&
ret
->
status
,
PARSE_ERR
);
...
...
@@ -1449,7 +1449,7 @@ void create_vs10_parser(struct asm_parser *ret) {
void
create_vs11_parser
(
struct
asm_parser
*
ret
)
{
TRACE_
(
parsed_shader
)(
"vs_1_1
\n
"
);
ret
->
shader
=
d3dcompiler_alloc
(
sizeof
(
*
ret
->
shader
));
ret
->
shader
=
calloc
(
1
,
sizeof
(
*
ret
->
shader
));
if
(
!
ret
->
shader
)
{
ERR
(
"Failed to allocate memory for the shader
\n
"
);
set_parse_status
(
&
ret
->
status
,
PARSE_ERR
);
...
...
@@ -1466,7 +1466,7 @@ void create_vs11_parser(struct asm_parser *ret) {
void
create_vs20_parser
(
struct
asm_parser
*
ret
)
{
TRACE_
(
parsed_shader
)(
"vs_2_0
\n
"
);
ret
->
shader
=
d3dcompiler_alloc
(
sizeof
(
*
ret
->
shader
));
ret
->
shader
=
calloc
(
1
,
sizeof
(
*
ret
->
shader
));
if
(
!
ret
->
shader
)
{
ERR
(
"Failed to allocate memory for the shader
\n
"
);
set_parse_status
(
&
ret
->
status
,
PARSE_ERR
);
...
...
@@ -1483,7 +1483,7 @@ void create_vs20_parser(struct asm_parser *ret) {
void
create_vs2x_parser
(
struct
asm_parser
*
ret
)
{
TRACE_
(
parsed_shader
)(
"vs_2_x
\n
"
);
ret
->
shader
=
d3dcompiler_alloc
(
sizeof
(
*
ret
->
shader
));
ret
->
shader
=
calloc
(
1
,
sizeof
(
*
ret
->
shader
));
if
(
!
ret
->
shader
)
{
ERR
(
"Failed to allocate memory for the shader
\n
"
);
set_parse_status
(
&
ret
->
status
,
PARSE_ERR
);
...
...
@@ -1500,7 +1500,7 @@ void create_vs2x_parser(struct asm_parser *ret) {
void
create_vs30_parser
(
struct
asm_parser
*
ret
)
{
TRACE_
(
parsed_shader
)(
"vs_3_0
\n
"
);
ret
->
shader
=
d3dcompiler_alloc
(
sizeof
(
*
ret
->
shader
));
ret
->
shader
=
calloc
(
1
,
sizeof
(
*
ret
->
shader
));
if
(
!
ret
->
shader
)
{
ERR
(
"Failed to allocate memory for the shader
\n
"
);
set_parse_status
(
&
ret
->
status
,
PARSE_ERR
);
...
...
@@ -1516,7 +1516,7 @@ void create_vs30_parser(struct asm_parser *ret) {
void
create_ps10_parser
(
struct
asm_parser
*
ret
)
{
TRACE_
(
parsed_shader
)(
"ps_1_0
\n
"
);
ret
->
shader
=
d3dcompiler_alloc
(
sizeof
(
*
ret
->
shader
));
ret
->
shader
=
calloc
(
1
,
sizeof
(
*
ret
->
shader
));
if
(
!
ret
->
shader
)
{
ERR
(
"Failed to allocate memory for the shader
\n
"
);
set_parse_status
(
&
ret
->
status
,
PARSE_ERR
);
...
...
@@ -1533,7 +1533,7 @@ void create_ps10_parser(struct asm_parser *ret) {
void
create_ps11_parser
(
struct
asm_parser
*
ret
)
{
TRACE_
(
parsed_shader
)(
"ps_1_1
\n
"
);
ret
->
shader
=
d3dcompiler_alloc
(
sizeof
(
*
ret
->
shader
));
ret
->
shader
=
calloc
(
1
,
sizeof
(
*
ret
->
shader
));
if
(
!
ret
->
shader
)
{
ERR
(
"Failed to allocate memory for the shader
\n
"
);
set_parse_status
(
&
ret
->
status
,
PARSE_ERR
);
...
...
@@ -1550,7 +1550,7 @@ void create_ps11_parser(struct asm_parser *ret) {
void
create_ps12_parser
(
struct
asm_parser
*
ret
)
{
TRACE_
(
parsed_shader
)(
"ps_1_2
\n
"
);
ret
->
shader
=
d3dcompiler_alloc
(
sizeof
(
*
ret
->
shader
));
ret
->
shader
=
calloc
(
1
,
sizeof
(
*
ret
->
shader
));
if
(
!
ret
->
shader
)
{
ERR
(
"Failed to allocate memory for the shader
\n
"
);
set_parse_status
(
&
ret
->
status
,
PARSE_ERR
);
...
...
@@ -1567,7 +1567,7 @@ void create_ps12_parser(struct asm_parser *ret) {
void
create_ps13_parser
(
struct
asm_parser
*
ret
)
{
TRACE_
(
parsed_shader
)(
"ps_1_3
\n
"
);
ret
->
shader
=
d3dcompiler_alloc
(
sizeof
(
*
ret
->
shader
));
ret
->
shader
=
calloc
(
1
,
sizeof
(
*
ret
->
shader
));
if
(
!
ret
->
shader
)
{
ERR
(
"Failed to allocate memory for the shader
\n
"
);
set_parse_status
(
&
ret
->
status
,
PARSE_ERR
);
...
...
@@ -1584,7 +1584,7 @@ void create_ps13_parser(struct asm_parser *ret) {
void
create_ps14_parser
(
struct
asm_parser
*
ret
)
{
TRACE_
(
parsed_shader
)(
"ps_1_4
\n
"
);
ret
->
shader
=
d3dcompiler_alloc
(
sizeof
(
*
ret
->
shader
));
ret
->
shader
=
calloc
(
1
,
sizeof
(
*
ret
->
shader
));
if
(
!
ret
->
shader
)
{
ERR
(
"Failed to allocate memory for the shader
\n
"
);
set_parse_status
(
&
ret
->
status
,
PARSE_ERR
);
...
...
@@ -1601,7 +1601,7 @@ void create_ps14_parser(struct asm_parser *ret) {
void
create_ps20_parser
(
struct
asm_parser
*
ret
)
{
TRACE_
(
parsed_shader
)(
"ps_2_0
\n
"
);
ret
->
shader
=
d3dcompiler_alloc
(
sizeof
(
*
ret
->
shader
));
ret
->
shader
=
calloc
(
1
,
sizeof
(
*
ret
->
shader
));
if
(
!
ret
->
shader
)
{
ERR
(
"Failed to allocate memory for the shader
\n
"
);
set_parse_status
(
&
ret
->
status
,
PARSE_ERR
);
...
...
@@ -1618,7 +1618,7 @@ void create_ps20_parser(struct asm_parser *ret) {
void
create_ps2x_parser
(
struct
asm_parser
*
ret
)
{
TRACE_
(
parsed_shader
)(
"ps_2_x
\n
"
);
ret
->
shader
=
d3dcompiler_alloc
(
sizeof
(
*
ret
->
shader
));
ret
->
shader
=
calloc
(
1
,
sizeof
(
*
ret
->
shader
));
if
(
!
ret
->
shader
)
{
ERR
(
"Failed to allocate memory for the shader
\n
"
);
set_parse_status
(
&
ret
->
status
,
PARSE_ERR
);
...
...
@@ -1635,7 +1635,7 @@ void create_ps2x_parser(struct asm_parser *ret) {
void
create_ps30_parser
(
struct
asm_parser
*
ret
)
{
TRACE_
(
parsed_shader
)(
"ps_3_0
\n
"
);
ret
->
shader
=
d3dcompiler_alloc
(
sizeof
(
*
ret
->
shader
));
ret
->
shader
=
calloc
(
1
,
sizeof
(
*
ret
->
shader
));
if
(
!
ret
->
shader
)
{
ERR
(
"Failed to allocate memory for the shader
\n
"
);
set_parse_status
(
&
ret
->
status
,
PARSE_ERR
);
...
...
dlls/d3dcompiler_43/asmshader.y
View file @
9ba4c100
...
...
@@ -49,7 +49,7 @@ static void set_rel_reg(struct shader_reg *reg, struct rel_reg *rel) {
if(!rel->has_rel_reg) {
reg->rel_reg = NULL;
} else {
reg->rel_reg =
d3dcompiler_alloc(
sizeof(*reg->rel_reg));
reg->rel_reg =
calloc(1,
sizeof(*reg->rel_reg));
if(!reg->rel_reg) {
return;
}
...
...
@@ -1718,11 +1718,11 @@ struct bwriter_shader *parse_asm_shader(char **messages)
if (asm_ctx.messages.size)
{
/* Shrink the buffer to the used size */
*messages =
d3dcompiler_
realloc(asm_ctx.messages.string, asm_ctx.messages.size + 1);
*messages = realloc(asm_ctx.messages.string, asm_ctx.messages.size + 1);
if (!*messages)
{
ERR("Out of memory, no messages reported\n");
d3dcompiler_
free(asm_ctx.messages.string);
free(asm_ctx.messages.string);
}
}
else
...
...
@@ -1733,7 +1733,7 @@ struct bwriter_shader *parse_asm_shader(char **messages)
else
{
if (asm_ctx.messages.capacity)
d3dcompiler_
free(asm_ctx.messages.string);
free(asm_ctx.messages.string);
}
return ret;
...
...
dlls/d3dcompiler_43/blob.c
View file @
9ba4c100
...
...
@@ -76,8 +76,8 @@ static ULONG STDMETHODCALLTYPE d3dcompiler_blob_Release(ID3DBlob *iface)
if
(
!
refcount
)
{
HeapFree
(
GetProcessHeap
(),
0
,
blob
->
data
);
HeapFree
(
GetProcessHeap
(),
0
,
blob
);
free
(
blob
->
data
);
free
(
blob
);
}
return
refcount
;
...
...
@@ -120,7 +120,7 @@ static HRESULT d3dcompiler_blob_init(struct d3dcompiler_blob *blob, SIZE_T data_
blob
->
refcount
=
1
;
blob
->
size
=
data_size
;
blob
->
data
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
data_size
);
blob
->
data
=
calloc
(
1
,
data_size
);
if
(
!
blob
->
data
)
{
ERR
(
"Failed to allocate D3D blob data memory
\n
"
);
...
...
@@ -143,7 +143,7 @@ HRESULT WINAPI D3DCreateBlob(SIZE_T data_size, ID3DBlob **blob)
return
D3DERR_INVALIDCALL
;
}
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
));
object
=
calloc
(
1
,
sizeof
(
*
object
));
if
(
!
object
)
return
E_OUTOFMEMORY
;
...
...
@@ -151,7 +151,7 @@ HRESULT WINAPI D3DCreateBlob(SIZE_T data_size, ID3DBlob **blob)
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize blob, hr %#lx.
\n
"
,
hr
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
free
(
object
);
return
hr
;
}
...
...
@@ -474,7 +474,7 @@ HRESULT WINAPI D3DReadFileToBlob(const WCHAR *filename, ID3DBlob **contents)
return
HRESULT_FROM_WIN32
(
GetLastError
());
}
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
{
CloseHandle
(
file
);
return
E_OUTOFMEMORY
;
...
...
@@ -484,7 +484,7 @@ HRESULT WINAPI D3DReadFileToBlob(const WCHAR *filename, ID3DBlob **contents)
{
WARN
(
"Failed to initialise blob, hr %#lx.
\n
"
,
hr
);
CloseHandle
(
file
);
heap_
free
(
object
);
free
(
object
);
return
hr
;
}
...
...
@@ -492,8 +492,8 @@ HRESULT WINAPI D3DReadFileToBlob(const WCHAR *filename, ID3DBlob **contents)
{
WARN
(
"Failed to read file contents.
\n
"
);
CloseHandle
(
file
);
heap_
free
(
object
->
data
);
heap_
free
(
object
);
free
(
object
->
data
);
free
(
object
);
return
E_FAIL
;
}
CloseHandle
(
file
);
...
...
dlls/d3dcompiler_43/bytecodewriter.c
View file @
9ba4c100
...
...
@@ -45,7 +45,7 @@ static BOOL array_reserve(void **elements, unsigned int *capacity, unsigned int
if
(
new_capacity
<
count
)
new_capacity
=
count
;
if
(
!
(
new_elements
=
d3dcompiler_
realloc
(
*
elements
,
new_capacity
*
size
)))
if
(
!
(
new_elements
=
realloc
(
*
elements
,
new_capacity
*
size
)))
{
ERR
(
"Failed to allocate memory.
\n
"
);
return
FALSE
;
...
...
@@ -71,17 +71,17 @@ static BOOL array_reserve(void **elements, unsigned int *capacity, unsigned int
* NULL in case of an allocation failure
*/
struct
instruction
*
alloc_instr
(
unsigned
int
srcs
)
{
struct
instruction
*
ret
=
d3dcompiler_alloc
(
sizeof
(
*
ret
));
struct
instruction
*
ret
=
calloc
(
1
,
sizeof
(
*
ret
));
if
(
!
ret
)
{
ERR
(
"Failed to allocate memory for an instruction structure
\n
"
);
return
NULL
;
}
if
(
srcs
)
{
ret
->
src
=
d3dcompiler_alloc
(
srcs
*
sizeof
(
*
ret
->
src
));
ret
->
src
=
calloc
(
1
,
srcs
*
sizeof
(
*
ret
->
src
));
if
(
!
ret
->
src
)
{
ERR
(
"Failed to allocate memory for instruction registers
\n
"
);
d3dcompiler_
free
(
ret
);
free
(
ret
);
return
NULL
;
}
ret
->
num_srcs
=
srcs
;
...
...
@@ -120,7 +120,7 @@ BOOL add_constF(struct bwriter_shader *shader, uint32_t reg, float x, float y, f
if
(
shader
->
num_cf
)
{
struct
constant
**
newarray
;
newarray
=
d3dcompiler_
realloc
(
shader
->
constF
,
sizeof
(
*
shader
->
constF
)
*
(
shader
->
num_cf
+
1
));
newarray
=
realloc
(
shader
->
constF
,
sizeof
(
*
shader
->
constF
)
*
(
shader
->
num_cf
+
1
));
if
(
!
newarray
)
{
ERR
(
"Failed to grow the constants array
\n
"
);
...
...
@@ -130,7 +130,7 @@ BOOL add_constF(struct bwriter_shader *shader, uint32_t reg, float x, float y, f
}
else
{
shader
->
constF
=
d3dcompiler_alloc
(
sizeof
(
*
shader
->
constF
));
shader
->
constF
=
calloc
(
1
,
sizeof
(
*
shader
->
constF
));
if
(
!
shader
->
constF
)
{
ERR
(
"Failed to allocate the constants array
\n
"
);
...
...
@@ -138,7 +138,7 @@ BOOL add_constF(struct bwriter_shader *shader, uint32_t reg, float x, float y, f
}
}
newconst
=
d3dcompiler_alloc
(
sizeof
(
*
newconst
));
newconst
=
calloc
(
1
,
sizeof
(
*
newconst
));
if
(
!
newconst
)
{
ERR
(
"Failed to allocate a new constant
\n
"
);
...
...
@@ -162,7 +162,7 @@ BOOL add_constI(struct bwriter_shader *shader, uint32_t reg, int x, int y, int z
if
(
shader
->
num_ci
)
{
struct
constant
**
newarray
;
newarray
=
d3dcompiler_
realloc
(
shader
->
constI
,
sizeof
(
*
shader
->
constI
)
*
(
shader
->
num_ci
+
1
));
newarray
=
realloc
(
shader
->
constI
,
sizeof
(
*
shader
->
constI
)
*
(
shader
->
num_ci
+
1
));
if
(
!
newarray
)
{
ERR
(
"Failed to grow the constants array
\n
"
);
...
...
@@ -172,7 +172,7 @@ BOOL add_constI(struct bwriter_shader *shader, uint32_t reg, int x, int y, int z
}
else
{
shader
->
constI
=
d3dcompiler_alloc
(
sizeof
(
*
shader
->
constI
));
shader
->
constI
=
calloc
(
1
,
sizeof
(
*
shader
->
constI
));
if
(
!
shader
->
constI
)
{
ERR
(
"Failed to allocate the constants array
\n
"
);
...
...
@@ -180,7 +180,7 @@ BOOL add_constI(struct bwriter_shader *shader, uint32_t reg, int x, int y, int z
}
}
newconst
=
d3dcompiler_alloc
(
sizeof
(
*
newconst
));
newconst
=
calloc
(
1
,
sizeof
(
*
newconst
));
if
(
!
newconst
)
{
ERR
(
"Failed to allocate a new constant
\n
"
);
...
...
@@ -204,7 +204,7 @@ BOOL add_constB(struct bwriter_shader *shader, uint32_t reg, BOOL x)
if
(
shader
->
num_cb
)
{
struct
constant
**
newarray
;
newarray
=
d3dcompiler_
realloc
(
shader
->
constB
,
sizeof
(
*
shader
->
constB
)
*
(
shader
->
num_cb
+
1
));
newarray
=
realloc
(
shader
->
constB
,
sizeof
(
*
shader
->
constB
)
*
(
shader
->
num_cb
+
1
));
if
(
!
newarray
)
{
ERR
(
"Failed to grow the constants array
\n
"
);
...
...
@@ -214,7 +214,7 @@ BOOL add_constB(struct bwriter_shader *shader, uint32_t reg, BOOL x)
}
else
{
shader
->
constB
=
d3dcompiler_alloc
(
sizeof
(
*
shader
->
constB
));
shader
->
constB
=
calloc
(
1
,
sizeof
(
*
shader
->
constB
));
if
(
!
shader
->
constB
)
{
ERR
(
"Failed to allocate the constants array
\n
"
);
...
...
@@ -222,7 +222,7 @@ BOOL add_constB(struct bwriter_shader *shader, uint32_t reg, BOOL x)
}
}
newconst
=
d3dcompiler_alloc
(
sizeof
(
*
newconst
));
newconst
=
calloc
(
1
,
sizeof
(
*
newconst
));
if
(
!
newconst
)
{
ERR
(
"Failed to allocate a new constant
\n
"
);
...
...
@@ -258,7 +258,7 @@ BOOL record_declaration(struct bwriter_shader *shader, uint32_t usage, uint32_t
if
(
*
num
==
0
)
{
*
decl
=
d3dcompiler_alloc
(
sizeof
(
**
decl
));
*
decl
=
calloc
(
1
,
sizeof
(
**
decl
));
if
(
!*
decl
)
{
ERR
(
"Error allocating declarations array
\n
"
);
...
...
@@ -276,8 +276,7 @@ BOOL record_declaration(struct bwriter_shader *shader, uint32_t usage, uint32_t
regnum
,
(
*
decl
)[
i
].
writemask
&
writemask
);
}
newdecl
=
d3dcompiler_realloc
(
*
decl
,
sizeof
(
**
decl
)
*
((
*
num
)
+
1
));
newdecl
=
realloc
(
*
decl
,
sizeof
(
**
decl
)
*
((
*
num
)
+
1
));
if
(
!
newdecl
)
{
ERR
(
"Error reallocating declarations array
\n
"
);
...
...
@@ -304,7 +303,7 @@ BOOL record_sampler(struct bwriter_shader *shader, uint32_t samptype, uint32_t m
if
(
shader
->
num_samplers
==
0
)
{
shader
->
samplers
=
d3dcompiler_alloc
(
sizeof
(
*
shader
->
samplers
));
shader
->
samplers
=
calloc
(
1
,
sizeof
(
*
shader
->
samplers
));
if
(
!
shader
->
samplers
)
{
ERR
(
"Error allocating samplers array
\n
"
);
...
...
@@ -325,7 +324,7 @@ BOOL record_sampler(struct bwriter_shader *shader, uint32_t samptype, uint32_t m
}
}
newarray
=
d3dcompiler_
realloc
(
shader
->
samplers
,
sizeof
(
*
shader
->
samplers
)
*
(
shader
->
num_samplers
+
1
));
newarray
=
realloc
(
shader
->
samplers
,
sizeof
(
*
shader
->
samplers
)
*
(
shader
->
num_samplers
+
1
));
if
(
!
newarray
)
{
ERR
(
"Error reallocating samplers array
\n
"
);
...
...
@@ -397,7 +396,7 @@ struct bc_writer
static
struct
bytecode_buffer
*
allocate_buffer
(
void
)
{
struct
bytecode_buffer
*
ret
;
ret
=
d3dcompiler_alloc
(
sizeof
(
*
ret
));
ret
=
calloc
(
1
,
sizeof
(
*
ret
));
if
(
!
ret
)
return
NULL
;
ret
->
state
=
S_OK
;
return
ret
;
...
...
@@ -2489,7 +2488,7 @@ HRESULT shader_write_bytecode(const struct bwriter_shader *shader, uint32_t **re
return
E_FAIL
;
}
if
(
!
(
writer
=
d3dcompiler_alloc
(
sizeof
(
*
writer
))))
if
(
!
(
writer
=
calloc
(
1
,
sizeof
(
*
writer
))))
return
E_OUTOFMEMORY
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
shader_backends
);
++
i
)
...
...
@@ -2507,7 +2506,7 @@ HRESULT shader_write_bytecode(const struct bwriter_shader *shader, uint32_t **re
{
FIXME
(
"Unsupported shader type %#x, version %u.%u.
\n
"
,
shader
->
type
,
shader
->
major_version
,
shader
->
minor_version
);
d3dcompiler_
free
(
writer
);
free
(
writer
);
return
E_NOTIMPL
;
}
...
...
@@ -2556,10 +2555,10 @@ HRESULT shader_write_bytecode(const struct bwriter_shader *shader, uint32_t **re
error:
if
(
buffer
)
{
d3dcompiler_
free
(
buffer
->
data
);
d3dcompiler_
free
(
buffer
);
free
(
buffer
->
data
);
free
(
buffer
);
}
d3dcompiler_
free
(
writer
);
free
(
writer
);
return
hr
;
}
...
...
@@ -2569,31 +2568,31 @@ void SlDeleteShader(struct bwriter_shader *shader) {
TRACE
(
"Deleting shader %p
\n
"
,
shader
);
for
(
i
=
0
;
i
<
shader
->
num_cf
;
i
++
)
{
d3dcompiler_
free
(
shader
->
constF
[
i
]);
free
(
shader
->
constF
[
i
]);
}
d3dcompiler_
free
(
shader
->
constF
);
free
(
shader
->
constF
);
for
(
i
=
0
;
i
<
shader
->
num_ci
;
i
++
)
{
d3dcompiler_
free
(
shader
->
constI
[
i
]);
free
(
shader
->
constI
[
i
]);
}
d3dcompiler_
free
(
shader
->
constI
);
free
(
shader
->
constI
);
for
(
i
=
0
;
i
<
shader
->
num_cb
;
i
++
)
{
d3dcompiler_
free
(
shader
->
constB
[
i
]);
free
(
shader
->
constB
[
i
]);
}
d3dcompiler_
free
(
shader
->
constB
);
free
(
shader
->
constB
);
d3dcompiler_
free
(
shader
->
inputs
);
d3dcompiler_
free
(
shader
->
outputs
);
d3dcompiler_
free
(
shader
->
samplers
);
free
(
shader
->
inputs
);
free
(
shader
->
outputs
);
free
(
shader
->
samplers
);
for
(
i
=
0
;
i
<
shader
->
num_instrs
;
i
++
)
{
for
(
j
=
0
;
j
<
shader
->
instr
[
i
]
->
num_srcs
;
j
++
)
{
d3dcompiler_
free
(
shader
->
instr
[
i
]
->
src
[
j
].
rel_reg
);
free
(
shader
->
instr
[
i
]
->
src
[
j
].
rel_reg
);
}
d3dcompiler_
free
(
shader
->
instr
[
i
]
->
src
);
d3dcompiler_
free
(
shader
->
instr
[
i
]
->
dst
.
rel_reg
);
d3dcompiler_
free
(
shader
->
instr
[
i
]);
free
(
shader
->
instr
[
i
]
->
src
);
free
(
shader
->
instr
[
i
]
->
dst
.
rel_reg
);
free
(
shader
->
instr
[
i
]);
}
d3dcompiler_
free
(
shader
->
instr
);
free
(
shader
->
instr
);
d3dcompiler_
free
(
shader
);
free
(
shader
);
}
dlls/d3dcompiler_43/compiler.c
View file @
9ba4c100
...
...
@@ -98,7 +98,7 @@ static HRESULT WINAPI d3dcompiler_include_from_file_open(ID3DInclude *iface, D3D
len
++
;
initial_dir
=
current_dir
;
}
fullpath
=
heap_
alloc
(
len
+
strlen
(
filename
)
+
1
);
fullpath
=
m
alloc
(
len
+
strlen
(
filename
)
+
1
);
if
(
!
fullpath
)
return
E_OUTOFMEMORY
;
memcpy
(
fullpath
,
initial_dir
,
len
);
...
...
@@ -113,7 +113,7 @@ static HRESULT WINAPI d3dcompiler_include_from_file_open(ID3DInclude *iface, D3D
size
=
GetFileSize
(
file
,
NULL
);
if
(
size
==
INVALID_FILE_SIZE
)
goto
error
;
buffer
=
heap_
alloc
(
size
);
buffer
=
m
alloc
(
size
);
if
(
!
buffer
)
goto
error
;
if
(
!
ReadFile
(
file
,
buffer
,
size
,
&
read
,
NULL
)
||
read
!=
size
)
...
...
@@ -122,13 +122,13 @@ static HRESULT WINAPI d3dcompiler_include_from_file_open(ID3DInclude *iface, D3D
*
bytes
=
size
;
*
data
=
buffer
;
heap_
free
(
fullpath
);
free
(
fullpath
);
CloseHandle
(
file
);
return
S_OK
;
error:
heap_
free
(
fullpath
);
heap_
free
(
buffer
);
free
(
fullpath
);
free
(
buffer
);
CloseHandle
(
file
);
WARN
(
"Returning E_FAIL.
\n
"
);
return
E_FAIL
;
...
...
@@ -136,7 +136,7 @@ error:
static
HRESULT
WINAPI
d3dcompiler_include_from_file_close
(
ID3DInclude
*
iface
,
const
void
*
data
)
{
heap_
free
((
void
*
)
data
);
free
((
void
*
)
data
);
return
S_OK
;
}
...
...
@@ -309,7 +309,7 @@ static HRESULT assemble_shader(const char *preproc_shader, ID3DBlob **shader_blo
hr
=
D3DCreateBlob
(
size
,
&
buffer
);
if
(
FAILED
(
hr
))
{
HeapFree
(
GetProcessHeap
(),
0
,
messages
);
free
(
messages
);
if
(
shader
)
SlDeleteShader
(
shader
);
return
hr
;
}
...
...
@@ -324,7 +324,7 @@ static HRESULT assemble_shader(const char *preproc_shader, ID3DBlob **shader_blo
if
(
*
error_messages
)
ID3D10Blob_Release
(
*
error_messages
);
*
error_messages
=
buffer
;
}
HeapFree
(
GetProcessHeap
(),
0
,
messages
);
free
(
messages
);
}
if
(
shader
==
NULL
)
...
...
@@ -346,14 +346,14 @@ static HRESULT assemble_shader(const char *preproc_shader, ID3DBlob **shader_blo
hr
=
D3DCreateBlob
(
size
,
&
buffer
);
if
(
FAILED
(
hr
))
{
HeapFree
(
GetProcessHeap
(),
0
,
res
);
free
(
res
);
return
hr
;
}
CopyMemory
(
ID3D10Blob_GetBufferPointer
(
buffer
),
res
,
size
);
*
shader_blob
=
buffer
;
}
HeapFree
(
GetProcessHeap
(),
0
,
res
);
free
(
res
);
return
S_OK
;
}
...
...
@@ -711,7 +711,7 @@ HRESULT WINAPI D3DCompileFromFile(const WCHAR *filename, const D3D_SHADER_MACRO
goto
end
;
}
if
(
!
(
source
=
heap_
alloc
(
source_size
)))
if
(
!
(
source
=
m
alloc
(
source_size
)))
{
hr
=
E_OUTOFMEMORY
;
goto
end
;
...
...
@@ -730,7 +730,7 @@ HRESULT WINAPI D3DCompileFromFile(const WCHAR *filename, const D3D_SHADER_MACRO
flags1
,
flags2
,
code
,
errors
);
end:
heap_
free
(
source
);
free
(
source
);
CloseHandle
(
file
);
return
hr
;
}
...
...
dlls/d3dcompiler_43/d3dcompiler_private.h
View file @
9ba4c100
...
...
@@ -25,7 +25,6 @@
#include "wine/debug.h"
#include "wine/list.h"
#include "wine/rbtree.h"
#include "wine/heap.h"
#define COBJMACROS
#include "windef.h"
...
...
@@ -153,23 +152,6 @@ struct bwriter_shader
unsigned
int
num_instrs
,
instr_alloc_size
;
};
static
inline
void
*
d3dcompiler_alloc
(
SIZE_T
size
)
{
return
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
size
);
}
static
inline
void
*
d3dcompiler_realloc
(
void
*
ptr
,
SIZE_T
size
)
{
if
(
!
ptr
)
return
d3dcompiler_alloc
(
size
);
return
HeapReAlloc
(
GetProcessHeap
(),
0
,
ptr
,
size
);
}
static
inline
BOOL
d3dcompiler_free
(
void
*
ptr
)
{
return
HeapFree
(
GetProcessHeap
(),
0
,
ptr
);
}
struct
asm_parser
;
/* This structure is only used in asmshader.y, but since the .l file accesses the semantic types
...
...
dlls/d3dcompiler_43/reflection.c
View file @
9ba4c100
This diff is collapsed.
Click to expand it.
dlls/d3dcompiler_43/utils.c
View file @
9ba4c100
...
...
@@ -533,7 +533,7 @@ void compilation_message(struct compilation_messages *msg, const char *fmt, va_l
if
(
msg
->
capacity
==
0
)
{
msg
->
string
=
d3dcompiler_alloc
(
MESSAGEBUFFER_INITIAL_SIZE
);
msg
->
string
=
calloc
(
1
,
MESSAGEBUFFER_INITIAL_SIZE
);
if
(
msg
->
string
==
NULL
)
{
ERR
(
"Error allocating memory for parser messages
\n
"
);
...
...
@@ -550,7 +550,7 @@ void compilation_message(struct compilation_messages *msg, const char *fmt, va_l
if
(
rc
<
0
||
rc
>=
msg
->
capacity
-
msg
->
size
)
{
size
=
msg
->
capacity
*
2
;
buffer
=
d3dcompiler_
realloc
(
msg
->
string
,
size
);
buffer
=
realloc
(
msg
->
string
,
size
);
if
(
buffer
==
NULL
)
{
ERR
(
"Error reallocating memory for parser messages
\n
"
);
...
...
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