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
f912f18b
Commit
f912f18b
authored
Feb 24, 2008
by
Stefan Dösinger
Committed by
Alexandre Julliard
Feb 26, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Move shader model private data into its own structure.
parent
62694157
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
82 additions
and
23 deletions
+82
-23
arb_program_shader.c
dlls/wined3d/arb_program_shader.c
+27
-11
baseshader.c
dlls/wined3d/baseshader.c
+5
-1
device.c
dlls/wined3d/device.c
+2
-0
directx.c
dlls/wined3d/directx.c
+6
-0
glsl_shader.c
dlls/wined3d/glsl_shader.c
+28
-8
wined3d_private.h
dlls/wined3d/wined3d_private.h
+14
-3
No files found.
dlls/wined3d/arb_program_shader.c
View file @
f912f18b
...
...
@@ -1712,28 +1712,30 @@ static void shader_arb_select(IWineD3DDevice *iface, BOOL usePS, BOOL useVS) {
static
void
shader_arb_select_depth_blt
(
IWineD3DDevice
*
iface
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
struct
shader_arb_priv
*
priv
=
(
struct
shader_arb_priv
*
)
This
->
shader_priv
;
WineD3D_GL_Info
*
gl_info
=
&
This
->
adapter
->
gl_info
;
if
(
!
This
->
depth_blt_vprogram_id
)
This
->
depth_blt_vprogram_id
=
create_arb_blt_vertex_program
(
gl_info
);
GL_EXTCALL
(
glBindProgramARB
(
GL_VERTEX_PROGRAM_ARB
,
This
->
depth_blt_vprogram_id
));
if
(
!
priv
->
depth_blt_vprogram_id
)
priv
->
depth_blt_vprogram_id
=
create_arb_blt_vertex_program
(
gl_info
);
GL_EXTCALL
(
glBindProgramARB
(
GL_VERTEX_PROGRAM_ARB
,
priv
->
depth_blt_vprogram_id
));
glEnable
(
GL_VERTEX_PROGRAM_ARB
);
if
(
!
This
->
depth_blt_fprogram_id
)
This
->
depth_blt_fprogram_id
=
create_arb_blt_fragment_program
(
gl_info
);
GL_EXTCALL
(
glBindProgramARB
(
GL_FRAGMENT_PROGRAM_ARB
,
This
->
depth_blt_fprogram_id
));
if
(
!
priv
->
depth_blt_fprogram_id
)
priv
->
depth_blt_fprogram_id
=
create_arb_blt_fragment_program
(
gl_info
);
GL_EXTCALL
(
glBindProgramARB
(
GL_FRAGMENT_PROGRAM_ARB
,
priv
->
depth_blt_fprogram_id
));
glEnable
(
GL_FRAGMENT_PROGRAM_ARB
);
}
static
void
shader_arb_destroy_depth_blt
(
IWineD3DDevice
*
iface
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
struct
shader_arb_priv
*
priv
=
(
struct
shader_arb_priv
*
)
This
->
shader_priv
;
WineD3D_GL_Info
*
gl_info
=
&
This
->
adapter
->
gl_info
;
if
(
This
->
depth_blt_vprogram_id
)
{
GL_EXTCALL
(
glDeleteProgramsARB
(
1
,
&
This
->
depth_blt_vprogram_id
));
This
->
depth_blt_vprogram_id
=
0
;
if
(
priv
->
depth_blt_vprogram_id
)
{
GL_EXTCALL
(
glDeleteProgramsARB
(
1
,
&
priv
->
depth_blt_vprogram_id
));
priv
->
depth_blt_vprogram_id
=
0
;
}
if
(
This
->
depth_blt_fprogram_id
)
{
GL_EXTCALL
(
glDeleteProgramsARB
(
1
,
&
This
->
depth_blt_fprogram_id
));
This
->
depth_blt_fprogram_id
=
0
;
if
(
priv
->
depth_blt_fprogram_id
)
{
GL_EXTCALL
(
glDeleteProgramsARB
(
1
,
&
priv
->
depth_blt_fprogram_id
));
priv
->
depth_blt_fprogram_id
=
0
;
}
}
...
...
@@ -1756,6 +1758,17 @@ static void shader_arb_destroy(IWineD3DBaseShader *iface) {
This
->
baseShader
.
is_compiled
=
FALSE
;
}
static
HRESULT
shader_arb_alloc
(
IWineD3DDevice
*
iface
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
This
->
shader_priv
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
struct
shader_arb_priv
));
return
WINED3D_OK
;
}
static
void
shader_arb_free
(
IWineD3DDevice
*
iface
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
HeapFree
(
GetProcessHeap
(),
0
,
This
->
shader_priv
);
}
const
shader_backend_t
arb_program_shader_backend
=
{
&
shader_arb_select
,
&
shader_arb_select_depth_blt
,
...
...
@@ -1763,5 +1776,8 @@ const shader_backend_t arb_program_shader_backend = {
&
shader_arb_load_constants
,
&
shader_arb_cleanup
,
&
shader_arb_color_correction
,
&
shader_arb_destroy
&
shader_arb_destroy
,
&
shader_arb_alloc
,
&
shader_arb_free
};
dlls/wined3d/baseshader.c
View file @
f912f18b
...
...
@@ -1103,6 +1103,8 @@ static void shader_none_load_constants(IWineD3DDevice *iface, char usePS, char u
static
void
shader_none_cleanup
(
IWineD3DDevice
*
iface
)
{}
static
void
shader_none_color_correction
(
SHADER_OPCODE_ARG
*
arg
)
{}
static
void
shader_none_destroy
(
IWineD3DBaseShader
*
iface
)
{}
static
HRESULT
shader_none_alloc
(
IWineD3DDevice
*
iface
)
{
return
WINED3D_OK
;}
static
void
shader_none_free
(
IWineD3DDevice
*
iface
)
{}
const
shader_backend_t
none_shader_backend
=
{
&
shader_none_select
,
...
...
@@ -1111,7 +1113,9 @@ const shader_backend_t none_shader_backend = {
&
shader_none_load_constants
,
&
shader_none_cleanup
,
&
shader_none_color_correction
,
&
shader_none_destroy
&
shader_none_destroy
,
&
shader_none_alloc
,
&
shader_none_free
};
/* *******************************************
...
...
dlls/wined3d/device.c
View file @
f912f18b
...
...
@@ -173,6 +173,8 @@ static ULONG WINAPI IWineD3DDeviceImpl_Release(IWineD3DDevice *iface) {
GL_EXTCALL
(
glDeleteFramebuffersEXT
(
1
,
&
This
->
dst_fbo
));
}
This
->
shader_backend
->
shader_free_private
(
iface
);
if
(
This
->
glsl_program_lookup
)
hash_table_destroy
(
This
->
glsl_program_lookup
);
/* TODO: Clean up all the surfaces and textures! */
...
...
dlls/wined3d/directx.c
View file @
f912f18b
...
...
@@ -2826,6 +2826,12 @@ static HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter,
}
else
{
object
->
shader_backend
=
&
none_shader_backend
;
}
if
(
FAILED
(
object
->
shader_backend
->
shader_alloc_private
((
IWineD3DDevice
*
)
object
)))
{
IWineD3D_Release
(
object
->
wineD3D
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
*
ppReturnedDeviceInterface
=
NULL
;
return
E_OUTOFMEMORY
;
}
/* set the state of the device to valid */
object
->
state
=
WINED3D_OK
;
...
...
dlls/wined3d/glsl_shader.c
View file @
f912f18b
...
...
@@ -3226,6 +3226,11 @@ static GLhandleARB create_glsl_blt_shader(WineD3D_GL_Info *gl_info) {
print_glsl_info_log
(
&
GLINFO_LOCATION
,
program_id
);
/* Once linked we can mark the shaders for deletion. They will be deleted once the program
* is destroyed
*/
GL_EXTCALL
(
glDeleteObjectARB
(
vshader_id
));
GL_EXTCALL
(
glDeleteObjectARB
(
pshader_id
));
return
program_id
;
}
...
...
@@ -3246,24 +3251,26 @@ static void shader_glsl_select(IWineD3DDevice *iface, BOOL usePS, BOOL useVS) {
static
void
shader_glsl_select_depth_blt
(
IWineD3DDevice
*
iface
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
WineD3D_GL_Info
*
gl_info
=
&
This
->
adapter
->
gl_info
;
struct
shader_glsl_priv
*
priv
=
(
struct
shader_glsl_priv
*
)
This
->
shader_priv
;
static
GLhandleARB
loc
=
-
1
;
if
(
!
This
->
depth_blt_glsl_program_id
)
{
This
->
depth_blt_glsl_program_id
=
create_glsl_blt_shader
(
gl_info
);
loc
=
GL_EXTCALL
(
glGetUniformLocationARB
(
This
->
depth_blt_glsl_program_id
,
"sampler"
));
if
(
!
priv
->
depth_blt_glsl_program_id
)
{
priv
->
depth_blt_glsl_program_id
=
create_glsl_blt_shader
(
gl_info
);
loc
=
GL_EXTCALL
(
glGetUniformLocationARB
(
priv
->
depth_blt_glsl_program_id
,
"sampler"
));
}
GL_EXTCALL
(
glUseProgramObjectARB
(
This
->
depth_blt_glsl_program_id
));
GL_EXTCALL
(
glUseProgramObjectARB
(
priv
->
depth_blt_glsl_program_id
));
GL_EXTCALL
(
glUniform1iARB
(
loc
,
0
));
}
static
void
shader_glsl_destroy_depth_blt
(
IWineD3DDevice
*
iface
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
struct
shader_glsl_priv
*
priv
=
(
struct
shader_glsl_priv
*
)
This
->
shader_priv
;
WineD3D_GL_Info
*
gl_info
=
&
This
->
adapter
->
gl_info
;
if
(
This
->
depth_blt_glsl_program_id
)
{
GL_EXTCALL
(
glDeleteObjectARB
(
This
->
depth_blt_glsl_program_id
));
This
->
depth_blt_glsl_program_id
=
0
;
if
(
priv
->
depth_blt_glsl_program_id
)
{
GL_EXTCALL
(
glDeleteObjectARB
(
priv
->
depth_blt_glsl_program_id
));
priv
->
depth_blt_glsl_program_id
=
0
;
}
}
...
...
@@ -3308,6 +3315,17 @@ static void shader_glsl_destroy(IWineD3DBaseShader *iface) {
This
->
baseShader
.
is_compiled
=
FALSE
;
}
static
HRESULT
shader_glsl_alloc
(
IWineD3DDevice
*
iface
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
This
->
shader_priv
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
struct
shader_glsl_priv
));
return
WINED3D_OK
;
}
static
void
shader_glsl_free
(
IWineD3DDevice
*
iface
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
HeapFree
(
GetProcessHeap
(),
0
,
This
->
shader_priv
);
}
const
shader_backend_t
glsl_shader_backend
=
{
&
shader_glsl_select
,
&
shader_glsl_select_depth_blt
,
...
...
@@ -3315,5 +3333,7 @@ const shader_backend_t glsl_shader_backend = {
&
shader_glsl_load_constants
,
&
shader_glsl_cleanup
,
&
shader_glsl_color_correction
,
&
shader_glsl_destroy
&
shader_glsl_destroy
,
&
shader_glsl_alloc
,
&
shader_glsl_free
};
dlls/wined3d/wined3d_private.h
View file @
f912f18b
...
...
@@ -257,12 +257,25 @@ typedef struct {
void
(
*
shader_cleanup
)(
IWineD3DDevice
*
iface
);
void
(
*
shader_color_correction
)(
struct
SHADER_OPCODE_ARG
*
arg
);
void
(
*
shader_destroy
)(
IWineD3DBaseShader
*
iface
);
HRESULT
(
*
shader_alloc_private
)(
IWineD3DDevice
*
iface
);
void
(
*
shader_free_private
)(
IWineD3DDevice
*
iface
);
}
shader_backend_t
;
extern
const
shader_backend_t
glsl_shader_backend
;
extern
const
shader_backend_t
arb_program_shader_backend
;
extern
const
shader_backend_t
none_shader_backend
;
/* GLSL shader private data */
struct
shader_glsl_priv
{
GLhandleARB
depth_blt_glsl_program_id
;
};
/* ARB_program_shader private data */
struct
shader_arb_priv
{
GLuint
depth_blt_vprogram_id
;
GLuint
depth_blt_fprogram_id
;
};
/* X11 locking */
extern
void
(
*
wine_tsx11_lock_ptr
)(
void
);
...
...
@@ -712,6 +725,7 @@ struct IWineD3DDeviceImpl
int
ps_selected_mode
;
const
shader_backend_t
*
shader_backend
;
hash_table_t
*
glsl_program_lookup
;
void
*
shader_priv
;
/* To store */
BOOL
view_ident
;
/* true iff view matrix is identity */
...
...
@@ -761,9 +775,6 @@ struct IWineD3DDeviceImpl
GLuint
dst_fbo
;
GLenum
*
draw_buffers
;
GLuint
depth_blt_texture
;
GLuint
depth_blt_vprogram_id
;
GLuint
depth_blt_fprogram_id
;
GLhandleARB
depth_blt_glsl_program_id
;
/* Cursor management */
BOOL
bCursorVisible
;
...
...
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