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
b5637a93
Commit
b5637a93
authored
Dec 07, 2010
by
Henri Verbeet
Committed by
Alexandre Julliard
Dec 08, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Store an IWineD3DDeviceImpl pointer in IWineD3DBaseShaderClass.
parent
018a4849
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
33 deletions
+35
-33
arb_program_shader.c
dlls/wined3d/arb_program_shader.c
+17
-15
glsl_shader.c
dlls/wined3d/glsl_shader.c
+10
-10
shader.c
dlls/wined3d/shader.c
+7
-7
wined3d_private.h
dlls/wined3d/wined3d_private.h
+1
-1
No files found.
dlls/wined3d/arb_program_shader.c
View file @
b5637a93
...
...
@@ -1328,7 +1328,7 @@ static void shader_hw_sample(const struct wined3d_shader_instruction *ins, DWORD
const
char
*
tex_type
;
BOOL
np2_fixup
=
FALSE
;
IWineD3DBaseShaderImpl
*
This
=
(
IWineD3DBaseShaderImpl
*
)
ins
->
ctx
->
shader
;
IWineD3DDeviceImpl
*
device
=
(
IWineD3DDeviceImpl
*
)
This
->
baseShader
.
device
;
IWineD3DDeviceImpl
*
device
=
This
->
baseShader
.
device
;
struct
shader_arb_ctx_priv
*
priv
=
ins
->
ctx
->
backend_data
;
const
char
*
mod
;
BOOL
pshader
=
shader_is_pshader_version
(
ins
->
ctx
->
reg_maps
->
shader_version
.
type
);
...
...
@@ -3899,7 +3899,7 @@ static void init_output_registers(IWineD3DVertexShaderImpl *shader, DWORD sig_nu
"result.texcoord[0]"
,
"result.texcoord[1]"
,
"result.texcoord[2]"
,
"result.texcoord[3]"
,
"result.texcoord[4]"
,
"result.texcoord[5]"
,
"result.texcoord[6]"
,
"result.texcoord[7]"
};
IWineD3DDeviceImpl
*
device
=
(
IWineD3DDeviceImpl
*
)
shader
->
baseShader
.
device
;
IWineD3DDeviceImpl
*
device
=
shader
->
baseShader
.
device
;
IWineD3DBaseShaderClass
*
baseshader
=
&
shader
->
baseShader
;
const
struct
wined3d_shader_signature_element
*
sig
;
const
char
*
semantic_name
;
...
...
@@ -4162,7 +4162,7 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This,
*/
if
(
!
gl_info
->
supported
[
NV_VERTEX_PROGRAM
])
{
IWineD3DDeviceImpl
*
device
=
(
IWineD3DDeviceImpl
*
)
This
->
baseShader
.
device
;
IWineD3DDeviceImpl
*
device
=
This
->
baseShader
.
device
;
const
char
*
color_init
=
arb_get_helper_value
(
WINED3D_SHADER_TYPE_VERTEX
,
ARB_0001
);
shader_addline
(
buffer
,
"MOV result.color.secondary, %s;
\n
"
,
color_init
);
...
...
@@ -4232,7 +4232,7 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This,
/* GL locking is done by the caller */
static
struct
arb_ps_compiled_shader
*
find_arb_pshader
(
IWineD3DPixelShaderImpl
*
shader
,
const
struct
arb_ps_compile_args
*
args
)
{
IWineD3DDeviceImpl
*
device
=
(
IWineD3DDeviceImpl
*
)
shader
->
baseShader
.
device
;
IWineD3DDeviceImpl
*
device
=
shader
->
baseShader
.
device
;
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
UINT
i
;
DWORD
new_size
;
...
...
@@ -4327,14 +4327,15 @@ static inline BOOL vs_args_equal(const struct arb_vs_compile_args *stored, const
static
struct
arb_vs_compiled_shader
*
find_arb_vshader
(
IWineD3DVertexShaderImpl
*
shader
,
const
struct
arb_vs_compile_args
*
args
)
{
IWineD3DDeviceImpl
*
device
=
shader
->
baseShader
.
device
;
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
DWORD
use_map
=
device
->
strided_streams
.
use_map
;
UINT
i
;
DWORD
new_size
;
struct
arb_vs_compiled_shader
*
new_array
;
DWORD
use_map
=
((
IWineD3DDeviceImpl
*
)
shader
->
baseShader
.
device
)
->
strided_streams
.
use_map
;
struct
wined3d_shader_buffer
buffer
;
struct
arb_vshader_private
*
shader_data
;
GLuint
ret
;
const
struct
wined3d_gl_info
*
gl_info
=
&
((
IWineD3DDeviceImpl
*
)
shader
->
baseShader
.
device
)
->
adapter
->
gl_info
;
if
(
!
shader
->
baseShader
.
backend_data
)
{
...
...
@@ -4412,9 +4413,10 @@ static struct arb_vs_compiled_shader *find_arb_vshader(IWineD3DVertexShaderImpl
static
void
find_arb_ps_compile_args
(
const
struct
wined3d_state
*
state
,
IWineD3DPixelShaderImpl
*
shader
,
struct
arb_ps_compile_args
*
args
)
{
IWineD3DDeviceImpl
*
device
=
shader
->
baseShader
.
device
;
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
int
i
;
WORD
int_skip
;
const
struct
wined3d_gl_info
*
gl_info
=
&
((
IWineD3DDeviceImpl
*
)
shader
->
baseShader
.
device
)
->
adapter
->
gl_info
;
find_ps_compile_args
(
state
,
shader
,
&
args
->
super
);
...
...
@@ -4431,7 +4433,7 @@ static void find_arb_ps_compile_args(const struct wined3d_state *state,
* is quite expensive because it forces the driver to disable early Z discards. It is cheaper to
* duplicate the shader than have a no-op KIL instruction in every shader
*/
if
(
(
!
((
IWineD3DDeviceImpl
*
)
shader
->
baseShader
.
device
)
->
vs_clipping
)
&&
use_vs
(
state
)
if
(
!
device
->
vs_clipping
&&
use_vs
(
state
)
&&
state
->
render_states
[
WINED3DRS_CLIPPING
]
&&
state
->
render_states
[
WINED3DRS_CLIPPLANEENABLE
])
args
->
clip
=
1
;
...
...
@@ -4466,10 +4468,10 @@ static void find_arb_ps_compile_args(const struct wined3d_state *state,
static
void
find_arb_vs_compile_args
(
const
struct
wined3d_state
*
state
,
IWineD3DVertexShaderImpl
*
shader
,
struct
arb_vs_compile_args
*
args
)
{
IWineD3DDeviceImpl
*
device
=
shader
->
baseShader
.
device
;
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
int
i
;
WORD
int_skip
;
IWineD3DDeviceImpl
*
dev
=
(
IWineD3DDeviceImpl
*
)
shader
->
baseShader
.
device
;
const
struct
wined3d_gl_info
*
gl_info
=
&
dev
->
adapter
->
gl_info
;
find_vs_compile_args
(
state
,
shader
,
&
args
->
super
);
...
...
@@ -4485,7 +4487,7 @@ static void find_arb_vs_compile_args(const struct wined3d_state *state,
else
{
args
->
ps_signature
=
~
0
;
if
(
!
dev
->
vs_clipping
)
if
(
!
device
->
vs_clipping
)
{
args
->
clip
.
boolclip
.
clip_texcoord
=
ffp_clip_emul
(
state
)
?
gl_info
->
limits
.
texture_stages
:
0
;
}
...
...
@@ -4508,9 +4510,9 @@ static void find_arb_vs_compile_args(const struct wined3d_state *state,
args
->
clip
.
boolclip
.
bools
|=
(
1
<<
i
);
}
args
->
vertex
.
samplers
[
0
]
=
dev
->
texUnitMap
[
MAX_FRAGMENT_SAMPLERS
+
0
];
args
->
vertex
.
samplers
[
1
]
=
dev
->
texUnitMap
[
MAX_FRAGMENT_SAMPLERS
+
1
];
args
->
vertex
.
samplers
[
2
]
=
dev
->
texUnitMap
[
MAX_FRAGMENT_SAMPLERS
+
2
];
args
->
vertex
.
samplers
[
0
]
=
dev
ice
->
texUnitMap
[
MAX_FRAGMENT_SAMPLERS
+
0
];
args
->
vertex
.
samplers
[
1
]
=
dev
ice
->
texUnitMap
[
MAX_FRAGMENT_SAMPLERS
+
1
];
args
->
vertex
.
samplers
[
2
]
=
dev
ice
->
texUnitMap
[
MAX_FRAGMENT_SAMPLERS
+
2
];
args
->
vertex
.
samplers
[
3
]
=
0
;
/* Skip if unused or local */
...
...
@@ -4701,7 +4703,7 @@ static void shader_arb_deselect_depth_blt(void *shader_priv, const struct wined3
static
void
shader_arb_destroy
(
IWineD3DBaseShader
*
iface
)
{
IWineD3DBaseShaderImpl
*
baseShader
=
(
IWineD3DBaseShaderImpl
*
)
iface
;
IWineD3DDeviceImpl
*
device
=
(
IWineD3DDeviceImpl
*
)
baseShader
->
baseShader
.
device
;
IWineD3DDeviceImpl
*
device
=
baseShader
->
baseShader
.
device
;
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
if
(
shader_is_pshader_version
(
baseShader
->
baseShader
.
reg_maps
.
shader_version
.
type
))
...
...
dlls/wined3d/glsl_shader.c
View file @
b5637a93
...
...
@@ -910,7 +910,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
const
struct
wined3d_shader_reg_maps
*
reg_maps
,
struct
shader_glsl_ctx_priv
*
ctx_priv
)
{
IWineD3DBaseShaderImpl
*
This
=
(
IWineD3DBaseShaderImpl
*
)
iface
;
IWineD3DDeviceImpl
*
device
=
(
IWineD3DDeviceImpl
*
)
This
->
baseShader
.
device
;
IWineD3DDeviceImpl
*
device
=
This
->
baseShader
.
device
;
const
struct
wined3d_state
*
state
=
&
device
->
stateBlock
->
state
;
const
struct
ps_compile_args
*
ps_args
=
ctx_priv
->
cur_ps_args
;
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
...
...
@@ -3019,7 +3019,7 @@ static void shader_glsl_ret(const struct wined3d_shader_instruction *ins)
static
void
shader_glsl_tex
(
const
struct
wined3d_shader_instruction
*
ins
)
{
IWineD3DBaseShaderImpl
*
shader
=
(
IWineD3DBaseShaderImpl
*
)
ins
->
ctx
->
shader
;
IWineD3DDeviceImpl
*
device
Impl
=
(
IWineD3DDeviceImpl
*
)
shader
->
baseShader
.
device
;
IWineD3DDeviceImpl
*
device
=
shader
->
baseShader
.
device
;
DWORD
shader_version
=
WINED3D_SHADER_VERSION
(
ins
->
ctx
->
reg_maps
->
shader_version
.
major
,
ins
->
ctx
->
reg_maps
->
shader_version
.
minor
);
glsl_sample_function_t
sample_function
;
...
...
@@ -3032,7 +3032,7 @@ static void shader_glsl_tex(const struct wined3d_shader_instruction *ins)
* 2.0+: Use provided sampler source. */
if
(
shader_version
<
WINED3D_SHADER_VERSION
(
2
,
0
))
sampler_idx
=
ins
->
dst
[
0
].
reg
.
idx
;
else
sampler_idx
=
ins
->
src
[
1
].
reg
.
idx
;
texture
=
device
Impl
->
stateBlock
->
state
.
textures
[
sampler_idx
];
texture
=
device
->
stateBlock
->
state
.
textures
[
sampler_idx
];
if
(
shader_version
<
WINED3D_SHADER_VERSION
(
1
,
4
))
{
...
...
@@ -3109,7 +3109,7 @@ static void shader_glsl_tex(const struct wined3d_shader_instruction *ins)
static
void
shader_glsl_texldd
(
const
struct
wined3d_shader_instruction
*
ins
)
{
IWineD3DBaseShaderImpl
*
This
=
(
IWineD3DBaseShaderImpl
*
)
ins
->
ctx
->
shader
;
IWineD3DDeviceImpl
*
deviceImpl
=
(
IWineD3DDeviceImpl
*
)
This
->
baseShader
.
device
;
IWineD3DDeviceImpl
*
device
=
This
->
baseShader
.
device
;
const
struct
wined3d_gl_info
*
gl_info
=
ins
->
ctx
->
gl_info
;
glsl_sample_function_t
sample_function
;
glsl_src_param_t
coord_param
,
dx_param
,
dy_param
;
...
...
@@ -3126,7 +3126,7 @@ static void shader_glsl_texldd(const struct wined3d_shader_instruction *ins)
}
sampler_idx
=
ins
->
src
[
1
].
reg
.
idx
;
texture
=
device
Impl
->
stateBlock
->
state
.
textures
[
sampler_idx
];
texture
=
device
->
stateBlock
->
state
.
textures
[
sampler_idx
];
if
(
texture
&&
texture
->
baseTexture
.
target
==
GL_TEXTURE_RECTANGLE_ARB
)
sample_flags
|=
WINED3D_GLSL_SAMPLE_RECT
;
...
...
@@ -3142,7 +3142,7 @@ static void shader_glsl_texldd(const struct wined3d_shader_instruction *ins)
static
void
shader_glsl_texldl
(
const
struct
wined3d_shader_instruction
*
ins
)
{
IWineD3DBaseShaderImpl
*
This
=
(
IWineD3DBaseShaderImpl
*
)
ins
->
ctx
->
shader
;
IWineD3DDeviceImpl
*
deviceImpl
=
(
IWineD3DDeviceImpl
*
)
This
->
baseShader
.
device
;
IWineD3DDeviceImpl
*
device
=
This
->
baseShader
.
device
;
const
struct
wined3d_gl_info
*
gl_info
=
ins
->
ctx
->
gl_info
;
glsl_sample_function_t
sample_function
;
glsl_src_param_t
coord_param
,
lod_param
;
...
...
@@ -3152,7 +3152,7 @@ static void shader_glsl_texldl(const struct wined3d_shader_instruction *ins)
IWineD3DBaseTextureImpl
*
texture
;
sampler_idx
=
ins
->
src
[
1
].
reg
.
idx
;
texture
=
device
Impl
->
stateBlock
->
state
.
textures
[
sampler_idx
];
texture
=
device
->
stateBlock
->
state
.
textures
[
sampler_idx
];
if
(
texture
&&
texture
->
baseTexture
.
target
==
GL_TEXTURE_RECTANGLE_ARB
)
sample_flags
|=
WINED3D_GLSL_SAMPLE_RECT
;
...
...
@@ -4135,7 +4135,7 @@ static GLhandleARB find_glsl_pshader(const struct wined3d_context *context,
struct
wined3d_shader_buffer
*
buffer
,
IWineD3DPixelShaderImpl
*
shader
,
const
struct
ps_compile_args
*
args
,
const
struct
ps_np2fixup_info
**
np2fixup_info
)
{
struct
wined3d_state
*
state
=
&
((
IWineD3DDeviceImpl
*
)
shader
->
baseShader
.
device
)
->
stateBlock
->
state
;
struct
wined3d_state
*
state
=
&
shader
->
baseShader
.
device
->
stateBlock
->
state
;
UINT
i
;
DWORD
new_size
;
struct
glsl_ps_compiled_shader
*
new_array
;
...
...
@@ -4216,7 +4216,7 @@ static GLhandleARB find_glsl_vshader(const struct wined3d_context *context,
UINT
i
;
DWORD
new_size
;
struct
glsl_vs_compiled_shader
*
new_array
;
DWORD
use_map
=
((
IWineD3DDeviceImpl
*
)
shader
->
baseShader
.
device
)
->
strided_streams
.
use_map
;
DWORD
use_map
=
shader
->
baseShader
.
device
->
strided_streams
.
use_map
;
struct
glsl_vshader_private
*
shader_data
;
GLhandleARB
ret
;
...
...
@@ -4671,7 +4671,7 @@ static void shader_glsl_deselect_depth_blt(void *shader_priv, const struct wined
static
void
shader_glsl_destroy
(
IWineD3DBaseShader
*
iface
)
{
const
struct
list
*
linked_programs
;
IWineD3DBaseShaderImpl
*
This
=
(
IWineD3DBaseShaderImpl
*
)
iface
;
IWineD3DDeviceImpl
*
device
=
(
IWineD3DDeviceImpl
*
)
This
->
baseShader
.
device
;
IWineD3DDeviceImpl
*
device
=
This
->
baseShader
.
device
;
struct
shader_glsl_priv
*
priv
=
device
->
shader_priv
;
const
struct
wined3d_gl_info
*
gl_info
;
struct
wined3d_context
*
context
;
...
...
dlls/wined3d/shader.c
View file @
b5637a93
...
...
@@ -302,7 +302,7 @@ static void shader_init(struct IWineD3DBaseShaderClass *shader, IWineD3DDeviceIm
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
)
{
shader
->
ref
=
1
;
shader
->
device
=
(
IWineD3DDevice
*
)
device
;
shader
->
device
=
device
;
shader
->
parent
=
parent
;
shader
->
parent_ops
=
parent_ops
;
list_init
(
&
shader
->
linked_programs
);
...
...
@@ -1167,7 +1167,7 @@ void shader_generate_main(IWineD3DBaseShader *iface, struct wined3d_shader_buffe
const
struct
wined3d_shader_reg_maps
*
reg_maps
,
const
DWORD
*
byte_code
,
void
*
backend_ctx
)
{
IWineD3DBaseShaderImpl
*
shader
=
(
IWineD3DBaseShaderImpl
*
)
iface
;
IWineD3DDeviceImpl
*
device
=
(
IWineD3DDeviceImpl
*
)
shader
->
baseShader
.
device
;
IWineD3DDeviceImpl
*
device
=
shader
->
baseShader
.
device
;
const
struct
wined3d_shader_frontend
*
fe
=
shader
->
baseShader
.
frontend
;
void
*
fe_data
=
shader
->
baseShader
.
frontend_data
;
struct
wined3d_shader_src_param
dst_rel_addr
[
2
];
...
...
@@ -1479,7 +1479,7 @@ static void shader_cleanup(IWineD3DBaseShader *iface)
{
IWineD3DBaseShaderImpl
*
shader
=
(
IWineD3DBaseShaderImpl
*
)
iface
;
((
IWineD3DDeviceImpl
*
)
shader
->
baseShader
.
device
)
->
shader_backend
->
shader_destroy
(
iface
);
shader
->
baseShader
.
device
->
shader_backend
->
shader_destroy
(
iface
);
HeapFree
(
GetProcessHeap
(),
0
,
shader
->
baseShader
.
reg_maps
.
constf
);
HeapFree
(
GetProcessHeap
(),
0
,
shader
->
baseShader
.
function
);
shader_delete_constant_list
(
&
shader
->
baseShader
.
constantsF
);
...
...
@@ -1688,7 +1688,7 @@ static HRESULT STDMETHODCALLTYPE vertexshader_SetLocalConstantsF(IWineD3DVertexS
UINT
start_idx
,
const
float
*
src_data
,
UINT
count
)
{
IWineD3DVertexShaderImpl
*
shader
=
(
IWineD3DVertexShaderImpl
*
)
iface
;
IWineD3DDeviceImpl
*
device
=
(
IWineD3DDeviceImpl
*
)
shader
->
baseShader
.
device
;
IWineD3DDeviceImpl
*
device
=
shader
->
baseShader
.
device
;
UINT
i
,
end_idx
;
TRACE
(
"iface %p, start_idx %u, src_data %p, count %u.
\n
"
,
iface
,
start_idx
,
src_data
,
count
);
...
...
@@ -1734,7 +1734,7 @@ void find_vs_compile_args(const struct wined3d_state *state,
==
WINED3DFOG_NONE
?
VS_FOG_COORD
:
VS_FOG_Z
;
args
->
clip_enabled
=
state
->
render_states
[
WINED3DRS_CLIPPING
]
&&
state
->
render_states
[
WINED3DRS_CLIPPLANEENABLE
];
args
->
swizzle_map
=
((
IWineD3DDeviceImpl
*
)
shader
->
baseShader
.
device
)
->
strided_streams
.
swizzle_map
;
args
->
swizzle_map
=
shader
->
baseShader
.
device
->
strided_streams
.
swizzle_map
;
}
static
BOOL
match_usage
(
BYTE
usage1
,
BYTE
usage_idx1
,
BYTE
usage2
,
BYTE
usage_idx2
)
...
...
@@ -1771,7 +1771,7 @@ static void vertexshader_set_limits(IWineD3DVertexShaderImpl *shader)
{
DWORD
shader_version
=
WINED3D_SHADER_VERSION
(
shader
->
baseShader
.
reg_maps
.
shader_version
.
major
,
shader
->
baseShader
.
reg_maps
.
shader_version
.
minor
);
IWineD3DDeviceImpl
*
device
=
(
IWineD3DDeviceImpl
*
)
shader
->
baseShader
.
device
;
IWineD3DDeviceImpl
*
device
=
shader
->
baseShader
.
device
;
shader
->
baseShader
.
limits
.
texcoord
=
0
;
shader
->
baseShader
.
limits
.
attributes
=
16
;
...
...
@@ -2066,7 +2066,7 @@ static const IWineD3DPixelShaderVtbl IWineD3DPixelShader_Vtbl =
void
find_ps_compile_args
(
const
struct
wined3d_state
*
state
,
IWineD3DPixelShaderImpl
*
shader
,
struct
ps_compile_args
*
args
)
{
IWineD3DDeviceImpl
*
device
=
(
IWineD3DDeviceImpl
*
)
shader
->
baseShader
.
device
;
IWineD3DDeviceImpl
*
device
=
shader
->
baseShader
.
device
;
IWineD3DBaseTextureImpl
*
texture
;
UINT
i
;
...
...
dlls/wined3d/wined3d_private.h
View file @
b5637a93
...
...
@@ -2760,7 +2760,7 @@ typedef struct IWineD3DBaseShaderClass
struct
wined3d_shader_signature_element
output_signature
[
MAX_REG_OUTPUT
];
/* Pointer to the parent device */
IWineD3DDevice
*
device
;
struct
IWineD3DDeviceImpl
*
device
;
struct
list
shader_list_entry
;
}
IWineD3DBaseShaderClass
;
...
...
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