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
70d6304a
Commit
70d6304a
authored
Oct 24, 2009
by
Stefan Dösinger
Committed by
Alexandre Julliard
Oct 26, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Use the shader backend reported constant limit outside the shader backend.
parent
3259c81e
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
41 deletions
+41
-41
context.c
dlls/wined3d/context.c
+8
-8
pixelshader.c
dlls/wined3d/pixelshader.c
+1
-1
stateblock.c
dlls/wined3d/stateblock.c
+21
-21
vertexshader.c
dlls/wined3d/vertexshader.c
+11
-11
No files found.
dlls/wined3d/context.c
View file @
70d6304a
...
...
@@ -1286,13 +1286,13 @@ struct wined3d_context *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceI
if
(
This
->
shader_backend
->
shader_dirtifyable_constants
((
IWineD3DDevice
*
)
This
))
{
/* Create the dirty constants array and initialize them to dirty */
ret
->
vshader_const_dirty
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
ret
->
vshader_const_dirty
)
*
gl_info
->
max_vshader_constants
F
);
sizeof
(
*
ret
->
vshader_const_dirty
)
*
This
->
d3d_vshader_constant
F
);
ret
->
pshader_const_dirty
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
ret
->
pshader_const_dirty
)
*
gl_info
->
max_pshader_constants
F
);
sizeof
(
*
ret
->
pshader_const_dirty
)
*
This
->
d3d_pshader_constant
F
);
memset
(
ret
->
vshader_const_dirty
,
1
,
sizeof
(
*
ret
->
vshader_const_dirty
)
*
gl_info
->
max_vshader_constants
F
);
sizeof
(
*
ret
->
vshader_const_dirty
)
*
This
->
d3d_vshader_constant
F
);
memset
(
ret
->
pshader_const_dirty
,
1
,
sizeof
(
*
ret
->
pshader_const_dirty
)
*
gl_info
->
max_pshader_constants
F
);
sizeof
(
*
ret
->
pshader_const_dirty
)
*
This
->
d3d_pshader_constant
F
);
}
ret
->
free_occlusion_query_size
=
4
;
...
...
@@ -2059,14 +2059,14 @@ struct wined3d_context *ActivateContext(IWineD3DDeviceImpl *This, IWineD3DSurfac
if
(
context
->
vshader_const_dirty
)
{
memset
(
context
->
vshader_const_dirty
,
1
,
sizeof
(
*
context
->
vshader_const_dirty
)
*
gl_info
->
max_vshader_constants
F
);
This
->
highest_dirty_vs_const
=
gl_info
->
max_vshader_constants
F
;
sizeof
(
*
context
->
vshader_const_dirty
)
*
This
->
d3d_vshader_constant
F
);
This
->
highest_dirty_vs_const
=
This
->
d3d_vshader_constant
F
;
}
if
(
context
->
pshader_const_dirty
)
{
memset
(
context
->
pshader_const_dirty
,
1
,
sizeof
(
*
context
->
pshader_const_dirty
)
*
gl_info
->
max_pshader_constants
F
);
This
->
highest_dirty_ps_const
=
gl_info
->
max_pshader_constants
F
;
sizeof
(
*
context
->
pshader_const_dirty
)
*
This
->
d3d_pshader_constant
F
);
This
->
highest_dirty_ps_const
=
This
->
d3d_pshader_constant
F
;
}
}
...
...
dlls/wined3d/pixelshader.c
View file @
70d6304a
...
...
@@ -247,7 +247,7 @@ static HRESULT pixelshader_set_function(IWineD3DPixelShaderImpl *shader,
/* Second pass: figure out which registers are used, what the semantics are, etc.. */
hr
=
shader_get_registers_used
((
IWineD3DBaseShader
*
)
shader
,
fe
,
reg_maps
,
NULL
,
shader
->
input_signature
,
NULL
,
byte_code
,
gl_info
->
max_pshader_constants
F
);
byte_code
,
device
->
d3d_pshader_constant
F
);
if
(
FAILED
(
hr
))
return
hr
;
pshader_set_limits
(
shader
);
...
...
dlls/wined3d/stateblock.c
View file @
70d6304a
...
...
@@ -194,31 +194,31 @@ static const DWORD vertex_states_sampler[] =
*/
static
HRESULT
stateblock_allocate_shader_constants
(
IWineD3DStateBlockImpl
*
object
)
{
const
struct
wined3d_gl_info
*
gl_info
=
&
object
->
wineD3DDevice
->
adapter
->
gl_info
;
IWineD3DDeviceImpl
*
device
=
object
->
wineD3DDevice
;
/* Allocate space for floating point constants */
object
->
pixelShaderConstantF
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
float
)
*
gl_info
->
max_pshader_constants
F
*
4
);
sizeof
(
float
)
*
device
->
d3d_pshader_constant
F
*
4
);
if
(
!
object
->
pixelShaderConstantF
)
goto
fail
;
object
->
changed
.
pixelShaderConstantsF
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
BOOL
)
*
gl_info
->
max_pshader_constants
F
);
sizeof
(
BOOL
)
*
device
->
d3d_pshader_constant
F
);
if
(
!
object
->
changed
.
pixelShaderConstantsF
)
goto
fail
;
object
->
vertexShaderConstantF
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
float
)
*
gl_info
->
max_vshader_constants
F
*
4
);
sizeof
(
float
)
*
device
->
d3d_vshader_constant
F
*
4
);
if
(
!
object
->
vertexShaderConstantF
)
goto
fail
;
object
->
changed
.
vertexShaderConstantsF
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
BOOL
)
*
gl_info
->
max_vshader_constants
F
);
sizeof
(
BOOL
)
*
device
->
d3d_vshader_constant
F
);
if
(
!
object
->
changed
.
vertexShaderConstantsF
)
goto
fail
;
object
->
contained_vs_consts_f
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
DWORD
)
*
gl_info
->
max_vshader_constants
F
);
sizeof
(
DWORD
)
*
device
->
d3d_vshader_constant
F
);
if
(
!
object
->
contained_vs_consts_f
)
goto
fail
;
object
->
contained_ps_consts_f
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
DWORD
)
*
gl_info
->
max_pshader_constants
F
);
sizeof
(
DWORD
)
*
device
->
d3d_pshader_constant
F
);
if
(
!
object
->
contained_ps_consts_f
)
goto
fail
;
return
WINED3D_OK
;
...
...
@@ -242,7 +242,7 @@ static inline void stateblock_set_bits(DWORD *map, UINT map_size)
}
/* Set all members of a stateblock savedstate to the given value */
static
void
stateblock_savedstates_set_all
(
SAVEDSTATES
*
states
,
const
struct
wined3d_gl_info
*
gl_info
)
static
void
stateblock_savedstates_set_all
(
SAVEDSTATES
*
states
,
DWORD
vs_consts
,
DWORD
ps_consts
)
{
unsigned
int
i
;
...
...
@@ -271,11 +271,11 @@ static void stateblock_savedstates_set_all(SAVEDSTATES *states, const struct win
states
->
vertexShaderConstantsI
=
0xffff
;
/* Dynamically sized arrays */
memset
(
states
->
pixelShaderConstantsF
,
TRUE
,
sizeof
(
BOOL
)
*
gl_info
->
max_pshader_constantsF
);
memset
(
states
->
vertexShaderConstantsF
,
TRUE
,
sizeof
(
BOOL
)
*
gl_info
->
max_vshader_constantsF
);
memset
(
states
->
pixelShaderConstantsF
,
TRUE
,
sizeof
(
BOOL
)
*
ps_consts
);
memset
(
states
->
vertexShaderConstantsF
,
TRUE
,
sizeof
(
BOOL
)
*
vs_consts
);
}
static
void
stateblock_savedstates_set_pixel
(
SAVEDSTATES
*
states
,
const
struct
wined3d_gl_info
*
gl_info
)
static
void
stateblock_savedstates_set_pixel
(
SAVEDSTATES
*
states
,
const
DWORD
num_constants
)
{
DWORD
texture_mask
=
0
;
WORD
sampler_mask
=
0
;
...
...
@@ -298,10 +298,10 @@ static void stateblock_savedstates_set_pixel(SAVEDSTATES *states, const struct w
states
->
pixelShaderConstantsB
=
0xffff
;
states
->
pixelShaderConstantsI
=
0xffff
;
memset
(
states
->
pixelShaderConstantsF
,
TRUE
,
sizeof
(
BOOL
)
*
gl_info
->
max_pshader_constantsF
);
memset
(
states
->
pixelShaderConstantsF
,
TRUE
,
sizeof
(
BOOL
)
*
num_constants
);
}
static
void
stateblock_savedstates_set_vertex
(
SAVEDSTATES
*
states
,
const
struct
wined3d_gl_info
*
gl_info
)
static
void
stateblock_savedstates_set_vertex
(
SAVEDSTATES
*
states
,
const
DWORD
num_constants
)
{
DWORD
texture_mask
=
0
;
WORD
sampler_mask
=
0
;
...
...
@@ -325,12 +325,12 @@ static void stateblock_savedstates_set_vertex(SAVEDSTATES *states, const struct
states
->
vertexShaderConstantsB
=
0xffff
;
states
->
vertexShaderConstantsI
=
0xffff
;
memset
(
states
->
vertexShaderConstantsF
,
TRUE
,
sizeof
(
BOOL
)
*
gl_info
->
max_vshader_constantsF
);
memset
(
states
->
vertexShaderConstantsF
,
TRUE
,
sizeof
(
BOOL
)
*
num_constants
);
}
void
stateblock_init_contained_states
(
IWineD3DStateBlockImpl
*
stateblock
)
{
const
struct
wined3d_gl_info
*
gl_info
=
&
stateblock
->
wineD3DDevice
->
adapter
->
gl_info
;
IWineD3DDeviceImpl
*
device
=
stateblock
->
wineD3DDevice
;
unsigned
int
i
,
j
;
for
(
i
=
0
;
i
<=
WINEHIGHEST_RENDER_STATE
>>
5
;
++
i
)
...
...
@@ -357,7 +357,7 @@ void stateblock_init_contained_states(IWineD3DStateBlockImpl *stateblock)
}
}
for
(
i
=
0
;
i
<
gl_info
->
max_vshader_constants
F
;
++
i
)
for
(
i
=
0
;
i
<
device
->
d3d_vshader_constant
F
;
++
i
)
{
if
(
stateblock
->
changed
.
vertexShaderConstantsF
[
i
])
{
...
...
@@ -384,7 +384,7 @@ void stateblock_init_contained_states(IWineD3DStateBlockImpl *stateblock)
}
}
for
(
i
=
0
;
i
<
gl_info
->
max_pshader_constants
F
;
++
i
)
for
(
i
=
0
;
i
<
device
->
d3d_pshader_constant
F
;
++
i
)
{
if
(
stateblock
->
changed
.
pixelShaderConstantsF
[
i
])
{
...
...
@@ -1339,7 +1339,6 @@ static const IWineD3DStateBlockVtbl IWineD3DStateBlock_Vtbl =
HRESULT
stateblock_init
(
IWineD3DStateBlockImpl
*
stateblock
,
IWineD3DDeviceImpl
*
device
,
WINED3DSTATEBLOCKTYPE
type
,
IUnknown
*
parent
)
{
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
unsigned
int
i
;
HRESULT
hr
;
...
...
@@ -1368,16 +1367,17 @@ HRESULT stateblock_init(IWineD3DStateBlockImpl *stateblock, IWineD3DDeviceImpl *
{
case
WINED3DSBT_ALL
:
stateblock_init_lights
(
stateblock
,
device
->
stateBlock
->
lightMap
);
stateblock_savedstates_set_all
(
&
stateblock
->
changed
,
gl_info
);
stateblock_savedstates_set_all
(
&
stateblock
->
changed
,
device
->
d3d_vshader_constantF
,
device
->
d3d_pshader_constantF
);
break
;
case
WINED3DSBT_PIXELSTATE
:
stateblock_savedstates_set_pixel
(
&
stateblock
->
changed
,
gl_info
);
stateblock_savedstates_set_pixel
(
&
stateblock
->
changed
,
device
->
d3d_pshader_constantF
);
break
;
case
WINED3DSBT_VERTEXSTATE
:
stateblock_init_lights
(
stateblock
,
device
->
stateBlock
->
lightMap
);
stateblock_savedstates_set_vertex
(
&
stateblock
->
changed
,
gl_info
);
stateblock_savedstates_set_vertex
(
&
stateblock
->
changed
,
device
->
d3d_vshader_constantF
);
break
;
default:
...
...
dlls/wined3d/vertexshader.c
View file @
70d6304a
...
...
@@ -37,9 +37,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
static
void
vshader_set_limits
(
IWineD3DVertexShaderImpl
*
This
)
{
const
struct
wined3d_gl_info
*
gl_info
=
&
((
IWineD3DDeviceImpl
*
)
This
->
baseShader
.
device
)
->
adapter
->
gl_info
;
DWORD
shader_version
=
WINED3D_SHADER_VERSION
(
This
->
baseShader
.
reg_maps
.
shader_version
.
major
,
This
->
baseShader
.
reg_maps
.
shader_version
.
minor
);
IWineD3DDeviceImpl
*
device
=
(
IWineD3DDeviceImpl
*
)
This
->
baseShader
.
device
;
This
->
baseShader
.
limits
.
texcoord
=
0
;
This
->
baseShader
.
limits
.
attributes
=
16
;
...
...
@@ -58,7 +58,7 @@ static void vshader_set_limits(IWineD3DVertexShaderImpl *This)
This
->
baseShader
.
limits
.
label
=
0
;
/* TODO: vs_1_1 has a minimum of 96 constants. What happens if a vs_1_1 shader is used
* on a vs_3_0 capable card that has 256 constants? */
This
->
baseShader
.
limits
.
constant_float
=
min
(
256
,
gl_info
->
max_vshader_constants
F
);
This
->
baseShader
.
limits
.
constant_float
=
min
(
256
,
device
->
d3d_vshader_constant
F
);
break
;
case
WINED3D_SHADER_VERSION
(
2
,
0
):
...
...
@@ -70,7 +70,7 @@ static void vshader_set_limits(IWineD3DVertexShaderImpl *This)
This
->
baseShader
.
limits
.
packed_output
=
0
;
This
->
baseShader
.
limits
.
sampler
=
0
;
This
->
baseShader
.
limits
.
label
=
16
;
This
->
baseShader
.
limits
.
constant_float
=
min
(
256
,
gl_info
->
max_vshader_constants
F
);
This
->
baseShader
.
limits
.
constant_float
=
min
(
256
,
device
->
d3d_vshader_constant
F
);
break
;
case
WINED3D_SHADER_VERSION
(
4
,
0
):
...
...
@@ -89,7 +89,7 @@ static void vshader_set_limits(IWineD3DVertexShaderImpl *This)
* of supporting much more(GL drivers advertise 1024). d3d9.dll and d3d8.dll clamp the
* wined3d-advertised maximum. Clamp the constant limit for <= 3.0 shaders to 256.s
* use constant buffers */
This
->
baseShader
.
limits
.
constant_float
=
min
(
256
,
gl_info
->
max_vshader_constants
F
);
This
->
baseShader
.
limits
.
constant_float
=
min
(
256
,
device
->
d3d_vshader_constant
F
);
break
;
default:
...
...
@@ -100,7 +100,7 @@ static void vshader_set_limits(IWineD3DVertexShaderImpl *This)
This
->
baseShader
.
limits
.
packed_output
=
0
;
This
->
baseShader
.
limits
.
sampler
=
0
;
This
->
baseShader
.
limits
.
label
=
16
;
This
->
baseShader
.
limits
.
constant_float
=
min
(
256
,
gl_info
->
max_vshader_constants
F
);
This
->
baseShader
.
limits
.
constant_float
=
min
(
256
,
device
->
d3d_vshader_constant
F
);
FIXME
(
"Unrecognized vertex shader version %u.%u
\n
"
,
This
->
baseShader
.
reg_maps
.
shader_version
.
major
,
This
->
baseShader
.
reg_maps
.
shader_version
.
minor
);
...
...
@@ -260,11 +260,11 @@ static HRESULT vertexshader_set_function(IWineD3DVertexShaderImpl *shader,
list_init
(
&
shader
->
baseShader
.
constantsI
);
/* Second pass: figure out registers used, semantics, etc.. */
shader
->
min_rel_offset
=
gl_info
->
max_vshader_constants
F
;
shader
->
min_rel_offset
=
device
->
d3d_vshader_constant
F
;
shader
->
max_rel_offset
=
0
;
hr
=
shader_get_registers_used
((
IWineD3DBaseShader
*
)
shader
,
fe
,
reg_maps
,
shader
->
attributes
,
NULL
,
shader
->
output_signature
,
byte_code
,
gl_info
->
max_vshader_constants
F
);
byte_code
,
device
->
d3d_vshader_constant
F
);
if
(
hr
!=
WINED3D_OK
)
return
hr
;
if
(
output_signature
)
...
...
@@ -317,16 +317,16 @@ static HRESULT vertexshader_set_function(IWineD3DVertexShaderImpl *shader,
static
HRESULT
WINAPI
IWIneD3DVertexShaderImpl_SetLocalConstantsF
(
IWineD3DVertexShader
*
iface
,
UINT
start_idx
,
const
float
*
src_data
,
UINT
count
)
{
IWineD3DVertexShaderImpl
*
This
=
(
IWineD3DVertexShaderImpl
*
)
iface
;
const
struct
wined3d_gl_info
*
gl_info
=
&
((
IWineD3DDeviceImpl
*
)
This
->
baseShader
.
device
)
->
adapter
->
gl_info
;
IWineD3DDeviceImpl
*
device
=
(
IWineD3DDeviceImpl
*
)
This
->
baseShader
.
device
;
UINT
i
,
end_idx
;
TRACE
(
"(%p) : start_idx %u, src_data %p, count %u
\n
"
,
This
,
start_idx
,
src_data
,
count
);
end_idx
=
start_idx
+
count
;
if
(
end_idx
>
gl_info
->
max_vshader_constants
F
)
if
(
end_idx
>
device
->
d3d_vshader_constant
F
)
{
WARN
(
"end_idx %u > float constants limit %u
\n
"
,
end_idx
,
gl_info
->
max_vshader_constants
F
);
end_idx
=
gl_info
->
max_vshader_constants
F
;
WARN
(
"end_idx %u > float constants limit %u
\n
"
,
end_idx
,
device
->
d3d_vshader_constant
F
);
end_idx
=
device
->
d3d_vshader_constant
F
;
}
for
(
i
=
start_idx
;
i
<
end_idx
;
++
i
)
{
...
...
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