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
f9276a64
Commit
f9276a64
authored
May 07, 2009
by
Stefan Dösinger
Committed by
Alexandre Julliard
May 08, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Keep track of used float constants.
parent
bcf1361a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
4 deletions
+65
-4
baseshader.c
dlls/wined3d/baseshader.c
+59
-1
pixelshader.c
dlls/wined3d/pixelshader.c
+2
-1
vertexshader.c
dlls/wined3d/vertexshader.c
+2
-1
wined3d_private.h
dlls/wined3d/wined3d_private.h
+2
-1
No files found.
dlls/wined3d/baseshader.c
View file @
f9276a64
...
...
@@ -237,6 +237,14 @@ static void shader_delete_constant_list(struct list* clist) {
list_init
(
clist
);
}
static
inline
void
set_bitmap_bit
(
DWORD
*
bitmap
,
DWORD
bit
)
{
DWORD
idx
,
shift
;
idx
=
bit
>>
5
;
shift
=
bit
&
0x1f
;
bitmap
[
idx
]
|=
(
1
<<
shift
);
}
static
void
shader_record_register_usage
(
IWineD3DBaseShaderImpl
*
This
,
struct
shader_reg_maps
*
reg_maps
,
DWORD
register_type
,
UINT
register_idx
,
BOOL
has_rel_addr
,
BOOL
pshader
)
{
...
...
@@ -293,6 +301,10 @@ static void shader_record_register_usage(IWineD3DBaseShaderImpl *This, struct sh
}
reg_maps
->
usesrelconstF
=
TRUE
;
}
else
{
set_bitmap_bit
(
reg_maps
->
constf
,
register_idx
);
}
break
;
case
WINED3DSPR_CONSTINT
:
...
...
@@ -309,12 +321,32 @@ static void shader_record_register_usage(IWineD3DBaseShaderImpl *This, struct sh
}
}
static
unsigned
char
get_instr_regcount
(
enum
WINED3D_SHADER_INSTRUCTION_HANDLER
instr
,
int
param
)
{
switch
(
instr
)
{
case
WINED3DSIH_M4x4
:
case
WINED3DSIH_M3x4
:
return
param
==
1
?
4
:
1
;
case
WINED3DSIH_M4x3
:
case
WINED3DSIH_M3x3
:
return
param
==
1
?
3
:
1
;
case
WINED3DSIH_M3x2
:
return
param
==
1
?
2
:
1
;
default:
return
1
;
}
}
/* Note that this does not count the loop register
* as an address register. */
HRESULT
shader_get_registers_used
(
IWineD3DBaseShader
*
iface
,
const
struct
wined3d_shader_frontend
*
fe
,
struct
shader_reg_maps
*
reg_maps
,
struct
wined3d_shader_semantic
*
semantics_in
,
struct
wined3d_shader_semantic
*
semantics_out
,
const
DWORD
*
byte_code
)
struct
wined3d_shader_semantic
*
semantics_out
,
const
DWORD
*
byte_code
,
DWORD
constf_size
)
{
IWineD3DBaseShaderImpl
*
This
=
(
IWineD3DBaseShaderImpl
*
)
iface
;
void
*
fe_data
=
This
->
baseShader
.
frontend_data
;
...
...
@@ -338,6 +370,13 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
reg_maps
->
shader_version
=
shader_version
;
pshader
=
shader_is_pshader_version
(
shader_version
.
type
);
reg_maps
->
constf
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
reg_maps
->
constf
)
*
((
constf_size
+
31
)
/
32
));
if
(
!
reg_maps
->
constf
)
{
ERR
(
"Out of memory
\n
"
);
return
E_OUTOFMEMORY
;
}
while
(
!
fe
->
shader_is_end
(
fe_data
,
&
pToken
))
{
struct
wined3d_shader_instruction
ins
;
...
...
@@ -582,6 +621,24 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
fe
->
shader_read_src_param
(
fe_data
,
&
pToken
,
&
src_param
,
&
src_rel_addr
);
shader_record_register_usage
(
This
,
reg_maps
,
src_param
.
reg
.
type
,
src_param
.
reg
.
idx
,
!!
src_param
.
reg
.
rel_addr
,
pshader
);
switch
(
get_instr_regcount
(
ins
.
handler_idx
,
i
))
{
case
4
:
shader_record_register_usage
(
This
,
reg_maps
,
src_param
.
reg
.
type
,
src_param
.
reg
.
idx
+
3
,
!!
src_param
.
reg
.
rel_addr
,
pshader
);
/* drop through */
case
3
:
shader_record_register_usage
(
This
,
reg_maps
,
src_param
.
reg
.
type
,
src_param
.
reg
.
idx
+
2
,
!!
src_param
.
reg
.
rel_addr
,
pshader
);
/* drop through */
case
2
:
shader_record_register_usage
(
This
,
reg_maps
,
src_param
.
reg
.
type
,
src_param
.
reg
.
idx
+
1
,
!!
src_param
.
reg
.
rel_addr
,
pshader
);
/* drop through */
case
1
:
shader_record_register_usage
(
This
,
reg_maps
,
src_param
.
reg
.
type
,
src_param
.
reg
.
idx
,
!!
src_param
.
reg
.
rel_addr
,
pshader
);
}
}
}
}
...
...
@@ -1158,6 +1215,7 @@ void shader_cleanup(IWineD3DBaseShader *iface)
IWineD3DBaseShaderImpl
*
This
=
(
IWineD3DBaseShaderImpl
*
)
iface
;
((
IWineD3DDeviceImpl
*
)
This
->
baseShader
.
device
)
->
shader_backend
->
shader_destroy
(
iface
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
baseShader
.
reg_maps
.
constf
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
baseShader
.
function
);
shader_delete_constant_list
(
&
This
->
baseShader
.
constantsF
);
shader_delete_constant_list
(
&
This
->
baseShader
.
constantsB
);
...
...
dlls/wined3d/pixelshader.c
View file @
f9276a64
...
...
@@ -238,7 +238,8 @@ static HRESULT WINAPI IWineD3DPixelShaderImpl_SetFunction(IWineD3DPixelShader *i
list_init
(
&
This
->
baseShader
.
constantsI
);
/* Second pass: figure out which registers are used, what the semantics are, etc.. */
hr
=
shader_get_registers_used
((
IWineD3DBaseShader
*
)
This
,
fe
,
reg_maps
,
This
->
semantics_in
,
NULL
,
pFunction
);
hr
=
shader_get_registers_used
((
IWineD3DBaseShader
*
)
This
,
fe
,
reg_maps
,
This
->
semantics_in
,
NULL
,
pFunction
,
GL_LIMITS
(
pshader_constantsF
));
if
(
FAILED
(
hr
))
return
hr
;
pshader_set_limits
(
This
);
...
...
dlls/wined3d/vertexshader.c
View file @
f9276a64
...
...
@@ -279,7 +279,8 @@ static HRESULT WINAPI IWineD3DVertexShaderImpl_SetFunction(IWineD3DVertexShader
This
->
min_rel_offset
=
GL_LIMITS
(
vshader_constantsF
);
This
->
max_rel_offset
=
0
;
hr
=
shader_get_registers_used
((
IWineD3DBaseShader
*
)
This
,
fe
,
reg_maps
,
This
->
semantics_in
,
This
->
semantics_out
,
pFunction
);
reg_maps
,
This
->
semantics_in
,
This
->
semantics_out
,
pFunction
,
GL_LIMITS
(
vshader_constantsF
));
if
(
hr
!=
WINED3D_OK
)
return
hr
;
vshader_set_limits
(
This
);
...
...
dlls/wined3d/wined3d_private.h
View file @
f9276a64
...
...
@@ -625,6 +625,7 @@ typedef struct shader_reg_maps
char
packed_output
[
MAX_REG_OUTPUT
];
/* vertex >= 3.0 */
char
attributes
[
MAX_ATTRIBS
];
/* vertex */
char
labels
[
MAX_LABELS
];
/* pixel, vertex */
DWORD
*
constf
;
/* pixel, vertex */
DWORD
texcoord_mask
[
MAX_REG_TEXCRD
];
/* vertex < 3.0 */
WORD
integer_constants
;
/* MAX_CONST_I, 16 */
WORD
boolean_constants
;
/* MAX_CONST_B, 16 */
...
...
@@ -2579,7 +2580,7 @@ void shader_generate_main(IWineD3DBaseShader *iface, SHADER_BUFFER *buffer,
const
shader_reg_maps
*
reg_maps
,
const
DWORD
*
pFunction
);
HRESULT
shader_get_registers_used
(
IWineD3DBaseShader
*
iface
,
const
struct
wined3d_shader_frontend
*
fe
,
struct
shader_reg_maps
*
reg_maps
,
struct
wined3d_shader_semantic
*
semantics_in
,
struct
wined3d_shader_semantic
*
semantics_out
,
const
DWORD
*
byte_code
);
struct
wined3d_shader_semantic
*
semantics_out
,
const
DWORD
*
byte_code
,
DWORD
constf_size
);
void
shader_init
(
struct
IWineD3DBaseShaderClass
*
shader
,
IWineD3DDevice
*
device
);
const
struct
wined3d_shader_frontend
*
shader_select_frontend
(
DWORD
version_token
);
void
shader_trace_init
(
const
struct
wined3d_shader_frontend
*
fe
,
void
*
fe_data
,
const
DWORD
*
pFunction
);
...
...
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