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
5865d9c0
Commit
5865d9c0
authored
May 26, 2009
by
Stefan Dösinger
Committed by
Alexandre Julliard
May 28, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Store the compile args in the compile context, not the shader.
parent
5f2a3d84
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
22 deletions
+33
-22
arb_program_shader.c
dlls/wined3d/arb_program_shader.c
+13
-8
glsl_shader.c
dlls/wined3d/glsl_shader.c
+20
-6
pixelshader.c
dlls/wined3d/pixelshader.c
+0
-2
vertexshader.c
dlls/wined3d/vertexshader.c
+0
-2
wined3d_private.h
dlls/wined3d/wined3d_private.h
+0
-4
No files found.
dlls/wined3d/arb_program_shader.c
View file @
5865d9c0
...
...
@@ -93,6 +93,9 @@ struct shader_arb_ctx_priv {
/* GL_NV_vertex_program3 or GL_NV_fragment_program2 */
NV3
}
target_version
;
const
struct
vs_compile_args
*
cur_vs_args
;
const
struct
ps_compile_args
*
cur_ps_args
;
};
/********************************************************
...
...
@@ -543,7 +546,7 @@ static void shader_arb_get_register_name(const struct wined3d_shader_instruction
}
else
{
if
(
((
IWineD3DVertexShaderImpl
*
)
This
)
->
cur
_args
->
swizzle_map
&
(
1
<<
reg
->
idx
))
*
is_color
=
TRUE
;
if
(
ctx
->
cur_vs
_args
->
swizzle_map
&
(
1
<<
reg
->
idx
))
*
is_color
=
TRUE
;
sprintf
(
register_name
,
"vertex.attrib[%u]"
,
reg
->
idx
);
}
break
;
...
...
@@ -606,7 +609,7 @@ static void shader_arb_get_register_name(const struct wined3d_shader_instruction
case
WINED3DSPR_COLOROUT
:
if
(
reg
->
idx
==
0
)
{
if
(
((
IWineD3DPixelShaderImpl
*
)
This
)
->
cur
_args
->
srgb_correction
)
if
(
ctx
->
cur_ps
_args
->
srgb_correction
)
{
strcpy
(
register_name
,
"TMP_COLOR"
);
}
...
...
@@ -739,6 +742,7 @@ static void shader_hw_sample(const struct wined3d_shader_instruction *ins, DWORD
const
char
*
tex_type
;
IWineD3DBaseShaderImpl
*
This
=
(
IWineD3DBaseShaderImpl
*
)
ins
->
ctx
->
shader
;
IWineD3DDeviceImpl
*
device
=
(
IWineD3DDeviceImpl
*
)
This
->
baseShader
.
device
;
struct
shader_arb_ctx_priv
*
priv
=
ins
->
ctx
->
backend_data
;
switch
(
sampler_type
)
{
case
WINED3DSTT_1D
:
...
...
@@ -754,10 +758,10 @@ static void shader_hw_sample(const struct wined3d_shader_instruction *ins, DWORD
}
if
(
shader_is_pshader_version
(
ins
->
ctx
->
reg_maps
->
shader_version
.
type
))
{
const
IWineD3DPixelShaderImpl
*
const
ps
=
(
const
IWineD3DPixelShaderImpl
*
)
This
;
if
(
ps
->
cur_args
->
np2_fixup
&
(
1
<<
sampler_idx
))
{
FIXME
(
"NP2 texcoord fixup is currently not implemented in ARB mode (use GLSL instead).
\n
"
);
}
if
(
priv
->
cur_ps_args
->
np2_fixup
&
(
1
<<
sampler_idx
))
{
FIXME
(
"NP2 texcoord fixup is currently not implemented in ARB mode (use GLSL instead).
\n
"
);
}
}
break
;
...
...
@@ -787,9 +791,8 @@ static void shader_hw_sample(const struct wined3d_shader_instruction *ins, DWORD
if
(
shader_is_pshader_version
(
ins
->
ctx
->
reg_maps
->
shader_version
.
type
))
{
IWineD3DPixelShaderImpl
*
ps
=
(
IWineD3DPixelShaderImpl
*
)
ins
->
ctx
->
shader
;
gen_color_correction
(
buffer
,
dst_str
,
ins
->
dst
[
0
].
write_mask
,
"one"
,
"coefmul.x"
,
p
s
->
cur
_args
->
color_fixup
[
sampler_idx
]);
"one"
,
"coefmul.x"
,
p
riv
->
cur_ps
_args
->
color_fixup
[
sampler_idx
]);
}
}
...
...
@@ -2128,6 +2131,7 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShader *iface,
/* Create the hw ARB shader */
memset
(
&
priv_ctx
,
0
,
sizeof
(
priv_ctx
));
priv_ctx
.
cur_ps_args
=
args
;
shader_addline
(
buffer
,
"!!ARBfp1.0
\n
"
);
if
(
GL_SUPPORT
(
NV_FRAGMENT_PROGRAM_OPTION
))
{
shader_addline
(
buffer
,
"OPTION NV_fragment_program;
\n
"
);
...
...
@@ -2240,6 +2244,7 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShader *iface,
struct
shader_arb_ctx_priv
priv_ctx
;
memset
(
&
priv_ctx
,
0
,
sizeof
(
priv_ctx
));
priv_ctx
.
cur_vs_args
=
args
;
/* Create the hw ARB shader */
shader_addline
(
buffer
,
"!!ARBvp1.0
\n
"
);
...
...
dlls/wined3d/glsl_shader.c
View file @
5865d9c0
...
...
@@ -122,6 +122,11 @@ typedef struct {
struct
vs_compile_args
vs_args
;
}
glsl_program_key_t
;
struct
shader_glsl_ctx_priv
{
const
struct
vs_compile_args
*
cur_vs_args
;
const
struct
ps_compile_args
*
cur_ps_args
;
};
/* Extract a line from the info log.
* Note that this modifies the source string. */
static
char
*
get_info_log_line
(
char
**
ptr
)
...
...
@@ -1123,7 +1128,8 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register *
/* vertex shaders */
if
(
!
pshader
)
{
if
(((
IWineD3DVertexShaderImpl
*
)
This
)
->
cur_args
->
swizzle_map
&
(
1
<<
reg
->
idx
))
*
is_color
=
TRUE
;
struct
shader_glsl_ctx_priv
*
priv
=
ins
->
ctx
->
backend_data
;
if
(
priv
->
cur_vs_args
->
swizzle_map
&
(
1
<<
reg
->
idx
))
*
is_color
=
TRUE
;
sprintf
(
register_name
,
"attrib%u"
,
reg
->
idx
);
break
;
}
...
...
@@ -1657,11 +1663,11 @@ static void PRINTF_ATTR(8, 9) shader_glsl_gen_sample_code(const struct wined3d_s
if
(
shader_is_pshader_version
(
ins
->
ctx
->
reg_maps
->
shader_version
.
type
))
{
IWineD3DPixelShaderImpl
*
This
=
(
IWineD3DPixelShaderImpl
*
)
ins
->
ctx
->
shader
;
fixup
=
This
->
cur
_args
->
color_fixup
[
sampler
];
struct
shader_glsl_ctx_priv
*
priv
=
ins
->
ctx
->
backend_data
;
fixup
=
priv
->
cur_ps
_args
->
color_fixup
[
sampler
];
sampler_base
=
"Psampler"
;
if
(
This
->
cur
_args
->
np2_fixup
&
(
1
<<
sampler
))
{
if
(
priv
->
cur_ps
_args
->
np2_fixup
&
(
1
<<
sampler
))
{
if
(
bias
)
{
FIXME
(
"Biased sampling from NP2 textures is unsupported
\n
"
);
}
else
{
...
...
@@ -4164,10 +4170,14 @@ static GLuint shader_glsl_generate_pshader(IWineD3DPixelShader *iface,
CONST
DWORD
*
function
=
This
->
baseShader
.
function
;
const
char
*
fragcolor
;
const
WineD3D_GL_Info
*
gl_info
=
&
((
IWineD3DDeviceImpl
*
)
This
->
baseShader
.
device
)
->
adapter
->
gl_info
;
struct
shader_glsl_ctx_priv
priv_ctx
;
/* Create the hw GLSL shader object and assign it as the shader->prgId */
GLhandleARB
shader_obj
=
GL_EXTCALL
(
glCreateShaderObjectARB
(
GL_FRAGMENT_SHADER_ARB
));
memset
(
&
priv_ctx
,
0
,
sizeof
(
priv_ctx
));
priv_ctx
.
cur_ps_args
=
args
;
shader_addline
(
buffer
,
"#version 120
\n
"
);
if
(
GL_SUPPORT
(
ARB_DRAW_BUFFERS
))
{
...
...
@@ -4193,7 +4203,7 @@ static GLuint shader_glsl_generate_pshader(IWineD3DPixelShader *iface,
}
/* Base Shader Body */
shader_generate_main
((
IWineD3DBaseShader
*
)
This
,
buffer
,
reg_maps
,
function
,
NULL
);
shader_generate_main
((
IWineD3DBaseShader
*
)
This
,
buffer
,
reg_maps
,
function
,
&
priv_ctx
);
/* Pixel shaders < 2.0 place the resulting color in R0 implicitly */
if
(
reg_maps
->
shader_version
.
major
<
2
)
...
...
@@ -4270,17 +4280,21 @@ static GLuint shader_glsl_generate_vshader(IWineD3DVertexShader *iface,
const
struct
shader_reg_maps
*
reg_maps
=
&
This
->
baseShader
.
reg_maps
;
CONST
DWORD
*
function
=
This
->
baseShader
.
function
;
const
WineD3D_GL_Info
*
gl_info
=
&
((
IWineD3DDeviceImpl
*
)
This
->
baseShader
.
device
)
->
adapter
->
gl_info
;
struct
shader_glsl_ctx_priv
priv_ctx
;
/* Create the hw GLSL shader program and assign it as the shader->prgId */
GLhandleARB
shader_obj
=
GL_EXTCALL
(
glCreateShaderObjectARB
(
GL_VERTEX_SHADER_ARB
));
shader_addline
(
buffer
,
"#version 120
\n
"
);
memset
(
&
priv_ctx
,
0
,
sizeof
(
priv_ctx
));
priv_ctx
.
cur_vs_args
=
args
;
/* Base Declarations */
shader_generate_glsl_declarations
(
(
IWineD3DBaseShader
*
)
This
,
reg_maps
,
buffer
,
&
GLINFO_LOCATION
,
NULL
);
/* Base Shader Body */
shader_generate_main
((
IWineD3DBaseShader
*
)
This
,
buffer
,
reg_maps
,
function
,
NULL
);
shader_generate_main
((
IWineD3DBaseShader
*
)
This
,
buffer
,
reg_maps
,
function
,
&
priv_ctx
);
/* Unpack 3.0 outputs */
if
(
reg_maps
->
shader_version
.
major
>=
3
)
shader_addline
(
buffer
,
"order_ps_input(OUT);
\n
"
);
...
...
dlls/wined3d/pixelshader.c
View file @
5865d9c0
...
...
@@ -358,11 +358,9 @@ static GLuint pixelshader_compile(IWineD3DPixelShaderImpl *This, const struct ps
/* Generate the HW shader */
TRACE
(
"(%p) : Generating hardware program
\n
"
,
This
);
This
->
cur_args
=
args
;
shader_buffer_init
(
&
buffer
);
retval
=
device
->
shader_backend
->
shader_generate_pshader
((
IWineD3DPixelShader
*
)
This
,
&
buffer
,
args
);
shader_buffer_free
(
&
buffer
);
This
->
cur_args
=
NULL
;
return
retval
;
}
...
...
dlls/wined3d/vertexshader.c
View file @
5865d9c0
...
...
@@ -341,9 +341,7 @@ static GLuint vertexshader_compile(IWineD3DVertexShaderImpl *This, const struct
/* Generate the HW shader */
TRACE
(
"(%p) : Generating hardware program
\n
"
,
This
);
shader_buffer_init
(
&
buffer
);
This
->
cur_args
=
args
;
ret
=
deviceImpl
->
shader_backend
->
shader_generate_vshader
((
IWineD3DVertexShader
*
)
This
,
&
buffer
,
args
);
This
->
cur_args
=
NULL
;
shader_buffer_free
(
&
buffer
);
return
ret
;
...
...
dlls/wined3d/wined3d_private.h
View file @
5865d9c0
...
...
@@ -2687,8 +2687,6 @@ typedef struct IWineD3DVertexShaderImpl {
UINT
rel_offset
;
UINT
recompile_count
;
const
struct
vs_compile_args
*
cur_args
;
}
IWineD3DVertexShaderImpl
;
extern
const
IWineD3DVertexShaderVtbl
IWineD3DVertexShader_Vtbl
;
...
...
@@ -2728,8 +2726,6 @@ typedef struct IWineD3DPixelShaderImpl {
unsigned
char
numbumpenvmatconsts
;
struct
stb_const_desc
luminanceconst
[
MAX_TEXTURES
];
char
vpos_uniform
;
const
struct
ps_compile_args
*
cur_args
;
}
IWineD3DPixelShaderImpl
;
extern
const
IWineD3DPixelShaderVtbl
IWineD3DPixelShader_Vtbl
;
...
...
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