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
491d0e9d
Commit
491d0e9d
authored
May 08, 2012
by
Matteo Bruni
Committed by
Alexandre Julliard
May 08, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dcompiler: Rename asm_alloc/realloc/free functions to more generic names.
parent
e2866d6f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
77 additions
and
67 deletions
+77
-67
asmparser.c
dlls/d3dcompiler_43/asmparser.c
+13
-13
asmshader.y
dlls/d3dcompiler_43/asmshader.y
+13
-7
bytecodewriter.c
dlls/d3dcompiler_43/bytecodewriter.c
+42
-42
d3dcompiler_private.h
dlls/d3dcompiler_43/d3dcompiler_private.h
+7
-3
utils.c
dlls/d3dcompiler_43/utils.c
+2
-2
No files found.
dlls/d3dcompiler_43/asmparser.c
View file @
491d0e9d
...
...
@@ -1350,7 +1350,7 @@ static void gen_oldps_input(struct bwriter_shader *shader, DWORD texcoords) {
void
create_vs10_parser
(
struct
asm_parser
*
ret
)
{
TRACE_
(
parsed_shader
)(
"vs_1_0
\n
"
);
ret
->
shader
=
asm
_alloc
(
sizeof
(
*
ret
->
shader
));
ret
->
shader
=
d3dcompiler
_alloc
(
sizeof
(
*
ret
->
shader
));
if
(
!
ret
->
shader
)
{
ERR
(
"Failed to allocate memory for the shader
\n
"
);
set_parse_status
(
&
ret
->
status
,
PARSE_ERR
);
...
...
@@ -1366,7 +1366,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
=
asm
_alloc
(
sizeof
(
*
ret
->
shader
));
ret
->
shader
=
d3dcompiler
_alloc
(
sizeof
(
*
ret
->
shader
));
if
(
!
ret
->
shader
)
{
ERR
(
"Failed to allocate memory for the shader
\n
"
);
set_parse_status
(
&
ret
->
status
,
PARSE_ERR
);
...
...
@@ -1382,7 +1382,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
=
asm
_alloc
(
sizeof
(
*
ret
->
shader
));
ret
->
shader
=
d3dcompiler
_alloc
(
sizeof
(
*
ret
->
shader
));
if
(
!
ret
->
shader
)
{
ERR
(
"Failed to allocate memory for the shader
\n
"
);
set_parse_status
(
&
ret
->
status
,
PARSE_ERR
);
...
...
@@ -1398,7 +1398,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
=
asm
_alloc
(
sizeof
(
*
ret
->
shader
));
ret
->
shader
=
d3dcompiler
_alloc
(
sizeof
(
*
ret
->
shader
));
if
(
!
ret
->
shader
)
{
ERR
(
"Failed to allocate memory for the shader
\n
"
);
set_parse_status
(
&
ret
->
status
,
PARSE_ERR
);
...
...
@@ -1414,7 +1414,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
=
asm
_alloc
(
sizeof
(
*
ret
->
shader
));
ret
->
shader
=
d3dcompiler
_alloc
(
sizeof
(
*
ret
->
shader
));
if
(
!
ret
->
shader
)
{
ERR
(
"Failed to allocate memory for the shader
\n
"
);
set_parse_status
(
&
ret
->
status
,
PARSE_ERR
);
...
...
@@ -1429,7 +1429,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
=
asm
_alloc
(
sizeof
(
*
ret
->
shader
));
ret
->
shader
=
d3dcompiler
_alloc
(
sizeof
(
*
ret
->
shader
));
if
(
!
ret
->
shader
)
{
ERR
(
"Failed to allocate memory for the shader
\n
"
);
set_parse_status
(
&
ret
->
status
,
PARSE_ERR
);
...
...
@@ -1445,7 +1445,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
=
asm
_alloc
(
sizeof
(
*
ret
->
shader
));
ret
->
shader
=
d3dcompiler
_alloc
(
sizeof
(
*
ret
->
shader
));
if
(
!
ret
->
shader
)
{
ERR
(
"Failed to allocate memory for the shader
\n
"
);
set_parse_status
(
&
ret
->
status
,
PARSE_ERR
);
...
...
@@ -1461,7 +1461,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
=
asm
_alloc
(
sizeof
(
*
ret
->
shader
));
ret
->
shader
=
d3dcompiler
_alloc
(
sizeof
(
*
ret
->
shader
));
if
(
!
ret
->
shader
)
{
ERR
(
"Failed to allocate memory for the shader
\n
"
);
set_parse_status
(
&
ret
->
status
,
PARSE_ERR
);
...
...
@@ -1477,7 +1477,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
=
asm
_alloc
(
sizeof
(
*
ret
->
shader
));
ret
->
shader
=
d3dcompiler
_alloc
(
sizeof
(
*
ret
->
shader
));
if
(
!
ret
->
shader
)
{
ERR
(
"Failed to allocate memory for the shader
\n
"
);
set_parse_status
(
&
ret
->
status
,
PARSE_ERR
);
...
...
@@ -1493,7 +1493,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
=
asm
_alloc
(
sizeof
(
*
ret
->
shader
));
ret
->
shader
=
d3dcompiler
_alloc
(
sizeof
(
*
ret
->
shader
));
if
(
!
ret
->
shader
)
{
ERR
(
"Failed to allocate memory for the shader
\n
"
);
set_parse_status
(
&
ret
->
status
,
PARSE_ERR
);
...
...
@@ -1509,7 +1509,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
=
asm
_alloc
(
sizeof
(
*
ret
->
shader
));
ret
->
shader
=
d3dcompiler
_alloc
(
sizeof
(
*
ret
->
shader
));
if
(
!
ret
->
shader
)
{
ERR
(
"Failed to allocate memory for the shader
\n
"
);
set_parse_status
(
&
ret
->
status
,
PARSE_ERR
);
...
...
@@ -1525,7 +1525,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
=
asm
_alloc
(
sizeof
(
*
ret
->
shader
));
ret
->
shader
=
d3dcompiler
_alloc
(
sizeof
(
*
ret
->
shader
));
if
(
!
ret
->
shader
)
{
ERR
(
"Failed to allocate memory for the shader
\n
"
);
set_parse_status
(
&
ret
->
status
,
PARSE_ERR
);
...
...
@@ -1541,7 +1541,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
=
asm
_alloc
(
sizeof
(
*
ret
->
shader
));
ret
->
shader
=
d3dcompiler
_alloc
(
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 @
491d0e9d
...
...
@@ -51,7 +51,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 =
asm
_alloc(sizeof(*reg->rel_reg));
reg->rel_reg =
d3dcompiler
_alloc(sizeof(*reg->rel_reg));
if(!reg->rel_reg) {
return;
}
...
...
@@ -1693,16 +1693,22 @@ struct bwriter_shader *parse_asm_shader(char **messages)
if (asm_ctx.messages.size)
{
/* Shrink the buffer to the used size */
*messages = asm_realloc(asm_ctx.messages.string, asm_ctx.messages.size + 1);
if(!*messages) {
*messages = d3dcompiler_realloc(asm_ctx.messages.string, asm_ctx.messages.size + 1);
if (!*messages)
{
ERR("Out of memory, no messages reported\n");
asm
_free(asm_ctx.messages.string);
d3dcompiler
_free(asm_ctx.messages.string);
}
} else {
}
else
{
*messages = NULL;
}
} else {
if(asm_ctx.messages.capacity) asm_free(asm_ctx.messages.string);
}
else
{
if (asm_ctx.messages.capacity)
d3dcompiler_free(asm_ctx.messages.string);
}
return ret;
...
...
dlls/d3dcompiler_43/bytecodewriter.c
View file @
491d0e9d
...
...
@@ -44,17 +44,17 @@ WINE_DEFAULT_DEBUG_CHANNEL(asmshader);
* NULL in case of an allocation failure
*/
struct
instruction
*
alloc_instr
(
unsigned
int
srcs
)
{
struct
instruction
*
ret
=
asm
_alloc
(
sizeof
(
*
ret
));
struct
instruction
*
ret
=
d3dcompiler
_alloc
(
sizeof
(
*
ret
));
if
(
!
ret
)
{
ERR
(
"Failed to allocate memory for an instruction structure
\n
"
);
return
NULL
;
}
if
(
srcs
)
{
ret
->
src
=
asm
_alloc
(
srcs
*
sizeof
(
*
ret
->
src
));
ret
->
src
=
d3dcompiler
_alloc
(
srcs
*
sizeof
(
*
ret
->
src
));
if
(
!
ret
->
src
)
{
ERR
(
"Failed to allocate memory for instruction registers
\n
"
);
asm
_free
(
ret
);
d3dcompiler
_free
(
ret
);
return
NULL
;
}
ret
->
num_srcs
=
srcs
;
...
...
@@ -80,14 +80,14 @@ BOOL add_instruction(struct bwriter_shader *shader, struct instruction *instr) {
if
(
!
shader
)
return
FALSE
;
if
(
shader
->
instr_alloc_size
==
0
)
{
shader
->
instr
=
asm
_alloc
(
sizeof
(
*
shader
->
instr
)
*
INSTRARRAY_INITIAL_SIZE
);
shader
->
instr
=
d3dcompiler
_alloc
(
sizeof
(
*
shader
->
instr
)
*
INSTRARRAY_INITIAL_SIZE
);
if
(
!
shader
->
instr
)
{
ERR
(
"Failed to allocate the shader instruction array
\n
"
);
return
FALSE
;
}
shader
->
instr_alloc_size
=
INSTRARRAY_INITIAL_SIZE
;
}
else
if
(
shader
->
instr_alloc_size
==
shader
->
num_instrs
)
{
new_instructions
=
asm
_realloc
(
shader
->
instr
,
new_instructions
=
d3dcompiler
_realloc
(
shader
->
instr
,
sizeof
(
*
shader
->
instr
)
*
(
shader
->
instr_alloc_size
)
*
2
);
if
(
!
new_instructions
)
{
ERR
(
"Failed to grow the shader instruction array
\n
"
);
...
...
@@ -110,7 +110,7 @@ BOOL add_constF(struct bwriter_shader *shader, DWORD reg, float x, float y, floa
if
(
shader
->
num_cf
)
{
struct
constant
**
newarray
;
newarray
=
asm
_realloc
(
shader
->
constF
,
newarray
=
d3dcompiler
_realloc
(
shader
->
constF
,
sizeof
(
*
shader
->
constF
)
*
(
shader
->
num_cf
+
1
));
if
(
!
newarray
)
{
ERR
(
"Failed to grow the constants array
\n
"
);
...
...
@@ -118,14 +118,14 @@ BOOL add_constF(struct bwriter_shader *shader, DWORD reg, float x, float y, floa
}
shader
->
constF
=
newarray
;
}
else
{
shader
->
constF
=
asm
_alloc
(
sizeof
(
*
shader
->
constF
));
shader
->
constF
=
d3dcompiler
_alloc
(
sizeof
(
*
shader
->
constF
));
if
(
!
shader
->
constF
)
{
ERR
(
"Failed to allocate the constants array
\n
"
);
return
FALSE
;
}
}
newconst
=
asm
_alloc
(
sizeof
(
*
newconst
));
newconst
=
d3dcompiler
_alloc
(
sizeof
(
*
newconst
));
if
(
!
newconst
)
{
ERR
(
"Failed to allocate a new constant
\n
"
);
return
FALSE
;
...
...
@@ -146,7 +146,7 @@ BOOL add_constI(struct bwriter_shader *shader, DWORD reg, INT x, INT y, INT z, I
if
(
shader
->
num_ci
)
{
struct
constant
**
newarray
;
newarray
=
asm
_realloc
(
shader
->
constI
,
newarray
=
d3dcompiler
_realloc
(
shader
->
constI
,
sizeof
(
*
shader
->
constI
)
*
(
shader
->
num_ci
+
1
));
if
(
!
newarray
)
{
ERR
(
"Failed to grow the constants array
\n
"
);
...
...
@@ -154,14 +154,14 @@ BOOL add_constI(struct bwriter_shader *shader, DWORD reg, INT x, INT y, INT z, I
}
shader
->
constI
=
newarray
;
}
else
{
shader
->
constI
=
asm
_alloc
(
sizeof
(
*
shader
->
constI
));
shader
->
constI
=
d3dcompiler
_alloc
(
sizeof
(
*
shader
->
constI
));
if
(
!
shader
->
constI
)
{
ERR
(
"Failed to allocate the constants array
\n
"
);
return
FALSE
;
}
}
newconst
=
asm
_alloc
(
sizeof
(
*
newconst
));
newconst
=
d3dcompiler
_alloc
(
sizeof
(
*
newconst
));
if
(
!
newconst
)
{
ERR
(
"Failed to allocate a new constant
\n
"
);
return
FALSE
;
...
...
@@ -182,7 +182,7 @@ BOOL add_constB(struct bwriter_shader *shader, DWORD reg, BOOL x) {
if
(
shader
->
num_cb
)
{
struct
constant
**
newarray
;
newarray
=
asm
_realloc
(
shader
->
constB
,
newarray
=
d3dcompiler
_realloc
(
shader
->
constB
,
sizeof
(
*
shader
->
constB
)
*
(
shader
->
num_cb
+
1
));
if
(
!
newarray
)
{
ERR
(
"Failed to grow the constants array
\n
"
);
...
...
@@ -190,14 +190,14 @@ BOOL add_constB(struct bwriter_shader *shader, DWORD reg, BOOL x) {
}
shader
->
constB
=
newarray
;
}
else
{
shader
->
constB
=
asm
_alloc
(
sizeof
(
*
shader
->
constB
));
shader
->
constB
=
d3dcompiler
_alloc
(
sizeof
(
*
shader
->
constB
));
if
(
!
shader
->
constB
)
{
ERR
(
"Failed to allocate the constants array
\n
"
);
return
FALSE
;
}
}
newconst
=
asm
_alloc
(
sizeof
(
*
newconst
));
newconst
=
d3dcompiler
_alloc
(
sizeof
(
*
newconst
));
if
(
!
newconst
)
{
ERR
(
"Failed to allocate a new constant
\n
"
);
return
FALSE
;
...
...
@@ -228,7 +228,7 @@ BOOL record_declaration(struct bwriter_shader *shader, DWORD usage,
}
if
(
*
num
==
0
)
{
*
decl
=
asm
_alloc
(
sizeof
(
**
decl
));
*
decl
=
d3dcompiler
_alloc
(
sizeof
(
**
decl
));
if
(
!*
decl
)
{
ERR
(
"Error allocating declarations array
\n
"
);
return
FALSE
;
...
...
@@ -242,7 +242,7 @@ BOOL record_declaration(struct bwriter_shader *shader, DWORD usage,
}
}
newdecl
=
asm
_realloc
(
*
decl
,
newdecl
=
d3dcompiler
_realloc
(
*
decl
,
sizeof
(
**
decl
)
*
((
*
num
)
+
1
));
if
(
!
newdecl
)
{
ERR
(
"Error reallocating declarations array
\n
"
);
...
...
@@ -267,7 +267,7 @@ BOOL record_sampler(struct bwriter_shader *shader, DWORD samptype, DWORD mod, DW
if
(
!
shader
)
return
FALSE
;
if
(
shader
->
num_samplers
==
0
)
{
shader
->
samplers
=
asm
_alloc
(
sizeof
(
*
shader
->
samplers
));
shader
->
samplers
=
d3dcompiler
_alloc
(
sizeof
(
*
shader
->
samplers
));
if
(
!
shader
->
samplers
)
{
ERR
(
"Error allocating samplers array
\n
"
);
return
FALSE
;
...
...
@@ -284,7 +284,7 @@ BOOL record_sampler(struct bwriter_shader *shader, DWORD samptype, DWORD mod, DW
}
}
newarray
=
asm
_realloc
(
shader
->
samplers
,
newarray
=
d3dcompiler
_realloc
(
shader
->
samplers
,
sizeof
(
*
shader
->
samplers
)
*
(
shader
->
num_samplers
+
1
));
if
(
!
newarray
)
{
ERR
(
"Error reallocating samplers array
\n
"
);
...
...
@@ -310,13 +310,13 @@ BOOL record_sampler(struct bwriter_shader *shader, DWORD samptype, DWORD mod, DW
static
struct
bytecode_buffer
*
allocate_buffer
(
void
)
{
struct
bytecode_buffer
*
ret
;
ret
=
asm
_alloc
(
sizeof
(
*
ret
));
ret
=
d3dcompiler
_alloc
(
sizeof
(
*
ret
));
if
(
!
ret
)
return
NULL
;
ret
->
alloc_size
=
BYTECODEBUFFER_INITIAL_SIZE
;
ret
->
data
=
asm
_alloc
(
sizeof
(
DWORD
)
*
ret
->
alloc_size
);
ret
->
data
=
d3dcompiler
_alloc
(
sizeof
(
DWORD
)
*
ret
->
alloc_size
);
if
(
!
ret
->
data
)
{
asm
_free
(
ret
);
d3dcompiler
_free
(
ret
);
return
NULL
;
}
ret
->
state
=
S_OK
;
...
...
@@ -329,7 +329,7 @@ static void put_dword(struct bytecode_buffer *buffer, DWORD value) {
if
(
buffer
->
alloc_size
==
buffer
->
size
)
{
DWORD
*
newarray
;
buffer
->
alloc_size
*=
2
;
newarray
=
asm
_realloc
(
buffer
->
data
,
newarray
=
d3dcompiler
_realloc
(
buffer
->
data
,
sizeof
(
DWORD
)
*
buffer
->
alloc_size
);
if
(
!
newarray
)
{
ERR
(
"Failed to grow the buffer data memory
\n
"
);
...
...
@@ -2405,7 +2405,7 @@ static void init_ps30_dx9_writer(struct bc_writer *writer) {
}
static
struct
bc_writer
*
create_writer
(
DWORD
version
,
DWORD
dxversion
)
{
struct
bc_writer
*
ret
=
asm
_alloc
(
sizeof
(
*
ret
));
struct
bc_writer
*
ret
=
d3dcompiler
_alloc
(
sizeof
(
*
ret
));
if
(
!
ret
)
{
WARN
(
"Failed to allocate a bytecode writer instance
\n
"
);
...
...
@@ -2517,7 +2517,7 @@ static struct bc_writer *create_writer(DWORD version, DWORD dxversion) {
return
ret
;
fail:
asm
_free
(
ret
);
d3dcompiler
_free
(
ret
);
return
NULL
;
}
...
...
@@ -2611,7 +2611,7 @@ DWORD SlWriteBytecode(const struct bwriter_shader *shader, int dxversion, DWORD
}
/* Cut off unneeded memory from the result buffer */
*
result
=
asm
_realloc
(
buffer
->
data
,
*
result
=
d3dcompiler
_realloc
(
buffer
->
data
,
sizeof
(
DWORD
)
*
buffer
->
size
);
if
(
!*
result
)
{
*
result
=
buffer
->
data
;
...
...
@@ -2621,10 +2621,10 @@ DWORD SlWriteBytecode(const struct bwriter_shader *shader, int dxversion, DWORD
error:
if
(
buffer
)
{
asm
_free
(
buffer
->
data
);
asm
_free
(
buffer
);
d3dcompiler
_free
(
buffer
->
data
);
d3dcompiler
_free
(
buffer
);
}
asm
_free
(
writer
);
d3dcompiler
_free
(
writer
);
return
hr
;
}
...
...
@@ -2634,30 +2634,30 @@ void SlDeleteShader(struct bwriter_shader *shader) {
TRACE
(
"Deleting shader %p
\n
"
,
shader
);
for
(
i
=
0
;
i
<
shader
->
num_cf
;
i
++
)
{
asm
_free
(
shader
->
constF
[
i
]);
d3dcompiler
_free
(
shader
->
constF
[
i
]);
}
asm
_free
(
shader
->
constF
);
d3dcompiler
_free
(
shader
->
constF
);
for
(
i
=
0
;
i
<
shader
->
num_ci
;
i
++
)
{
asm
_free
(
shader
->
constI
[
i
]);
d3dcompiler
_free
(
shader
->
constI
[
i
]);
}
asm
_free
(
shader
->
constI
);
d3dcompiler
_free
(
shader
->
constI
);
for
(
i
=
0
;
i
<
shader
->
num_cb
;
i
++
)
{
asm
_free
(
shader
->
constB
[
i
]);
d3dcompiler
_free
(
shader
->
constB
[
i
]);
}
asm
_free
(
shader
->
constB
);
d3dcompiler
_free
(
shader
->
constB
);
asm
_free
(
shader
->
inputs
);
asm
_free
(
shader
->
outputs
);
asm
_free
(
shader
->
samplers
);
d3dcompiler
_free
(
shader
->
inputs
);
d3dcompiler
_free
(
shader
->
outputs
);
d3dcompiler
_free
(
shader
->
samplers
);
for
(
i
=
0
;
i
<
shader
->
num_instrs
;
i
++
)
{
for
(
j
=
0
;
j
<
shader
->
instr
[
i
]
->
num_srcs
;
j
++
)
{
asm
_free
(
shader
->
instr
[
i
]
->
src
[
j
].
rel_reg
);
d3dcompiler
_free
(
shader
->
instr
[
i
]
->
src
[
j
].
rel_reg
);
}
asm
_free
(
shader
->
instr
[
i
]
->
src
);
asm
_free
(
shader
->
instr
[
i
]);
d3dcompiler
_free
(
shader
->
instr
[
i
]
->
src
);
d3dcompiler
_free
(
shader
->
instr
[
i
]);
}
asm
_free
(
shader
->
instr
);
d3dcompiler
_free
(
shader
->
instr
);
asm
_free
(
shader
);
d3dcompiler
_free
(
shader
);
}
dlls/d3dcompiler_43/d3dcompiler_private.h
View file @
491d0e9d
...
...
@@ -2,6 +2,7 @@
* Copyright 2008 Stefan Dösinger
* Copyright 2009 Matteo Bruni
* Copyright 2010 Rico Schüller
* Copyright 2012 Matteo Bruni for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -138,15 +139,18 @@ struct bwriter_shader {
unsigned
int
num_instrs
,
instr_alloc_size
;
};
static
inline
LPVOID
asm_alloc
(
SIZE_T
size
)
{
static
inline
void
*
d3dcompiler_alloc
(
SIZE_T
size
)
{
return
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
size
);
}
static
inline
LPVOID
asm_realloc
(
LPVOID
ptr
,
SIZE_T
size
)
{
static
inline
void
*
d3dcompiler_realloc
(
void
*
ptr
,
SIZE_T
size
)
{
return
HeapReAlloc
(
GetProcessHeap
(),
0
,
ptr
,
size
);
}
static
inline
BOOL
asm_free
(
LPVOID
ptr
)
{
static
inline
BOOL
d3dcompiler_free
(
void
*
ptr
)
{
return
HeapFree
(
GetProcessHeap
(),
0
,
ptr
);
}
...
...
dlls/d3dcompiler_43/utils.c
View file @
491d0e9d
...
...
@@ -725,7 +725,7 @@ void compilation_message(struct compilation_messages *msg, const char *fmt, va_l
if
(
msg
->
capacity
==
0
)
{
msg
->
string
=
asm
_alloc
(
MESSAGEBUFFER_INITIAL_SIZE
);
msg
->
string
=
d3dcompiler
_alloc
(
MESSAGEBUFFER_INITIAL_SIZE
);
if
(
msg
->
string
==
NULL
)
{
ERR
(
"Error allocating memory for parser messages
\n
"
);
...
...
@@ -742,7 +742,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
=
asm
_realloc
(
msg
->
string
,
size
);
buffer
=
d3dcompiler
_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