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
f88c6e5c
Commit
f88c6e5c
authored
Sep 25, 2009
by
Henri Verbeet
Committed by
Alexandre Julliard
Sep 25, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Move common shader fields to IWineD3DBaseShaderClass.
parent
77086e8e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
61 additions
and
58 deletions
+61
-58
arb_program_shader.c
dlls/wined3d/arb_program_shader.c
+17
-15
baseshader.c
dlls/wined3d/baseshader.c
+6
-2
glsl_shader.c
dlls/wined3d/glsl_shader.c
+26
-14
pixelshader.c
dlls/wined3d/pixelshader.c
+3
-6
vertexshader.c
dlls/wined3d/vertexshader.c
+3
-6
wined3d_private.h
dlls/wined3d/wined3d_private.h
+6
-15
No files found.
dlls/wined3d/arb_program_shader.c
View file @
f88c6e5c
...
...
@@ -3242,7 +3242,7 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShaderImpl *This, struct
struct
shader_arb_ctx_priv
priv_ctx
;
BOOL
dcl_tmp
=
args
->
super
.
srgb_correction
,
dcl_td
=
FALSE
;
BOOL
want_nv_prog
=
FALSE
;
struct
arb_pshader_private
*
shader_priv
=
This
->
ba
ckend_priv
;
struct
arb_pshader_private
*
shader_priv
=
This
->
ba
seShader
.
backend_data
;
GLint
errPos
;
DWORD
map
;
...
...
@@ -3970,13 +3970,14 @@ static struct arb_ps_compiled_shader *find_arb_pshader(IWineD3DPixelShaderImpl *
struct
arb_pshader_private
*
shader_data
;
GLuint
ret
;
if
(
!
shader
->
backend_priv
)
{
if
(
!
shader
->
baseShader
.
backend_data
)
{
IWineD3DDeviceImpl
*
device
=
(
IWineD3DDeviceImpl
*
)
shader
->
baseShader
.
device
;
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
struct
shader_arb_priv
*
priv
=
device
->
shader_priv
;
shader
->
ba
ckend_priv
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
shader_data
));
shader_data
=
shader
->
ba
ckend_priv
;
shader
->
ba
seShader
.
backend_data
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
shader_data
));
shader_data
=
shader
->
ba
seShader
.
backend_data
;
shader_data
->
clamp_consts
=
shader
->
baseShader
.
reg_maps
.
shader_version
.
major
==
1
;
if
(
shader
->
baseShader
.
reg_maps
.
shader_version
.
major
<
3
)
shader_data
->
input_signature_idx
=
~
0
;
...
...
@@ -3991,7 +3992,7 @@ static struct arb_ps_compiled_shader *find_arb_pshader(IWineD3DPixelShaderImpl *
else
shader_data
->
clipplane_emulation
=
~
0U
;
}
shader_data
=
shader
->
ba
ckend_priv
;
shader_data
=
shader
->
ba
seShader
.
backend_data
;
/* Usually we have very few GL shaders for each d3d shader(just 1 or maybe 2),
* so a linear search is more performant than a hashmap or a binary search
...
...
@@ -4065,10 +4066,11 @@ static struct arb_vs_compiled_shader *find_arb_vshader(IWineD3DVertexShaderImpl
GLuint
ret
;
const
struct
wined3d_gl_info
*
gl_info
=
&
((
IWineD3DDeviceImpl
*
)
shader
->
baseShader
.
device
)
->
adapter
->
gl_info
;
if
(
!
shader
->
backend_priv
)
{
shader
->
backend_priv
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
shader_data
));
if
(
!
shader
->
baseShader
.
backend_data
)
{
shader
->
baseShader
.
backend_data
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
shader_data
));
}
shader_data
=
shader
->
ba
ckend_priv
;
shader_data
=
shader
->
ba
seShader
.
backend_data
;
/* Usually we have very few GL shaders for each d3d shader(just 1 or maybe 2),
* so a linear search is more performant than a hashmap or a binary search
...
...
@@ -4185,7 +4187,7 @@ static inline void find_arb_vs_compile_args(IWineD3DVertexShaderImpl *shader, IW
if
(
use_ps
(
stateblock
))
{
IWineD3DPixelShaderImpl
*
ps
=
(
IWineD3DPixelShaderImpl
*
)
stateblock
->
pixelShader
;
struct
arb_pshader_private
*
shader_priv
=
ps
->
ba
ckend_priv
;
struct
arb_pshader_private
*
shader_priv
=
ps
->
ba
seShader
.
backend_data
;
args
->
ps_signature
=
shader_priv
->
input_signature_idx
;
args
->
boolclip
.
clip_control
[
0
]
=
shader_priv
->
clipplane_emulation
+
1
;
...
...
@@ -4281,9 +4283,9 @@ static void shader_arb_select(const struct wined3d_context *context, BOOL usePS,
/* Pixel Shader 1.x constants are clamped to [-1;1], Pixel Shader 2.0 constants are not. If switching between
* a 1.x and newer shader, reload the first 8 constants
*/
if
(
priv
->
last_ps_const_clamped
!=
((
struct
arb_pshader_private
*
)
ps
->
backend_priv
)
->
clamp_consts
)
if
(
priv
->
last_ps_const_clamped
!=
((
struct
arb_pshader_private
*
)
ps
->
baseShader
.
backend_data
)
->
clamp_consts
)
{
priv
->
last_ps_const_clamped
=
((
struct
arb_pshader_private
*
)
ps
->
backend_priv
)
->
clamp_consts
;
priv
->
last_ps_const_clamped
=
((
struct
arb_pshader_private
*
)
ps
->
baseShader
.
backend_data
)
->
clamp_consts
;
This
->
highest_dirty_ps_const
=
max
(
This
->
highest_dirty_ps_const
,
8
);
for
(
i
=
0
;
i
<
8
;
i
++
)
{
...
...
@@ -4399,7 +4401,7 @@ static void shader_arb_destroy(IWineD3DBaseShader *iface) {
if
(
shader_is_pshader_version
(
baseShader
->
baseShader
.
reg_maps
.
shader_version
.
type
))
{
IWineD3DPixelShaderImpl
*
This
=
(
IWineD3DPixelShaderImpl
*
)
iface
;
struct
arb_pshader_private
*
shader_data
=
This
->
ba
ckend_priv
;
struct
arb_pshader_private
*
shader_data
=
This
->
ba
seShader
.
backend_data
;
UINT
i
;
if
(
!
shader_data
)
return
;
/* This can happen if a shader was never compiled */
...
...
@@ -4414,10 +4416,10 @@ static void shader_arb_destroy(IWineD3DBaseShader *iface) {
LEAVE_GL
();
HeapFree
(
GetProcessHeap
(),
0
,
shader_data
->
gl_shaders
);
HeapFree
(
GetProcessHeap
(),
0
,
shader_data
);
This
->
ba
ckend_priv
=
NULL
;
This
->
ba
seShader
.
backend_data
=
NULL
;
}
else
{
IWineD3DVertexShaderImpl
*
This
=
(
IWineD3DVertexShaderImpl
*
)
iface
;
struct
arb_vshader_private
*
shader_data
=
This
->
ba
ckend_priv
;
struct
arb_vshader_private
*
shader_data
=
This
->
ba
seShader
.
backend_data
;
UINT
i
;
if
(
!
shader_data
)
return
;
/* This can happen if a shader was never compiled */
...
...
@@ -4432,7 +4434,7 @@ static void shader_arb_destroy(IWineD3DBaseShader *iface) {
LEAVE_GL
();
HeapFree
(
GetProcessHeap
(),
0
,
shader_data
->
gl_shaders
);
HeapFree
(
GetProcessHeap
(),
0
,
shader_data
);
This
->
ba
ckend_priv
=
NULL
;
This
->
ba
seShader
.
backend_data
=
NULL
;
}
}
...
...
dlls/wined3d/baseshader.c
View file @
f88c6e5c
...
...
@@ -206,11 +206,15 @@ int shader_addline(struct wined3d_shader_buffer *buffer, const char *format, ...
return
ret
;
}
void
shader_init
(
struct
IWineD3DBaseShaderClass
*
shader
,
IWineD3DDevice
*
device
)
void
shader_init
(
struct
IWineD3DBaseShaderClass
*
shader
,
IWineD3DDeviceImpl
*
device
,
IUnknown
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
)
{
shader
->
ref
=
1
;
shader
->
device
=
device
;
shader
->
device
=
(
IWineD3DDevice
*
)
device
;
shader
->
parent
=
parent
;
shader
->
parent_ops
=
parent_ops
;
list_init
(
&
shader
->
linked_programs
);
list_add_head
(
&
device
->
shaders
,
&
shader
->
shader_list_entry
);
}
/* Convert floating point offset relative
...
...
dlls/wined3d/glsl_shader.c
View file @
f88c6e5c
...
...
@@ -3880,10 +3880,16 @@ static GLhandleARB find_glsl_pshader(const struct wined3d_context *context,
struct
ps_np2fixup_info
*
np2fixup
=
NULL
;
GLhandleARB
ret
;
if
(
!
shader
->
backend_priv
)
{
shader
->
backend_priv
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
shader_data
));
if
(
!
shader
->
baseShader
.
backend_data
)
{
shader
->
baseShader
.
backend_data
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
shader_data
));
if
(
!
shader
->
baseShader
.
backend_data
)
{
ERR
(
"Failed to allocate backend data.
\n
"
);
return
0
;
}
}
shader_data
=
shader
->
ba
ckend_priv
;
shader_data
=
shader
->
ba
seShader
.
backend_data
;
/* Usually we have very few GL shaders for each d3d shader(just 1 or maybe 2),
* so a linear search is more performant than a hashmap or a binary search
...
...
@@ -3949,10 +3955,16 @@ static GLhandleARB find_glsl_vshader(const struct wined3d_context *context,
struct
glsl_vshader_private
*
shader_data
;
GLhandleARB
ret
;
if
(
!
shader
->
backend_priv
)
{
shader
->
backend_priv
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
shader_data
));
if
(
!
shader
->
baseShader
.
backend_data
)
{
shader
->
baseShader
.
backend_data
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
shader_data
));
if
(
!
shader
->
baseShader
.
backend_data
)
{
ERR
(
"Failed to allocate backend data.
\n
"
);
return
0
;
}
}
shader_data
=
shader
->
ba
ckend_priv
;
shader_data
=
shader
->
ba
seShader
.
backend_data
;
/* Usually we have very few GL shaders for each d3d shader(just 1 or maybe 2),
* so a linear search is more performant than a hashmap or a binary search
...
...
@@ -4351,11 +4363,11 @@ static void shader_glsl_destroy(IWineD3DBaseShader *iface) {
if
(
pshader
)
{
struct
glsl_pshader_private
*
shader_data
;
ps
=
(
IWineD3DPixelShaderImpl
*
)
This
;
shader_data
=
ps
->
ba
ckend_priv
;
shader_data
=
ps
->
ba
seShader
.
backend_data
;
if
(
!
shader_data
||
shader_data
->
num_gl_shaders
==
0
)
{
HeapFree
(
GetProcessHeap
(),
0
,
shader_data
);
ps
->
ba
ckend_priv
=
NULL
;
ps
->
ba
seShader
.
backend_data
=
NULL
;
return
;
}
...
...
@@ -4371,11 +4383,11 @@ static void shader_glsl_destroy(IWineD3DBaseShader *iface) {
}
else
{
struct
glsl_vshader_private
*
shader_data
;
vs
=
(
IWineD3DVertexShaderImpl
*
)
This
;
shader_data
=
vs
->
ba
ckend_priv
;
shader_data
=
vs
->
ba
seShader
.
backend_data
;
if
(
!
shader_data
||
shader_data
->
num_gl_shaders
==
0
)
{
HeapFree
(
GetProcessHeap
(),
0
,
shader_data
);
vs
->
ba
ckend_priv
=
NULL
;
vs
->
ba
seShader
.
backend_data
=
NULL
;
return
;
}
...
...
@@ -4411,7 +4423,7 @@ static void shader_glsl_destroy(IWineD3DBaseShader *iface) {
if
(
pshader
)
{
UINT
i
;
struct
glsl_pshader_private
*
shader_data
=
ps
->
ba
ckend_priv
;
struct
glsl_pshader_private
*
shader_data
=
ps
->
ba
seShader
.
backend_data
;
ENTER_GL
();
for
(
i
=
0
;
i
<
shader_data
->
num_gl_shaders
;
i
++
)
{
...
...
@@ -4422,10 +4434,10 @@ static void shader_glsl_destroy(IWineD3DBaseShader *iface) {
LEAVE_GL
();
HeapFree
(
GetProcessHeap
(),
0
,
shader_data
->
gl_shaders
);
HeapFree
(
GetProcessHeap
(),
0
,
shader_data
);
ps
->
ba
ckend_priv
=
NULL
;
ps
->
ba
seShader
.
backend_data
=
NULL
;
}
else
{
UINT
i
;
struct
glsl_vshader_private
*
shader_data
=
vs
->
ba
ckend_priv
;
struct
glsl_vshader_private
*
shader_data
=
vs
->
ba
seShader
.
backend_data
;
ENTER_GL
();
for
(
i
=
0
;
i
<
shader_data
->
num_gl_shaders
;
i
++
)
{
...
...
@@ -4436,7 +4448,7 @@ static void shader_glsl_destroy(IWineD3DBaseShader *iface) {
LEAVE_GL
();
HeapFree
(
GetProcessHeap
(),
0
,
shader_data
->
gl_shaders
);
HeapFree
(
GetProcessHeap
(),
0
,
shader_data
);
vs
->
ba
ckend_priv
=
NULL
;
vs
->
ba
seShader
.
backend_data
=
NULL
;
}
}
...
...
dlls/wined3d/pixelshader.c
View file @
f88c6e5c
...
...
@@ -72,7 +72,7 @@ static ULONG WINAPI IWineD3DPixelShaderImpl_Release(IWineD3DPixelShader *iface)
if
(
!
refcount
)
{
shader_cleanup
((
IWineD3DBaseShader
*
)
iface
);
This
->
parent_ops
->
wined3d_object_destroyed
(
This
->
parent
);
This
->
baseShader
.
parent_ops
->
wined3d_object_destroyed
(
This
->
baseShader
.
parent
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
...
...
@@ -86,7 +86,7 @@ static ULONG WINAPI IWineD3DPixelShaderImpl_Release(IWineD3DPixelShader *iface)
static
HRESULT
WINAPI
IWineD3DPixelShaderImpl_GetParent
(
IWineD3DPixelShader
*
iface
,
IUnknown
**
parent
){
IWineD3DPixelShaderImpl
*
This
=
(
IWineD3DPixelShaderImpl
*
)
iface
;
*
parent
=
This
->
parent
;
*
parent
=
This
->
baseShader
.
parent
;
IUnknown_AddRef
(
*
parent
);
TRACE
(
"(%p) : returning %p
\n
"
,
This
,
*
parent
);
return
WINED3D_OK
;
...
...
@@ -433,10 +433,7 @@ HRESULT pixelshader_init(IWineD3DPixelShaderImpl *shader, IWineD3DDeviceImpl *de
if
(
!
byte_code
)
return
WINED3DERR_INVALIDCALL
;
shader
->
lpVtbl
=
&
IWineD3DPixelShader_Vtbl
;
shader
->
parent
=
parent
;
shader
->
parent_ops
=
parent_ops
;
shader_init
(
&
shader
->
baseShader
,
(
IWineD3DDevice
*
)
device
);
list_add_head
(
&
device
->
shaders
,
&
shader
->
baseShader
.
shader_list_entry
);
shader_init
(
&
shader
->
baseShader
,
device
,
parent
,
parent_ops
);
hr
=
pixelshader_set_function
(
shader
,
byte_code
,
output_signature
);
if
(
FAILED
(
hr
))
...
...
dlls/wined3d/vertexshader.c
View file @
f88c6e5c
...
...
@@ -175,7 +175,7 @@ static ULONG WINAPI IWineD3DVertexShaderImpl_Release(IWineD3DVertexShader *iface
if
(
!
refcount
)
{
shader_cleanup
((
IWineD3DBaseShader
*
)
iface
);
This
->
parent_ops
->
wined3d_object_destroyed
(
This
->
parent
);
This
->
baseShader
.
parent_ops
->
wined3d_object_destroyed
(
This
->
baseShader
.
parent
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
...
...
@@ -189,7 +189,7 @@ static ULONG WINAPI IWineD3DVertexShaderImpl_Release(IWineD3DVertexShader *iface
static
HRESULT
WINAPI
IWineD3DVertexShaderImpl_GetParent
(
IWineD3DVertexShader
*
iface
,
IUnknown
**
parent
){
IWineD3DVertexShaderImpl
*
This
=
(
IWineD3DVertexShaderImpl
*
)
iface
;
*
parent
=
This
->
parent
;
*
parent
=
This
->
baseShader
.
parent
;
IUnknown_AddRef
(
*
parent
);
TRACE
(
"(%p) : returning %p
\n
"
,
This
,
*
parent
);
return
WINED3D_OK
;
...
...
@@ -367,10 +367,7 @@ HRESULT vertexshader_init(IWineD3DVertexShaderImpl *shader, IWineD3DDeviceImpl *
if
(
!
byte_code
)
return
WINED3DERR_INVALIDCALL
;
shader
->
lpVtbl
=
&
IWineD3DVertexShader_Vtbl
;
shader
->
parent
=
parent
;
shader
->
parent_ops
=
parent_ops
;
shader_init
(
&
shader
->
baseShader
,
(
IWineD3DDevice
*
)
device
);
list_add_head
(
&
device
->
shaders
,
&
shader
->
baseShader
.
shader_list_entry
);
shader_init
(
&
shader
->
baseShader
,
device
,
parent
,
parent_ops
);
hr
=
vertexshader_set_function
(
shader
,
byte_code
,
output_signature
);
if
(
FAILED
(
hr
))
...
...
dlls/wined3d/wined3d_private.h
View file @
f88c6e5c
...
...
@@ -2645,6 +2645,10 @@ typedef struct IWineD3DBaseShaderClass
BOOL
load_local_constsF
;
const
struct
wined3d_shader_frontend
*
frontend
;
void
*
frontend_data
;
void
*
backend_data
;
IUnknown
*
parent
;
const
struct
wined3d_parent_ops
*
parent_ops
;
/* Programs this shader is linked with */
struct
list
linked_programs
;
...
...
@@ -2685,7 +2689,8 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
struct
wined3d_shader_signature_element
*
input_signature
,
struct
wined3d_shader_signature_element
*
output_signature
,
const
DWORD
*
byte_code
,
DWORD
constf_size
)
DECLSPEC_HIDDEN
;
void
shader_init
(
struct
IWineD3DBaseShaderClass
*
shader
,
IWineD3DDevice
*
device
)
DECLSPEC_HIDDEN
;
void
shader_init
(
struct
IWineD3DBaseShaderClass
*
shader
,
IWineD3DDeviceImpl
*
device
,
IUnknown
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
)
DECLSPEC_HIDDEN
;
BOOL
shader_match_semantic
(
const
char
*
semantic_name
,
WINED3DDECLUSAGE
usage
)
DECLSPEC_HIDDEN
;
const
struct
wined3d_shader_frontend
*
shader_select_frontend
(
DWORD
version_token
)
DECLSPEC_HIDDEN
;
void
shader_trace_init
(
const
struct
wined3d_shader_frontend
*
fe
,
void
*
fe_data
,
const
DWORD
*
pFunction
)
DECLSPEC_HIDDEN
;
...
...
@@ -2762,13 +2767,6 @@ typedef struct IWineD3DVertexShaderImpl {
/* IWineD3DBaseShader */
IWineD3DBaseShaderClass
baseShader
;
/* IWineD3DVertexShaderImpl */
IUnknown
*
parent
;
const
struct
wined3d_parent_ops
*
parent_ops
;
/* The GL shader */
void
*
backend_priv
;
/* Vertex shader input and output semantics */
struct
wined3d_shader_attribute
attributes
[
MAX_ATTRIBS
];
struct
wined3d_shader_signature_element
output_signature
[
MAX_REG_OUTPUT
];
...
...
@@ -2811,19 +2809,12 @@ typedef struct IWineD3DPixelShaderImpl {
/* IWineD3DBaseShader */
IWineD3DBaseShaderClass
baseShader
;
/* IWineD3DPixelShaderImpl */
IUnknown
*
parent
;
const
struct
wined3d_parent_ops
*
parent_ops
;
/* Pixel shader input semantics */
struct
wined3d_shader_signature_element
input_signature
[
MAX_REG_INPUT
];
DWORD
input_reg_map
[
MAX_REG_INPUT
];
BOOL
input_reg_used
[
MAX_REG_INPUT
];
unsigned
int
declared_in_count
;
/* The GL shader */
void
*
backend_priv
;
/* Some information about the shader behavior */
char
vpos_uniform
;
...
...
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