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
43564655
Commit
43564655
authored
Oct 07, 2009
by
Stefan Dösinger
Committed by
Alexandre Julliard
Oct 20, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Use GLSL constant limits in GLSL.
parent
2d802af4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
glsl_shader.c
dlls/wined3d/glsl_shader.c
+13
-13
No files found.
dlls/wined3d/glsl_shader.c
View file @
43564655
...
...
@@ -844,7 +844,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
*/
if
(
pshader
)
{
/* No indirect addressing here */
max_constantsF
=
GL_LIMITS
(
ps
hader
_constantsF
);
max_constantsF
=
GL_LIMITS
(
ps
_glsl
_constantsF
);
}
else
{
if
(
This
->
baseShader
.
reg_maps
.
usesrelconstF
)
{
/* Subtract the other potential uniforms from the max available (bools, ints, and 1 row of projection matrix).
...
...
@@ -854,7 +854,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
*
* Writing gl_ClipPos requires one uniform for each clipplane as well.
*/
max_constantsF
=
GL_LIMITS
(
vs
hader
_constantsF
)
-
3
-
GL_LIMITS
(
clipplanes
);
max_constantsF
=
GL_LIMITS
(
vs
_glsl
_constantsF
)
-
3
-
GL_LIMITS
(
clipplanes
);
max_constantsF
-=
count_bits
(
This
->
baseShader
.
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
...
...
@@ -864,7 +864,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
/* Set by driver quirks in directx.c */
max_constantsF
-=
GLINFO_LOCATION
.
reserved_glsl_constants
;
}
else
{
max_constantsF
=
GL_LIMITS
(
vs
hader
_constantsF
);
max_constantsF
=
GL_LIMITS
(
vs
_glsl
_constantsF
);
}
}
max_constantsF
=
min
(
This
->
baseShader
.
limits
.
constant_float
,
max_constantsF
);
...
...
@@ -923,7 +923,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
srgb_cmp
);
}
if
(
reg_maps
->
vpos
||
reg_maps
->
usesdsy
)
{
if
(
This
->
baseShader
.
limits
.
constant_float
+
extra_constants_needed
+
1
<
GL_LIMITS
(
ps
hader
_constantsF
))
{
if
(
This
->
baseShader
.
limits
.
constant_float
+
extra_constants_needed
+
1
<
GL_LIMITS
(
ps
_glsl
_constantsF
))
{
shader_addline
(
buffer
,
"uniform vec4 ycorrection;
\n
"
);
((
IWineD3DPixelShaderImpl
*
)
This
)
->
vpos_uniform
=
1
;
extra_constants_needed
++
;
...
...
@@ -4132,8 +4132,8 @@ static void set_glsl_shader_program(const struct wined3d_context *context,
GL_EXTCALL
(
glLinkProgramARB
(
programId
));
print_glsl_info_log
(
&
GLINFO_LOCATION
,
programId
);
entry
->
vuniformF_locations
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
GLhandleARB
)
*
GL_LIMITS
(
vs
hader
_constantsF
));
for
(
i
=
0
;
i
<
GL_LIMITS
(
vs
hader
_constantsF
);
++
i
)
{
entry
->
vuniformF_locations
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
GLhandleARB
)
*
GL_LIMITS
(
vs
_glsl
_constantsF
));
for
(
i
=
0
;
i
<
GL_LIMITS
(
vs
_glsl
_constantsF
);
++
i
)
{
snprintf
(
glsl_name
,
sizeof
(
glsl_name
),
"VC[%i]"
,
i
);
entry
->
vuniformF_locations
[
i
]
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
glsl_name
));
}
...
...
@@ -4141,8 +4141,8 @@ static void set_glsl_shader_program(const struct wined3d_context *context,
snprintf
(
glsl_name
,
sizeof
(
glsl_name
),
"VI[%i]"
,
i
);
entry
->
vuniformI_locations
[
i
]
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
glsl_name
));
}
entry
->
puniformF_locations
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
GLhandleARB
)
*
GL_LIMITS
(
ps
hader
_constantsF
));
for
(
i
=
0
;
i
<
GL_LIMITS
(
ps
hader
_constantsF
);
++
i
)
{
entry
->
puniformF_locations
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
GLhandleARB
)
*
GL_LIMITS
(
ps
_glsl
_constantsF
));
for
(
i
=
0
;
i
<
GL_LIMITS
(
ps
_glsl
_constantsF
);
++
i
)
{
snprintf
(
glsl_name
,
sizeof
(
glsl_name
),
"PC[%i]"
,
i
);
entry
->
puniformF_locations
[
i
]
=
GL_EXTCALL
(
glGetUniformLocationARB
(
programId
,
glsl_name
));
}
...
...
@@ -4521,7 +4521,7 @@ static HRESULT shader_glsl_alloc(IWineD3DDevice *iface) {
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
const
struct
wined3d_gl_info
*
gl_info
=
&
This
->
adapter
->
gl_info
;
struct
shader_glsl_priv
*
priv
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
struct
shader_glsl_priv
));
SIZE_T
stack_size
=
wined3d_log2i
(
max
(
GL_LIMITS
(
vs
hader_constantsF
),
GL_LIMITS
(
pshader
_constantsF
)))
+
1
;
SIZE_T
stack_size
=
wined3d_log2i
(
max
(
GL_LIMITS
(
vs
_glsl_constantsF
),
GL_LIMITS
(
ps_glsl
_constantsF
)))
+
1
;
if
(
!
shader_buffer_init
(
&
priv
->
shader_buffer
))
{
...
...
@@ -4536,13 +4536,13 @@ static HRESULT shader_glsl_alloc(IWineD3DDevice *iface) {
goto
fail
;
}
if
(
!
constant_heap_init
(
&
priv
->
vconst_heap
,
GL_LIMITS
(
vs
hader
_constantsF
)))
if
(
!
constant_heap_init
(
&
priv
->
vconst_heap
,
GL_LIMITS
(
vs
_glsl
_constantsF
)))
{
ERR
(
"Failed to initialize vertex shader constant heap
\n
"
);
goto
fail
;
}
if
(
!
constant_heap_init
(
&
priv
->
pconst_heap
,
GL_LIMITS
(
ps
hader
_constantsF
)))
if
(
!
constant_heap_init
(
&
priv
->
pconst_heap
,
GL_LIMITS
(
ps
_glsl
_constantsF
)))
{
ERR
(
"Failed to initialize pixel shader constant heap
\n
"
);
goto
fail
;
...
...
@@ -4616,7 +4616,7 @@ static void shader_glsl_get_caps(WINED3DDEVTYPE devtype,
else
pCaps
->
VertexShaderVersion
=
WINED3DVS_VERSION
(
3
,
0
);
TRACE_
(
d3d_caps
)(
"Hardware vertex shader version %d.%d enabled (GLSL)
\n
"
,
(
pCaps
->
VertexShaderVersion
>>
8
)
&
0xff
,
pCaps
->
VertexShaderVersion
&
0xff
);
pCaps
->
MaxVertexShaderConst
=
GL_LIMITS
(
vs
hader
_constantsF
);
pCaps
->
MaxVertexShaderConst
=
GL_LIMITS
(
vs
_glsl
_constantsF
);
/* Older DX9-class videocards (GeforceFX / Radeon >9500/X*00) only support pixel shader 2.0/2.0a/2.0b.
* In OpenGL the extensions related to GLSL abstract lowlevel GL info away which is needed
...
...
@@ -4635,7 +4635,7 @@ static void shader_glsl_get_caps(WINED3DDEVTYPE devtype,
else
pCaps
->
PixelShaderVersion
=
WINED3DPS_VERSION
(
3
,
0
);
pCaps
->
MaxPixelShaderConst
=
GL_LIMITS
(
ps
hader
_constantsF
);
pCaps
->
MaxPixelShaderConst
=
GL_LIMITS
(
ps
_glsl
_constantsF
);
/* FIXME: The following line is card dependent. -8.0 to 8.0 is the
* Direct3D minimum requirement.
...
...
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