Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
e9ff40d9
Commit
e9ff40d9
authored
Dec 05, 2010
by
Henri Verbeet
Committed by
Alexandre Julliard
Dec 06, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Use local reg_maps variables where possible.
parent
0405733f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
20 deletions
+26
-20
arb_program_shader.c
dlls/wined3d/arb_program_shader.c
+9
-7
glsl_shader.c
dlls/wined3d/glsl_shader.c
+15
-11
shader.c
dlls/wined3d/shader.c
+2
-2
No files found.
dlls/wined3d/arb_program_shader.c
View file @
e9ff40d9
...
...
@@ -732,11 +732,12 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s
if
(
max_constantsF
<
96
)
max_constantsF
=
gl_info
->
limits
.
arb_vs_float_constants
;
if
(
This
->
baseShader
.
reg_maps
.
usesrelconstF
)
{
if
(
reg_maps
->
usesrelconstF
)
{
DWORD
highest_constf
=
0
,
clip_limit
;
max_constantsF
-=
reserved_vs_const
(
shader_data
,
reg_maps
,
gl_info
);
max_constantsF
-=
count_bits
(
This
->
baseShader
.
reg_maps
.
integer_constants
);
max_constantsF
-=
count_bits
(
reg_maps
->
integer_constants
);
for
(
i
=
0
;
i
<
This
->
baseShader
.
limits
.
constant_float
;
i
++
)
{
...
...
@@ -821,7 +822,8 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s
* local constants do not declare the loaded constants as an array because ARB compilers usually
* do not optimize unused constants away
*/
if
(
This
->
baseShader
.
reg_maps
.
usesrelconstF
)
{
if
(
reg_maps
->
usesrelconstF
)
{
/* Need to PARAM the environment parameters (constants) so we can use relative addressing */
shader_addline
(
buffer
,
"PARAM C[%d] = { program.env[0..%d] };
\n
"
,
max_constantsF
,
max_constantsF
-
1
);
...
...
@@ -830,7 +832,8 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s
DWORD
idx
,
mask
;
idx
=
i
>>
5
;
mask
=
1
<<
(
i
&
0x1f
);
if
(
!
shader_constant_is_local
(
This
,
i
)
&&
(
This
->
baseShader
.
reg_maps
.
constf
[
idx
]
&
mask
))
{
if
(
!
shader_constant_is_local
(
This
,
i
)
&&
(
reg_maps
->
constf
[
idx
]
&
mask
))
{
shader_addline
(
buffer
,
"PARAM C%d = program.env[%d];
\n
"
,
i
,
i
);
}
}
...
...
@@ -3588,7 +3591,7 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShaderImpl *This, struct
priv_ctx
.
target_version
=
ARB
;
}
if
(
This
->
baseShader
.
reg_maps
.
highest_render_target
>
0
)
if
(
reg_maps
->
highest_render_target
>
0
)
{
shader_addline
(
buffer
,
"OPTION ARB_draw_buffers;
\n
"
);
}
...
...
@@ -4169,8 +4172,7 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This, struct
const
char
*
one
=
arb_get_helper_value
(
WINED3D_SHADER_TYPE_VERTEX
,
ARB_ONE
);
for
(
i
=
0
;
i
<
min
(
8
,
MAX_REG_TEXCRD
);
i
++
)
{
if
(
This
->
baseShader
.
reg_maps
.
texcoord_mask
[
i
]
&&
This
->
baseShader
.
reg_maps
.
texcoord_mask
[
i
]
!=
WINED3DSP_WRITEMASK_ALL
)
if
(
reg_maps
->
texcoord_mask
[
i
]
&&
reg_maps
->
texcoord_mask
[
i
]
!=
WINED3DSP_WRITEMASK_ALL
)
shader_addline
(
buffer
,
"MOV result.texcoord[%u].w, %s
\n
"
,
i
,
one
);
}
}
...
...
dlls/wined3d/glsl_shader.c
View file @
e9ff40d9
...
...
@@ -951,25 +951,29 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
}
else
{
if
(
This
->
baseShader
.
reg_maps
.
usesrelconstF
)
{
/* Subtract the other potential uniforms from the max available (bools, ints, and 1 row of projection matrix).
* Subtract another uniform for immediate values, which have to be loaded via uniform by the driver as well.
* The shader code only uses 0.5, 2.0, 1.0, 128 and -128 in vertex shader code, so one vec4 should be enough
* (Unfortunately the Nvidia driver doesn't store 128 and -128 in one float).
if
(
reg_maps
->
usesrelconstF
)
{
/* Subtract the other potential uniforms from the max
* available (bools, ints, and 1 row of projection matrix).
* Subtract another uniform for immediate values, which have
* to be loaded via uniform by the driver as well. The shader
* code only uses 0.5, 2.0, 1.0, 128 and -128 in vertex
* shader code, so one vec4 should be enough. (Unfortunately
* the Nvidia driver doesn't store 128 and -128 in one float).
*
* Writing gl_ClipVertex requires one uniform for each
clipplane as well.
*/
* Writing gl_ClipVertex requires one uniform for each
*
clipplane as well. *
/
max_constantsF
=
gl_info
->
limits
.
glsl_vs_float_constants
-
3
;
if
(
ctx_priv
->
cur_vs_args
->
clip_enabled
)
{
max_constantsF
-=
gl_info
->
limits
.
clipplanes
;
}
max_constantsF
-=
count_bits
(
This
->
baseShader
.
reg_maps
.
integer_constants
);
max_constantsF
-=
count_bits
(
reg_maps
->
integer_constants
);
/* Strictly speaking a bool only uses one scalar, but the nvidia(Linux) compiler doesn't pack them properly,
* so each scalar requires a full vec4. We could work around this by packing the booleans ourselves, but
* for now take this into account when calculating the number of available constants
*/
max_constantsF
-=
count_bits
(
This
->
baseShader
.
reg_maps
.
boolean_constants
);
max_constantsF
-=
count_bits
(
reg_maps
->
boolean_constants
);
/* Set by driver quirks in directx.c */
max_constantsF
-=
gl_info
->
reserved_glsl_constants
;
}
...
...
@@ -985,10 +989,10 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
/* Always declare the full set of constants, the compiler can remove the unused ones because d3d doesn't(yet)
* support indirect int and bool constant addressing. This avoids problems if the app uses e.g. i0 and i9.
*/
if
(
This
->
baseShader
.
limits
.
constant_int
>
0
&&
This
->
baseShader
.
reg_maps
.
integer_constants
)
if
(
This
->
baseShader
.
limits
.
constant_int
>
0
&&
reg_maps
->
integer_constants
)
shader_addline
(
buffer
,
"uniform ivec4 %cI[%u];
\n
"
,
prefix
,
This
->
baseShader
.
limits
.
constant_int
);
if
(
This
->
baseShader
.
limits
.
constant_bool
>
0
&&
This
->
baseShader
.
reg_maps
.
boolean_constants
)
if
(
This
->
baseShader
.
limits
.
constant_bool
>
0
&&
reg_maps
->
boolean_constants
)
shader_addline
(
buffer
,
"uniform bool %cB[%u];
\n
"
,
prefix
,
This
->
baseShader
.
limits
.
constant_bool
);
if
(
!
pshader
)
...
...
dlls/wined3d/shader.c
View file @
e9ff40d9
...
...
@@ -1864,7 +1864,7 @@ HRESULT vertexshader_init(IWineD3DVertexShaderImpl *shader, IWineD3DDeviceImpl *
return
hr
;
}
map
=
shader
->
baseShader
.
reg_maps
.
input_registers
;
map
=
reg_maps
->
input_registers
;
for
(
i
=
0
;
map
;
map
>>=
1
,
++
i
)
{
if
(
!
(
map
&
1
)
||
!
shader
->
baseShader
.
input_signature
[
i
].
semantic_name
)
continue
;
...
...
@@ -1886,7 +1886,7 @@ HRESULT vertexshader_init(IWineD3DVertexShaderImpl *shader, IWineD3DDeviceImpl *
vertexshader_set_limits
(
shader
);
shader
->
baseShader
.
load_local_constsF
=
shader
->
baseShader
.
reg_maps
.
usesrelconstF
shader
->
baseShader
.
load_local_constsF
=
reg_maps
->
usesrelconstF
&&
!
list_empty
(
&
shader
->
baseShader
.
constantsF
);
return
WINED3D_OK
;
...
...
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