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
b33ddbde
Commit
b33ddbde
authored
Oct 27, 2008
by
Henri Verbeet
Committed by
Alexandre Julliard
Oct 28, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Support some more texture types for GLSL depth blts.
parent
437b3424
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
14 deletions
+44
-14
glsl_shader.c
dlls/wined3d/glsl_shader.c
+44
-14
No files found.
dlls/wined3d/glsl_shader.c
View file @
b33ddbde
...
@@ -57,7 +57,7 @@ typedef struct {
...
@@ -57,7 +57,7 @@ typedef struct {
struct
shader_glsl_priv
{
struct
shader_glsl_priv
{
struct
hash_table_t
*
glsl_program_lookup
;
struct
hash_table_t
*
glsl_program_lookup
;
struct
glsl_shader_prog_link
*
glsl_program
;
struct
glsl_shader_prog_link
*
glsl_program
;
GLhandleARB
depth_blt_glsl_program_id
;
GLhandleARB
depth_blt_program
[
tex_type_count
]
;
};
};
/* Struct to maintain data about a linked GLSL program */
/* Struct to maintain data about a linked GLSL program */
...
@@ -3379,7 +3379,7 @@ static void set_glsl_shader_program(IWineD3DDevice *iface, BOOL use_ps, BOOL use
...
@@ -3379,7 +3379,7 @@ static void set_glsl_shader_program(IWineD3DDevice *iface, BOOL use_ps, BOOL use
}
}
}
}
static
GLhandleARB
create_glsl_blt_shader
(
WineD3D_GL_Info
*
gl_info
)
{
static
GLhandleARB
create_glsl_blt_shader
(
WineD3D_GL_Info
*
gl_info
,
enum
tex_types
tex_type
)
{
GLhandleARB
program_id
;
GLhandleARB
program_id
;
GLhandleARB
vshader_id
,
pshader_id
;
GLhandleARB
vshader_id
,
pshader_id
;
const
char
*
blt_vshader
[]
=
{
const
char
*
blt_vshader
[]
=
{
...
@@ -3392,21 +3392,47 @@ static GLhandleARB create_glsl_blt_shader(WineD3D_GL_Info *gl_info) {
...
@@ -3392,21 +3392,47 @@ static GLhandleARB create_glsl_blt_shader(WineD3D_GL_Info *gl_info) {
"}
\n
"
"}
\n
"
};
};
const
char
*
blt_pshader
[]
=
{
const
char
*
blt_pshaders
[
tex_type_count
]
=
{
/* tex_1d */
NULL
,
/* tex_2d */
"#version 120
\n
"
"#version 120
\n
"
"uniform sampler2D sampler;
\n
"
"uniform sampler2D sampler;
\n
"
"void main(void)
\n
"
"void main(void)
\n
"
"{
\n
"
"{
\n
"
" gl_FragDepth = texture2D(sampler, gl_TexCoord[0].xy).x;
\n
"
" gl_FragDepth = texture2D(sampler, gl_TexCoord[0].xy).x;
\n
"
"}
\n
"
"}
\n
"
,
/* tex_3d */
NULL
,
/* tex_cube */
"#version 120
\n
"
"uniform samplerCube sampler;
\n
"
"void main(void)
\n
"
"{
\n
"
" gl_FragDepth = textureCube(sampler, gl_TexCoord[0].xyz).x;
\n
"
"}
\n
"
,
/* tex_rect */
"#version 120
\n
"
"#extension GL_ARB_texture_rectangle : enable
\n
"
"uniform sampler2DRect sampler;
\n
"
"void main(void)
\n
"
"{
\n
"
" gl_FragDepth = texture2DRect(sampler, gl_TexCoord[0].xy).x;
\n
"
"}
\n
"
,
};
};
if
(
!
blt_pshaders
[
tex_type
])
{
FIXME
(
"tex_type %#x not supported
\n
"
,
tex_type
);
tex_type
=
tex_2d
;
}
vshader_id
=
GL_EXTCALL
(
glCreateShaderObjectARB
(
GL_VERTEX_SHADER_ARB
));
vshader_id
=
GL_EXTCALL
(
glCreateShaderObjectARB
(
GL_VERTEX_SHADER_ARB
));
GL_EXTCALL
(
glShaderSourceARB
(
vshader_id
,
1
,
blt_vshader
,
NULL
));
GL_EXTCALL
(
glShaderSourceARB
(
vshader_id
,
1
,
blt_vshader
,
NULL
));
GL_EXTCALL
(
glCompileShaderARB
(
vshader_id
));
GL_EXTCALL
(
glCompileShaderARB
(
vshader_id
));
pshader_id
=
GL_EXTCALL
(
glCreateShaderObjectARB
(
GL_FRAGMENT_SHADER_ARB
));
pshader_id
=
GL_EXTCALL
(
glCreateShaderObjectARB
(
GL_FRAGMENT_SHADER_ARB
));
GL_EXTCALL
(
glShaderSourceARB
(
pshader_id
,
1
,
blt_pshader
,
NULL
));
GL_EXTCALL
(
glShaderSourceARB
(
pshader_id
,
1
,
&
blt_pshaders
[
tex_type
]
,
NULL
));
GL_EXTCALL
(
glCompileShaderARB
(
pshader_id
));
GL_EXTCALL
(
glCompileShaderARB
(
pshader_id
));
program_id
=
GL_EXTCALL
(
glCreateProgramObjectARB
());
program_id
=
GL_EXTCALL
(
glCreateProgramObjectARB
());
...
@@ -3457,17 +3483,16 @@ static void shader_glsl_select_depth_blt(IWineD3DDevice *iface, enum tex_types t
...
@@ -3457,17 +3483,16 @@ static void shader_glsl_select_depth_blt(IWineD3DDevice *iface, enum tex_types t
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
WineD3D_GL_Info
*
gl_info
=
&
This
->
adapter
->
gl_info
;
WineD3D_GL_Info
*
gl_info
=
&
This
->
adapter
->
gl_info
;
struct
shader_glsl_priv
*
priv
=
(
struct
shader_glsl_priv
*
)
This
->
shader_priv
;
struct
shader_glsl_priv
*
priv
=
(
struct
shader_glsl_priv
*
)
This
->
shader_priv
;
GLhandleARB
*
blt_program
=
&
priv
->
depth_blt_program
[
tex_type
];
if
(
tex_type
!=
tex_2d
)
FIXME
(
"Unsupported tex_type %#x
\n
"
,
tex_type
);
if
(
!*
blt_program
)
{
if
(
!
priv
->
depth_blt_glsl_program_id
)
{
GLhandleARB
loc
;
GLhandleARB
loc
;
priv
->
depth_blt_glsl_program_id
=
create_glsl_blt_shader
(
gl_info
);
*
blt_program
=
create_glsl_blt_shader
(
gl_info
,
tex_type
);
loc
=
GL_EXTCALL
(
glGetUniformLocationARB
(
priv
->
depth_blt_glsl_program_id
,
"sampler"
));
loc
=
GL_EXTCALL
(
glGetUniformLocationARB
(
*
blt_program
,
"sampler"
));
GL_EXTCALL
(
glUseProgramObjectARB
(
priv
->
depth_blt_glsl_program_id
));
GL_EXTCALL
(
glUseProgramObjectARB
(
*
blt_program
));
GL_EXTCALL
(
glUniform1iARB
(
loc
,
0
));
GL_EXTCALL
(
glUniform1iARB
(
loc
,
0
));
}
else
{
}
else
{
GL_EXTCALL
(
glUseProgramObjectARB
(
priv
->
depth_blt_glsl_program_id
));
GL_EXTCALL
(
glUseProgramObjectARB
(
*
blt_program
));
}
}
}
}
...
@@ -3560,9 +3585,14 @@ static void shader_glsl_free(IWineD3DDevice *iface) {
...
@@ -3560,9 +3585,14 @@ static void shader_glsl_free(IWineD3DDevice *iface) {
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
WineD3D_GL_Info
*
gl_info
=
&
This
->
adapter
->
gl_info
;
WineD3D_GL_Info
*
gl_info
=
&
This
->
adapter
->
gl_info
;
struct
shader_glsl_priv
*
priv
=
(
struct
shader_glsl_priv
*
)
This
->
shader_priv
;
struct
shader_glsl_priv
*
priv
=
(
struct
shader_glsl_priv
*
)
This
->
shader_priv
;
int
i
;
if
(
priv
->
depth_blt_glsl_program_id
)
{
for
(
i
=
0
;
i
<
tex_type_count
;
++
i
)
GL_EXTCALL
(
glDeleteObjectARB
(
priv
->
depth_blt_glsl_program_id
));
{
if
(
priv
->
depth_blt_program
[
i
])
{
GL_EXTCALL
(
glDeleteObjectARB
(
priv
->
depth_blt_program
[
i
]));
}
}
}
hash_table_destroy
(
priv
->
glsl_program_lookup
,
NULL
,
NULL
);
hash_table_destroy
(
priv
->
glsl_program_lookup
,
NULL
,
NULL
);
...
...
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