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
8553665c
Commit
8553665c
authored
Dec 15, 2008
by
Henri Verbeet
Committed by
Alexandre Julliard
Dec 15, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Move the shader version to reg_maps.
parent
dd094fe6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
72 additions
and
70 deletions
+72
-70
arb_program_shader.c
dlls/wined3d/arb_program_shader.c
+32
-35
baseshader.c
dlls/wined3d/baseshader.c
+22
-21
glsl_shader.c
dlls/wined3d/glsl_shader.c
+0
-0
pixelshader.c
dlls/wined3d/pixelshader.c
+9
-7
state.c
dlls/wined3d/state.c
+5
-3
vertexshader.c
dlls/wined3d/vertexshader.c
+3
-2
wined3d_private.h
dlls/wined3d/wined3d_private.h
+1
-2
No files found.
dlls/wined3d/arb_program_shader.c
View file @
8553665c
This diff is collapsed.
Click to expand it.
dlls/wined3d/baseshader.c
View file @
8553665c
...
...
@@ -206,7 +206,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, struct shader_reg_m
{
IWineD3DBaseShaderImpl
*
This
=
(
IWineD3DBaseShaderImpl
*
)
iface
;
const
SHADER_OPCODE
*
shader_ins
=
This
->
baseShader
.
shader_ins
;
DWORD
shader_version
=
This
->
baseShader
.
hex_version
;
DWORD
shader_version
;
unsigned
int
cur_loop_depth
=
0
,
max_loop_depth
=
0
;
const
DWORD
*
pToken
=
byte_code
;
char
pshader
;
...
...
@@ -236,8 +236,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, struct shader_reg_m
FIXME
(
"First token is not a version token, invalid shader.
\n
"
);
return
WINED3DERR_INVALIDCALL
;
}
shader_version
=
*
pToken
++
;
This
->
baseShader
.
hex_version
=
shader_version
;
reg_maps
->
shader_version
=
shader_version
=
*
pToken
++
;
pshader
=
shader_is_pshader_version
(
shader_version
);
while
(
WINED3DVS_END
()
!=
*
pToken
)
{
...
...
@@ -302,7 +301,8 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, struct shader_reg_m
memcpy
(
lconst
->
value
,
pToken
+
1
,
4
*
sizeof
(
DWORD
));
/* In pixel shader 1.X shaders, the constants are clamped between [-1;1] */
if
(
WINED3DSHADER_VERSION_MAJOR
(
This
->
baseShader
.
hex_version
)
==
1
&&
pshader
)
{
if
(
WINED3DSHADER_VERSION_MAJOR
(
shader_version
)
==
1
&&
pshader
)
{
float
*
value
=
(
float
*
)
lconst
->
value
;
if
(
value
[
0
]
<
-
1
.
0
)
value
[
0
]
=
-
1
.
0
;
else
if
(
value
[
0
]
>
1
.
0
)
value
[
0
]
=
1
.
0
;
...
...
@@ -361,20 +361,20 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, struct shader_reg_m
int
i
,
limit
;
/* Declare 1.X samplers implicitly, based on the destination reg. number */
if
(
WINED3DSHADER_VERSION_MAJOR
(
This
->
baseShader
.
hex_version
)
==
1
&&
pshader
/* Filter different instructions with the same enum values in VS */
&&
(
WINED3DSIO_TEX
==
curOpcode
->
opcode
||
WINED3DSIO_TEXBEM
==
curOpcode
->
opcode
||
WINED3DSIO_TEXBEML
==
curOpcode
->
opcode
||
WINED3DSIO_TEXDP3TEX
==
curOpcode
->
opcode
||
WINED3DSIO_TEXM3x2TEX
==
curOpcode
->
opcode
||
WINED3DSIO_TEXM3x3SPEC
==
curOpcode
->
opcode
||
WINED3DSIO_TEXM3x3TEX
==
curOpcode
->
opcode
||
WINED3DSIO_TEXM3x3VSPEC
==
curOpcode
->
opcode
||
WINED3DSIO_TEXREG2AR
==
curOpcode
->
opcode
||
WINED3DSIO_TEXREG2GB
==
curOpcode
->
opcode
||
WINED3DSIO_TEXREG2RGB
==
curOpcode
->
opcode
))
{
if
(
WINED3DSHADER_VERSION_MAJOR
(
shader_version
)
==
1
&&
pshader
/* Filter different instructions with the same enum values in VS */
&&
(
WINED3DSIO_TEX
==
curOpcode
->
opcode
||
WINED3DSIO_TEXBEM
==
curOpcode
->
opcode
||
WINED3DSIO_TEXBEML
==
curOpcode
->
opcode
||
WINED3DSIO_TEXDP3TEX
==
curOpcode
->
opcode
||
WINED3DSIO_TEXM3x2TEX
==
curOpcode
->
opcode
||
WINED3DSIO_TEXM3x3SPEC
==
curOpcode
->
opcode
||
WINED3DSIO_TEXM3x3TEX
==
curOpcode
->
opcode
||
WINED3DSIO_TEXM3x3VSPEC
==
curOpcode
->
opcode
||
WINED3DSIO_TEXREG2AR
==
curOpcode
->
opcode
||
WINED3DSIO_TEXREG2GB
==
curOpcode
->
opcode
||
WINED3DSIO_TEXREG2RGB
==
curOpcode
->
opcode
))
{
/* Fake sampler usage, only set reserved bit and ttype */
DWORD
sampler_code
=
*
pToken
&
WINED3DSP_REGNUM_MASK
;
...
...
@@ -476,8 +476,9 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, struct shader_reg_m
* in >= 3.0 shaders. Filter 3.0 shaders to prevent overflows, and also filter pixel shaders because TECRDOUT
* isn't used in them, but future register types might cause issues
*/
else
if
(
WINED3DSPR_TEXCRDOUT
==
regtype
&&
i
==
0
/* Only look at writes */
&&
!
pshader
&&
WINED3DSHADER_VERSION_MAJOR
(
This
->
baseShader
.
hex_version
)
<
3
)
{
else
if
(
WINED3DSPR_TEXCRDOUT
==
regtype
&&
i
==
0
/* Only look at writes */
&&
!
pshader
&&
WINED3DSHADER_VERSION_MAJOR
(
shader_version
)
<
3
)
{
reg_maps
->
texcoord_mask
[
reg
]
|=
shader_get_writemask
(
param
);
}
}
...
...
@@ -832,7 +833,7 @@ void shader_generate_main(IWineD3DBaseShader *iface, SHADER_BUFFER* buffer,
IWineD3DDeviceImpl
*
device
=
(
IWineD3DDeviceImpl
*
)
This
->
baseShader
.
device
;
/* To access shader backend callbacks */
const
SHADER_OPCODE
*
opcode_table
=
This
->
baseShader
.
shader_ins
;
const
SHADER_HANDLER
*
handler_table
=
device
->
shader_backend
->
shader_instruction_handler_table
;
DWORD
shader_version
=
This
->
baseShader
.
hex
_version
;
DWORD
shader_version
=
reg_maps
->
shader
_version
;
const
DWORD
*
pToken
=
pFunction
;
const
SHADER_OPCODE
*
curOpcode
=
NULL
;
SHADER_HANDLER
hw_fct
=
NULL
;
...
...
dlls/wined3d/glsl_shader.c
View file @
8553665c
This diff is collapsed.
Click to expand it.
dlls/wined3d/pixelshader.c
View file @
8553665c
...
...
@@ -226,7 +226,8 @@ static void pshader_set_limits(
This
->
baseShader
.
limits
.
address
=
0
;
This
->
baseShader
.
limits
.
packed_output
=
0
;
switch
(
This
->
baseShader
.
hex_version
)
{
switch
(
This
->
baseShader
.
reg_maps
.
shader_version
)
{
case
WINED3DPS_VERSION
(
1
,
0
):
case
WINED3DPS_VERSION
(
1
,
1
):
case
WINED3DPS_VERSION
(
1
,
2
):
...
...
@@ -293,8 +294,8 @@ static void pshader_set_limits(
This
->
baseShader
.
limits
.
sampler
=
16
;
This
->
baseShader
.
limits
.
packed_input
=
0
;
This
->
baseShader
.
limits
.
label
=
0
;
FIXME
(
"Unrecognized pixel shader version %#x
\n
"
,
This
->
baseShader
.
hex
_version
);
FIXME
(
"Unrecognized pixel shader version %#x
\n
"
,
This
->
baseShader
.
reg_maps
.
shader
_version
);
}
}
...
...
@@ -395,9 +396,9 @@ static HRESULT WINAPI IWineD3DPixelShaderImpl_SetFunction(IWineD3DPixelShader *i
return
WINED3D_OK
;
}
static
void
pixelshader_update_samplers
(
struct
shader_reg_maps
*
reg_maps
,
IWineD3DBaseTexture
*
const
*
textures
,
DWORD
shader_version
)
static
void
pixelshader_update_samplers
(
struct
shader_reg_maps
*
reg_maps
,
IWineD3DBaseTexture
*
const
*
textures
)
{
DWORD
shader_version
=
reg_maps
->
shader_version
;
DWORD
*
samplers
=
reg_maps
->
samplers
;
unsigned
int
i
;
...
...
@@ -448,7 +449,7 @@ static GLuint pixelshader_compile(IWineD3DPixelShaderImpl *This, const struct ps
TRACE
(
"(%p) : function %p
\n
"
,
This
,
function
);
pixelshader_update_samplers
(
&
This
->
baseShader
.
reg_maps
,
((
IWineD3DDeviceImpl
*
)
This
->
baseShader
.
device
)
->
stateBlock
->
textures
,
This
->
baseShader
.
hex_version
);
((
IWineD3DDeviceImpl
*
)
This
->
baseShader
.
device
)
->
stateBlock
->
textures
);
/* Reset fields tracking stateblock values being hardcoded in the shader */
This
->
baseShader
.
num_sampled_samplers
=
0
;
...
...
@@ -493,7 +494,8 @@ void find_ps_compile_args(IWineD3DPixelShaderImpl *shader, IWineD3DStateBlockImp
}
args
->
color_fixup
[
sampler
]
=
tex
->
baseTexture
.
shader_color_fixup
;
}
if
(
shader
->
baseShader
.
hex_version
>=
WINED3DPS_VERSION
(
3
,
0
))
{
if
(
shader
->
baseShader
.
reg_maps
.
shader_version
>=
WINED3DPS_VERSION
(
3
,
0
))
{
if
(((
IWineD3DDeviceImpl
*
)
shader
->
baseShader
.
device
)
->
strided_streams
.
u
.
s
.
position_transformed
)
{
args
->
vp_mode
=
pretransformed
;
}
else
if
(
use_vs
((
IWineD3DDeviceImpl
*
)
shader
->
baseShader
.
device
))
{
...
...
dlls/wined3d/state.c
View file @
8553665c
...
...
@@ -901,8 +901,9 @@ static void state_stencilwrite(DWORD state, IWineD3DStateBlockImpl *stateblock,
static
void
state_fog
(
DWORD
state
,
IWineD3DStateBlockImpl
*
stateblock
,
WineD3DContext
*
context
)
{
BOOL
fogenable
=
stateblock
->
renderState
[
WINED3DRS_FOGENABLE
];
IWineD3DPixelShaderImpl
*
ps_impl
=
(
IWineD3DPixelShaderImpl
*
)
stateblock
->
pixelShader
;
BOOL
is_ps3
=
use_ps
(
stateblock
->
wineD3DDevice
)
&&
((
IWineD3DPixelShaderImpl
*
)
stateblock
->
pixelShader
)
->
baseShader
.
hex
_version
>=
WINED3DPS_VERSION
(
3
,
0
);
&&
ps_impl
->
baseShader
.
reg_maps
.
shader
_version
>=
WINED3DPS_VERSION
(
3
,
0
);
float
fogstart
,
fogend
;
union
{
...
...
@@ -914,8 +915,9 @@ static void state_fog(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCo
/* No fog? Disable it, and we're done :-) */
glDisable
(
GL_FOG
);
checkGLcall
(
"glDisable GL_FOG"
);
if
(
use_ps
(
stateblock
->
wineD3DDevice
)
&&
((
IWineD3DPixelShaderImpl
*
)
stateblock
->
pixelShader
)
->
baseShader
.
hex_version
<
WINED3DPS_VERSION
(
3
,
0
)
)
{
if
(
use_ps
(
stateblock
->
wineD3DDevice
)
&&
ps_impl
->
baseShader
.
reg_maps
.
shader_version
<
WINED3DPS_VERSION
(
3
,
0
))
{
/* disable fog in the pixel shader
* NOTE: For pixel shader, GL_FOG_START and GL_FOG_END don't hold fog start s and end e but
* -1/(e-s) and e/(e-s) respectively.
...
...
dlls/wined3d/vertexshader.c
View file @
8553665c
...
...
@@ -120,7 +120,8 @@ static void vshader_set_limits(
/* Must match D3DCAPS9.MaxVertexShaderConst: at least 256 for vs_2_0 */
This
->
baseShader
.
limits
.
constant_float
=
GL_LIMITS
(
vshader_constantsF
);
switch
(
This
->
baseShader
.
hex_version
)
{
switch
(
This
->
baseShader
.
reg_maps
.
shader_version
)
{
case
WINED3DVS_VERSION
(
1
,
0
):
case
WINED3DVS_VERSION
(
1
,
1
):
This
->
baseShader
.
limits
.
temporary
=
12
;
...
...
@@ -161,7 +162,7 @@ static void vshader_set_limits(
This
->
baseShader
.
limits
.
sampler
=
0
;
This
->
baseShader
.
limits
.
label
=
16
;
FIXME
(
"Unrecognized vertex shader version %#x
\n
"
,
This
->
baseShader
.
hex
_version
);
This
->
baseShader
.
reg_maps
.
shader
_version
);
}
}
...
...
dlls/wined3d/wined3d_private.h
View file @
8553665c
...
...
@@ -2067,7 +2067,7 @@ typedef struct local_constant {
}
local_constant
;
typedef
struct
shader_reg_maps
{
DWORD
shader_version
;
char
texcoord
[
MAX_REG_TEXCRD
];
/* pixel < 3.0 */
char
temporary
[
MAX_REG_TEMP
];
/* pixel, vertex */
char
address
[
MAX_REG_ADDR
];
/* vertex */
...
...
@@ -2185,7 +2185,6 @@ extern void shader_glsl_add_instruction_modifiers(const SHADER_OPCODE_ARG *arg);
typedef
struct
IWineD3DBaseShaderClass
{
LONG
ref
;
DWORD
hex_version
;
SHADER_LIMITS
limits
;
SHADER_PARSE_STATE
parse_state
;
CONST
SHADER_OPCODE
*
shader_ins
;
...
...
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