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
5c63d93e
Commit
5c63d93e
authored
May 06, 2009
by
Henri Verbeet
Committed by
Alexandre Julliard
May 07, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Store the shader version in the frontend's private data.
parent
94cf6186
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
40 deletions
+49
-40
baseshader.c
dlls/wined3d/baseshader.c
+19
-19
shader_sm1.c
dlls/wined3d/shader_sm1.c
+17
-10
shader_sm4.c
dlls/wined3d/shader_sm4.c
+8
-5
wined3d_private.h
dlls/wined3d/wined3d_private.h
+5
-6
No files found.
dlls/wined3d/baseshader.c
View file @
5c63d93e
...
...
@@ -349,7 +349,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
if
(
comment
)
continue
;
/* Fetch opcode */
fe
->
shader_read_opcode
(
fe_data
,
&
pToken
,
&
ins
,
&
param_size
,
shader_version
);
fe
->
shader_read_opcode
(
fe_data
,
&
pToken
,
&
ins
,
&
param_size
);
/* Unhandled opcode, and its parameters */
if
(
ins
.
handler_idx
==
WINED3DSIH_TABLE_SIZE
)
...
...
@@ -401,7 +401,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
local_constant
*
lconst
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
local_constant
));
if
(
!
lconst
)
return
E_OUTOFMEMORY
;
fe
->
shader_read_dst_param
(
&
pToken
,
&
dst
,
&
rel_addr
,
shader_version
);
fe
->
shader_read_dst_param
(
fe_data
,
&
pToken
,
&
dst
,
&
rel_addr
);
lconst
->
idx
=
dst
.
register_idx
;
memcpy
(
lconst
->
value
,
pToken
,
4
*
sizeof
(
DWORD
));
...
...
@@ -431,7 +431,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
local_constant
*
lconst
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
local_constant
));
if
(
!
lconst
)
return
E_OUTOFMEMORY
;
fe
->
shader_read_dst_param
(
&
pToken
,
&
dst
,
&
rel_addr
,
shader_version
);
fe
->
shader_read_dst_param
(
fe_data
,
&
pToken
,
&
dst
,
&
rel_addr
);
lconst
->
idx
=
dst
.
register_idx
;
memcpy
(
lconst
->
value
,
pToken
,
4
*
sizeof
(
DWORD
));
...
...
@@ -447,7 +447,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
local_constant
*
lconst
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
local_constant
));
if
(
!
lconst
)
return
E_OUTOFMEMORY
;
fe
->
shader_read_dst_param
(
&
pToken
,
&
dst
,
&
rel_addr
,
shader_version
);
fe
->
shader_read_dst_param
(
fe_data
,
&
pToken
,
&
dst
,
&
rel_addr
);
lconst
->
idx
=
dst
.
register_idx
;
memcpy
(
lconst
->
value
,
pToken
,
sizeof
(
DWORD
));
...
...
@@ -461,7 +461,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
{
struct
wined3d_shader_src_param
src
,
rel_addr
;
fe
->
shader_read_src_param
(
&
pToken
,
&
src
,
&
rel_addr
,
shader_version
);
fe
->
shader_read_src_param
(
fe_data
,
&
pToken
,
&
src
,
&
rel_addr
);
/* Rep and Loop always use an integer constant for the control parameters */
if
(
ins
.
handler_idx
==
WINED3DSIH_REP
)
...
...
@@ -470,7 +470,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
}
else
{
fe
->
shader_read_src_param
(
&
pToken
,
&
src
,
&
rel_addr
,
shader_version
);
fe
->
shader_read_src_param
(
fe_data
,
&
pToken
,
&
src
,
&
rel_addr
);
reg_maps
->
integer_constants
|=
1
<<
src
.
register_idx
;
}
...
...
@@ -488,7 +488,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
{
struct
wined3d_shader_src_param
src
,
rel_addr
;
fe
->
shader_read_src_param
(
&
pToken
,
&
src
,
&
rel_addr
,
shader_version
);
fe
->
shader_read_src_param
(
fe_data
,
&
pToken
,
&
src
,
&
rel_addr
);
reg_maps
->
labels
[
src
.
register_idx
]
=
1
;
}
/* Set texture, address, temporary registers */
...
...
@@ -508,7 +508,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
struct
wined3d_shader_dst_param
dst_param
;
struct
wined3d_shader_src_param
dst_rel_addr
;
fe
->
shader_read_dst_param
(
&
pToken
,
&
dst_param
,
&
dst_rel_addr
,
shader_version
);
fe
->
shader_read_dst_param
(
fe_data
,
&
pToken
,
&
dst_param
,
&
dst_rel_addr
);
/* WINED3DSPR_TEXCRDOUT is the same as WINED3DSPR_OUTPUT. _OUTPUT can be > MAX_REG_TEXCRD and
* is used in >= 3.0 shaders. Filter 3.0 shaders to prevent overflows, and also filter pixel
...
...
@@ -580,7 +580,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
{
struct
wined3d_shader_src_param
src_param
,
src_rel_addr
;
fe
->
shader_read_src_param
(
&
pToken
,
&
src_param
,
&
src_rel_addr
,
shader_version
);
fe
->
shader_read_src_param
(
fe_data
,
&
pToken
,
&
src_param
,
&
src_rel_addr
);
shader_record_register_usage
(
This
,
reg_maps
,
src_param
.
register_type
,
src_param
.
register_idx
,
!!
src_param
.
rel_addr
,
pshader
);
}
...
...
@@ -892,7 +892,7 @@ void shader_generate_main(IWineD3DBaseShader *iface, SHADER_BUFFER *buffer,
if
(
comment
)
continue
;
/* Read opcode */
fe
->
shader_read_opcode
(
fe_data
,
&
pToken
,
&
ins
,
&
param_size
,
shader_version
);
fe
->
shader_read_opcode
(
fe_data
,
&
pToken
,
&
ins
,
&
param_size
);
/* Unknown opcode and its parameters */
if
(
ins
.
handler_idx
==
WINED3DSIH_TABLE_SIZE
)
...
...
@@ -927,7 +927,7 @@ void shader_generate_main(IWineD3DBaseShader *iface, SHADER_BUFFER *buffer,
}
/* Destination token */
if
(
ins
.
dst_count
)
fe
->
shader_read_dst_param
(
&
pToken
,
&
dst_param
,
&
dst_rel_addr
,
shader_version
);
if
(
ins
.
dst_count
)
fe
->
shader_read_dst_param
(
fe_data
,
&
pToken
,
&
dst_param
,
&
dst_rel_addr
);
/* Predication token */
if
(
ins
.
predicate
)
ins
.
predicate
=
*
pToken
++
;
...
...
@@ -935,7 +935,7 @@ void shader_generate_main(IWineD3DBaseShader *iface, SHADER_BUFFER *buffer,
/* Other source tokens */
for
(
i
=
0
;
i
<
ins
.
src_count
;
++
i
)
{
fe
->
shader_read_src_param
(
&
pToken
,
&
src_param
[
i
],
&
src_rel_addr
[
i
],
shader_version
);
fe
->
shader_read_src_param
(
fe_data
,
&
pToken
,
&
src_param
[
i
],
&
src_rel_addr
[
i
]
);
}
/* Call appropriate function for output target */
...
...
@@ -1000,7 +1000,7 @@ void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe_data,
continue
;
}
fe
->
shader_read_opcode
(
fe_data
,
&
pToken
,
&
ins
,
&
param_size
,
shader_version
);
fe
->
shader_read_opcode
(
fe_data
,
&
pToken
,
&
ins
,
&
param_size
);
if
(
ins
.
handler_idx
==
WINED3DSIH_TABLE_SIZE
)
{
TRACE
(
"Skipping unrecognized instruction.
\n
"
);
...
...
@@ -1024,7 +1024,7 @@ void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe_data,
struct
wined3d_shader_dst_param
dst
;
struct
wined3d_shader_src_param
rel_addr
;
fe
->
shader_read_dst_param
(
&
pToken
,
&
dst
,
&
rel_addr
,
shader_version
);
fe
->
shader_read_dst_param
(
fe_data
,
&
pToken
,
&
dst
,
&
rel_addr
);
TRACE
(
"def c%u = %f, %f, %f, %f"
,
shader_get_float_offset
(
dst
.
register_type
,
dst
.
register_idx
),
*
(
const
float
*
)(
pToken
),
...
...
@@ -1038,7 +1038,7 @@ void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe_data,
struct
wined3d_shader_dst_param
dst
;
struct
wined3d_shader_src_param
rel_addr
;
fe
->
shader_read_dst_param
(
&
pToken
,
&
dst
,
&
rel_addr
,
shader_version
);
fe
->
shader_read_dst_param
(
fe_data
,
&
pToken
,
&
dst
,
&
rel_addr
);
TRACE
(
"defi i%u = %d, %d, %d, %d"
,
dst
.
register_idx
,
*
(
pToken
),
...
...
@@ -1052,7 +1052,7 @@ void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe_data,
struct
wined3d_shader_dst_param
dst
;
struct
wined3d_shader_src_param
rel_addr
;
fe
->
shader_read_dst_param
(
&
pToken
,
&
dst
,
&
rel_addr
,
shader_version
);
fe
->
shader_read_dst_param
(
fe_data
,
&
pToken
,
&
dst
,
&
rel_addr
);
TRACE
(
"defb b%u = %s"
,
dst
.
register_idx
,
*
pToken
?
"true"
:
"false"
);
++
pToken
;
...
...
@@ -1065,14 +1065,14 @@ void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe_data,
if
(
ins
.
dst_count
)
{
fe
->
shader_read_dst_param
(
&
pToken
,
&
dst_param
,
&
dst_rel_addr
,
shader_version
);
fe
->
shader_read_dst_param
(
fe_data
,
&
pToken
,
&
dst_param
,
&
dst_rel_addr
);
}
/* Print out predication source token first - it follows
* the destination token. */
if
(
ins
.
predicate
)
{
fe
->
shader_read_src_param
(
&
pToken
,
&
src_param
,
&
src_rel_addr
,
shader_version
);
fe
->
shader_read_src_param
(
fe_data
,
&
pToken
,
&
src_param
,
&
src_rel_addr
);
TRACE
(
"("
);
shader_dump_src_param
(
&
src_param
,
shader_version
);
TRACE
(
") "
);
...
...
@@ -1115,7 +1115,7 @@ void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe_data,
/* Other source tokens */
for
(
i
=
ins
.
dst_count
;
i
<
(
ins
.
dst_count
+
ins
.
src_count
);
++
i
)
{
fe
->
shader_read_src_param
(
&
pToken
,
&
src_param
,
&
src_rel_addr
,
shader_version
);
fe
->
shader_read_src_param
(
fe_data
,
&
pToken
,
&
src_param
,
&
src_rel_addr
);
TRACE
(
!
i
?
" "
:
", "
);
shader_dump_src_param
(
&
src_param
,
shader_version
);
}
...
...
dlls/wined3d/shader_sm1.c
View file @
5c63d93e
...
...
@@ -108,6 +108,7 @@ struct wined3d_sm1_opcode_info
struct
wined3d_sm1_data
{
DWORD
shader_version
;
const
struct
wined3d_sm1_opcode_info
*
opcode_table
;
};
...
...
@@ -440,24 +441,28 @@ static void shader_sm1_free(void *data)
static
void
shader_sm1_read_header
(
void
*
data
,
const
DWORD
**
ptr
,
DWORD
*
shader_version
)
{
struct
wined3d_sm1_data
*
priv
=
data
;
TRACE
(
"version: 0x%08x
\n
"
,
**
ptr
);
*
shader_version
=
*
(
*
ptr
)
++
;
priv
->
shader_version
=
*
shader_version
;
}
static
void
shader_sm1_read_opcode
(
void
*
data
,
const
DWORD
**
ptr
,
struct
wined3d_shader_instruction
*
ins
,
UINT
*
param_size
,
DWORD
shader_version
)
UINT
*
param_size
)
{
struct
wined3d_sm1_data
*
priv
=
data
;
const
struct
wined3d_sm1_opcode_info
*
opcode_info
;
DWORD
opcode_token
;
opcode_token
=
*
(
*
ptr
)
++
;
opcode_info
=
shader_get_opcode
(
priv
->
opcode_table
,
shader_version
,
opcode_token
);
opcode_info
=
shader_get_opcode
(
priv
->
opcode_table
,
priv
->
shader_version
,
opcode_token
);
if
(
!
opcode_info
)
{
FIXME
(
"Unrecognized opcode: token=0x%08x
\n
"
,
opcode_token
);
ins
->
handler_idx
=
WINED3DSIH_TABLE_SIZE
;
*
param_size
=
shader_skip_unrecognized
(
*
ptr
,
shader_version
);
*
param_size
=
shader_skip_unrecognized
(
*
ptr
,
priv
->
shader_version
);
return
;
}
...
...
@@ -467,15 +472,16 @@ static void shader_sm1_read_opcode(void *data, const DWORD **ptr, struct wined3d
ins
->
predicate
=
opcode_token
&
WINED3DSHADER_INSTRUCTION_PREDICATED
;
ins
->
dst_count
=
opcode_info
->
dst_count
?
1
:
0
;
ins
->
src_count
=
opcode_info
->
param_count
-
opcode_info
->
dst_count
;
*
param_size
=
shader_skip_opcode
(
opcode_info
,
opcode_token
,
shader_version
);
*
param_size
=
shader_skip_opcode
(
opcode_info
,
opcode_token
,
priv
->
shader_version
);
}
static
void
shader_sm1_read_src_param
(
const
DWORD
**
ptr
,
struct
wined3d_shader_src_param
*
src_param
,
struct
wined3d_shader_src_param
*
src_rel_addr
,
DWORD
shader_version
)
static
void
shader_sm1_read_src_param
(
void
*
data
,
const
DWORD
**
ptr
,
struct
wined3d_shader_src_param
*
src_param
,
struct
wined3d_shader_src_param
*
src_rel_addr
)
{
struct
wined3d_sm1_data
*
priv
=
data
;
DWORD
token
,
addr_token
;
*
ptr
+=
shader_get_param
(
*
ptr
,
shader_version
,
&
token
,
&
addr_token
);
*
ptr
+=
shader_get_param
(
*
ptr
,
priv
->
shader_version
,
&
token
,
&
addr_token
);
if
(
token
&
WINED3DSHADER_ADDRMODE_RELATIVE
)
{
shader_parse_src_param
(
addr_token
,
NULL
,
src_rel_addr
);
...
...
@@ -487,12 +493,13 @@ static void shader_sm1_read_src_param(const DWORD **ptr, struct wined3d_shader_s
}
}
static
void
shader_sm1_read_dst_param
(
const
DWORD
**
ptr
,
struct
wined3d_shader_dst_param
*
dst_param
,
struct
wined3d_shader_src_param
*
dst_rel_addr
,
DWORD
shader_version
)
static
void
shader_sm1_read_dst_param
(
void
*
data
,
const
DWORD
**
ptr
,
struct
wined3d_shader_dst_param
*
dst_param
,
struct
wined3d_shader_src_param
*
dst_rel_addr
)
{
struct
wined3d_sm1_data
*
priv
=
data
;
DWORD
token
,
addr_token
;
*
ptr
+=
shader_get_param
(
*
ptr
,
shader_version
,
&
token
,
&
addr_token
);
*
ptr
+=
shader_get_param
(
*
ptr
,
priv
->
shader_version
,
&
token
,
&
addr_token
);
if
(
token
&
WINED3DSHADER_ADDRMODE_RELATIVE
)
{
shader_parse_src_param
(
addr_token
,
NULL
,
dst_rel_addr
);
...
...
dlls/wined3d/shader_sm4.c
View file @
5c63d93e
...
...
@@ -66,6 +66,7 @@ enum wined3d_sm4_immconst_type
struct
wined3d_sm4_data
{
DWORD
shader_version
;
const
DWORD
*
end
;
};
...
...
@@ -134,10 +135,12 @@ static void shader_sm4_read_header(void *data, const DWORD **ptr, DWORD *shader_
*
shader_version
=
*
(
*
ptr
)
++
;
TRACE
(
"token count: %u
\n
"
,
**
ptr
);
priv
->
end
+=
*
(
*
ptr
)
++
;
priv
->
shader_version
=
*
shader_version
;
}
static
void
shader_sm4_read_opcode
(
void
*
data
,
const
DWORD
**
ptr
,
struct
wined3d_shader_instruction
*
ins
,
UINT
*
param_size
,
DWORD
shader_version
)
UINT
*
param_size
)
{
const
struct
wined3d_sm4_opcode_info
*
opcode_info
;
DWORD
token
=
*
(
*
ptr
)
++
;
...
...
@@ -161,8 +164,8 @@ static void shader_sm4_read_opcode(void *data, const DWORD **ptr, struct wined3d
ins
->
src_count
=
opcode_info
->
src_count
;
}
static
void
shader_sm4_read_src_param
(
const
DWORD
**
ptr
,
struct
wined3d_shader_src_param
*
src_param
,
struct
wined3d_shader_src_param
*
src_rel_addr
,
DWORD
shader_version
)
static
void
shader_sm4_read_src_param
(
void
*
data
,
const
DWORD
**
ptr
,
struct
wined3d_shader_src_param
*
src_param
,
struct
wined3d_shader_src_param
*
src_rel_addr
)
{
DWORD
token
=
*
(
*
ptr
)
++
;
enum
wined3d_sm4_register_type
register_type
;
...
...
@@ -213,8 +216,8 @@ static void shader_sm4_read_src_param(const DWORD **ptr, struct wined3d_shader_s
src_param
->
rel_addr
=
NULL
;
}
static
void
shader_sm4_read_dst_param
(
const
DWORD
**
ptr
,
struct
wined3d_shader_dst_param
*
dst_param
,
struct
wined3d_shader_src_param
*
dst_rel_addr
,
DWORD
shader_version
)
static
void
shader_sm4_read_dst_param
(
void
*
data
,
const
DWORD
**
ptr
,
struct
wined3d_shader_dst_param
*
dst_param
,
struct
wined3d_shader_src_param
*
dst_rel_addr
)
{
DWORD
token
=
*
(
*
ptr
)
++
;
UINT
register_idx
=
*
(
*
ptr
)
++
;
...
...
dlls/wined3d/wined3d_private.h
View file @
5c63d93e
...
...
@@ -682,12 +682,11 @@ struct wined3d_shader_frontend
void
*
(
*
shader_init
)(
const
DWORD
*
ptr
);
void
(
*
shader_free
)(
void
*
data
);
void
(
*
shader_read_header
)(
void
*
data
,
const
DWORD
**
ptr
,
DWORD
*
shader_version
);
void
(
*
shader_read_opcode
)(
void
*
data
,
const
DWORD
**
ptr
,
struct
wined3d_shader_instruction
*
ins
,
UINT
*
param_size
,
DWORD
shader_version
);
void
(
*
shader_read_src_param
)(
const
DWORD
**
ptr
,
struct
wined3d_shader_src_param
*
src_param
,
struct
wined3d_shader_src_param
*
src_rel_addr
,
DWORD
shader_version
);
void
(
*
shader_read_dst_param
)(
const
DWORD
**
ptr
,
struct
wined3d_shader_dst_param
*
dst_param
,
struct
wined3d_shader_src_param
*
dst_rel_addr
,
DWORD
shader_version
);
void
(
*
shader_read_opcode
)(
void
*
data
,
const
DWORD
**
ptr
,
struct
wined3d_shader_instruction
*
ins
,
UINT
*
param_size
);
void
(
*
shader_read_src_param
)(
void
*
data
,
const
DWORD
**
ptr
,
struct
wined3d_shader_src_param
*
src_param
,
struct
wined3d_shader_src_param
*
src_rel_addr
);
void
(
*
shader_read_dst_param
)(
void
*
data
,
const
DWORD
**
ptr
,
struct
wined3d_shader_dst_param
*
dst_param
,
struct
wined3d_shader_src_param
*
dst_rel_addr
);
void
(
*
shader_read_semantic
)(
const
DWORD
**
ptr
,
struct
wined3d_shader_semantic
*
semantic
);
void
(
*
shader_read_comment
)(
const
DWORD
**
ptr
,
const
char
**
comment
);
BOOL
(
*
shader_is_end
)(
void
*
data
,
const
DWORD
**
ptr
);
...
...
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