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
8d4c9049
Commit
8d4c9049
authored
Apr 29, 2009
by
Henri Verbeet
Committed by
Alexandre Julliard
Apr 29, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Store the sampler type in struct shader_reg_maps.
Instead of the usage token.
parent
54d7c801
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
42 additions
and
42 deletions
+42
-42
arb_program_shader.c
dlls/wined3d/arb_program_shader.c
+1
-1
baseshader.c
dlls/wined3d/baseshader.c
+2
-2
device.c
dlls/wined3d/device.c
+12
-9
glsl_shader.c
dlls/wined3d/glsl_shader.c
+18
-19
pixelshader.c
dlls/wined3d/pixelshader.c
+8
-8
wined3d_private.h
dlls/wined3d/wined3d_private.h
+1
-3
No files found.
dlls/wined3d/arb_program_shader.c
View file @
8d4c9049
...
...
@@ -659,7 +659,7 @@ static void shader_hw_sample(const struct wined3d_shader_instruction *ins, DWORD
const
char
*
dst_str
,
const
char
*
coord_reg
,
BOOL
projected
,
BOOL
bias
)
{
SHADER_BUFFER
*
buffer
=
ins
->
ctx
->
buffer
;
DWORD
sampler_type
=
ins
->
ctx
->
reg_maps
->
sampler
s
[
sampler_idx
]
&
WINED3DSP_TEXTURETYPE_MASK
;
DWORD
sampler_type
=
ins
->
ctx
->
reg_maps
->
sampler
_type
[
sampler_idx
]
;
const
char
*
tex_type
;
IWineD3DBaseShaderImpl
*
This
=
(
IWineD3DBaseShaderImpl
*
)
ins
->
ctx
->
shader
;
IWineD3DDeviceImpl
*
device
=
(
IWineD3DDeviceImpl
*
)
This
->
baseShader
.
device
;
...
...
dlls/wined3d/baseshader.c
View file @
8d4c9049
...
...
@@ -633,7 +633,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, struct shader_reg_m
/* Save sampler usage token */
}
else
if
(
WINED3DSPR_SAMPLER
==
regtype
)
reg_maps
->
sampler
s
[
regnum
]
=
usage
;
reg_maps
->
sampler
_type
[
regnum
]
=
usage
&
WINED3DSP_TEXTURETYPE_MASK
;
}
else
if
(
ins
.
handler_idx
==
WINED3DSIH_DEF
)
{
...
...
@@ -734,7 +734,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, struct shader_reg_m
DWORD
sampler_code
=
*
pToken
&
WINED3DSP_REGNUM_MASK
;
TRACE
(
"Setting fake 2D sampler for 1.x pixelshader
\n
"
);
reg_maps
->
sampler
s
[
sampler_code
]
=
(
0x1
<<
31
)
|
WINED3DSTT_2D
;
reg_maps
->
sampler
_type
[
sampler_code
]
=
WINED3DSTT_2D
;
/* texbem is only valid with < 1.4 pixel shaders */
if
(
ins
.
handler_idx
==
WINED3DSIH_TEXBEM
...
...
dlls/wined3d/device.c
View file @
8d4c9049
...
...
@@ -4208,12 +4208,13 @@ static void device_map_fixed_function_samplers(IWineD3DDeviceImpl *This) {
}
static
void
device_map_psamplers
(
IWineD3DDeviceImpl
*
This
)
{
const
DWORD
*
sampler_tokens
=
((
IWineD3DPixelShaderImpl
*
)
This
->
stateBlock
->
pixelShader
)
->
baseShader
.
reg_maps
.
sampler
s
;
const
WINED3DSAMPLER_TEXTURE_TYPE
*
sampler_type
=
((
IWineD3DPixelShaderImpl
*
)
This
->
stateBlock
->
pixelShader
)
->
baseShader
.
reg_maps
.
sampler
_type
;
unsigned
int
i
;
for
(
i
=
0
;
i
<
MAX_FRAGMENT_SAMPLERS
;
++
i
)
{
if
(
sampler_tokens
[
i
]
&&
This
->
texUnitMap
[
i
]
!=
i
)
{
if
(
sampler_type
[
i
]
&&
This
->
texUnitMap
[
i
]
!=
i
)
{
device_map_stage
(
This
,
i
,
i
);
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_SAMPLER
(
i
));
if
(
i
<
MAX_TEXTURES
)
{
...
...
@@ -4250,9 +4251,9 @@ static BOOL device_unit_free_for_vs(IWineD3DDeviceImpl *This, const DWORD *pshad
}
static
void
device_map_vsamplers
(
IWineD3DDeviceImpl
*
This
,
BOOL
ps
)
{
const
DWORD
*
vshader_sampler_tokens
=
((
IWineD3DVertexShaderImpl
*
)
This
->
stateBlock
->
vertexShader
)
->
baseShader
.
reg_maps
.
sampler
s
;
const
DWORD
*
pshader_sampler_tokens
=
NULL
;
const
WINED3DSAMPLER_TEXTURE_TYPE
*
vshader_sampler_type
=
((
IWineD3DVertexShaderImpl
*
)
This
->
stateBlock
->
vertexShader
)
->
baseShader
.
reg_maps
.
sampler
_type
;
const
WINED3DSAMPLER_TEXTURE_TYPE
*
pshader_sampler_type
=
NULL
;
int
start
=
GL_LIMITS
(
combined_samplers
)
-
1
;
int
i
;
...
...
@@ -4261,12 +4262,13 @@ static void device_map_vsamplers(IWineD3DDeviceImpl *This, BOOL ps) {
/* Note that we only care if a sampler is sampled or not, not the sampler's specific type.
* Otherwise we'd need to call shader_update_samplers() here for 1.x pixelshaders. */
pshader_sampler_t
okens
=
pshader
->
baseShader
.
reg_maps
.
samplers
;
pshader_sampler_t
ype
=
pshader
->
baseShader
.
reg_maps
.
sampler_type
;
}
for
(
i
=
0
;
i
<
MAX_VERTEX_SAMPLERS
;
++
i
)
{
int
vsampler_idx
=
i
+
MAX_FRAGMENT_SAMPLERS
;
if
(
vshader_sampler_tokens
[
i
])
{
if
(
vshader_sampler_type
[
i
])
{
if
(
This
->
texUnitMap
[
vsampler_idx
]
!=
WINED3D_UNMAPPED_STAGE
)
{
/* Already mapped somewhere */
...
...
@@ -4274,7 +4276,8 @@ static void device_map_vsamplers(IWineD3DDeviceImpl *This, BOOL ps) {
}
while
(
start
>=
0
)
{
if
(
device_unit_free_for_vs
(
This
,
pshader_sampler_tokens
,
vshader_sampler_tokens
,
start
))
{
if
(
device_unit_free_for_vs
(
This
,
pshader_sampler_type
,
vshader_sampler_type
,
start
))
{
device_map_stage
(
This
,
vsampler_idx
,
start
);
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_SAMPLER
(
vsampler_idx
));
...
...
dlls/wined3d/glsl_shader.c
View file @
8d4c9049
...
...
@@ -834,11 +834,10 @@ static void shader_generate_glsl_declarations(IWineD3DBaseShader *iface, const s
/* Declare texture samplers */
for
(
i
=
0
;
i
<
This
->
baseShader
.
limits
.
sampler
;
i
++
)
{
if
(
reg_maps
->
samplers
[
i
])
{
DWORD
stype
=
reg_maps
->
samplers
[
i
]
&
WINED3DSP_TEXTURETYPE_MASK
;
switch
(
stype
)
{
if
(
reg_maps
->
sampler_type
[
i
])
{
switch
(
reg_maps
->
sampler_type
[
i
])
{
case
WINED3DSTT_1D
:
shader_addline
(
buffer
,
"uniform sampler1D %csampler%u;
\n
"
,
prefix
,
i
);
break
;
...
...
@@ -867,7 +866,7 @@ static void shader_generate_glsl_declarations(IWineD3DBaseShader *iface, const s
break
;
default:
shader_addline
(
buffer
,
"uniform unsupported_sampler %csampler%u;
\n
"
,
prefix
,
i
);
FIXME
(
"Unrecognized sampler type: %#x
\n
"
,
stype
);
FIXME
(
"Unrecognized sampler type: %#x
\n
"
,
reg_maps
->
sampler_type
[
i
]
);
break
;
}
}
...
...
@@ -2440,7 +2439,7 @@ static void pshader_glsl_tex(const struct wined3d_shader_instruction *ins)
DWORD
shader_version
=
ins
->
ctx
->
reg_maps
->
shader_version
;
glsl_sample_function_t
sample_function
;
DWORD
sample_flags
=
0
;
DWORD
sampler_type
;
WINED3DSAMPLER_TEXTURE_TYPE
sampler_type
;
DWORD
sampler_idx
;
DWORD
mask
=
0
,
swizzle
;
...
...
@@ -2448,7 +2447,7 @@ static void pshader_glsl_tex(const struct wined3d_shader_instruction *ins)
* 2.0+: Use provided sampler source. */
if
(
shader_version
<
WINED3DPS_VERSION
(
2
,
0
))
sampler_idx
=
ins
->
dst
[
0
].
register_idx
;
else
sampler_idx
=
ins
->
src
[
1
].
register_idx
;
sampler_type
=
ins
->
ctx
->
reg_maps
->
sampler
s
[
sampler_idx
]
&
WINED3DSP_TEXTURETYPE_MASK
;
sampler_type
=
ins
->
ctx
->
reg_maps
->
sampler
_type
[
sampler_idx
]
;
if
(
shader_version
<
WINED3DPS_VERSION
(
1
,
4
))
{
...
...
@@ -2533,7 +2532,7 @@ static void shader_glsl_texldl(const struct wined3d_shader_instruction *ins)
DWORD
swizzle
=
ins
->
src
[
1
].
swizzle
;
sampler_idx
=
ins
->
src
[
1
].
register_idx
;
sampler_type
=
ins
->
ctx
->
reg_maps
->
sampler
s
[
sampler_idx
]
&
WINED3DSP_TEXTURETYPE_MASK
;
sampler_type
=
ins
->
ctx
->
reg_maps
->
sampler
_type
[
sampler_idx
]
;
if
(
deviceImpl
->
stateBlock
->
textures
[
sampler_idx
]
&&
IWineD3DBaseTexture_GetTextureDimensions
(
deviceImpl
->
stateBlock
->
textures
[
sampler_idx
])
==
GL_TEXTURE_RECTANGLE_ARB
)
{
sample_flags
|=
WINED3D_GLSL_SAMPLE_RECT
;
...
...
@@ -2608,7 +2607,7 @@ static void pshader_glsl_texdp3tex(const struct wined3d_shader_instruction *ins)
glsl_sample_function_t
sample_function
;
DWORD
sampler_idx
=
ins
->
dst
[
0
].
register_idx
;
DWORD
src_mask
=
WINED3DSP_WRITEMASK_0
|
WINED3DSP_WRITEMASK_1
|
WINED3DSP_WRITEMASK_2
;
DWORD
sampler_type
=
ins
->
ctx
->
reg_maps
->
samplers
[
sampler_idx
]
&
WINED3DSP_TEXTURETYPE_MASK
;
WINED3DSAMPLER_TEXTURE_TYPE
sampler_type
=
ins
->
ctx
->
reg_maps
->
sampler_type
[
sampler_idx
]
;
UINT
mask_size
;
shader_glsl_add_src_param
(
ins
,
&
ins
->
src
[
0
],
src_mask
,
&
src0_param
);
...
...
@@ -2735,7 +2734,7 @@ static void pshader_glsl_texm3x2tex(const struct wined3d_shader_instruction *ins
DWORD
reg
=
ins
->
dst
[
0
].
register_idx
;
SHADER_BUFFER
*
buffer
=
ins
->
ctx
->
buffer
;
glsl_src_param_t
src0_param
;
DWORD
sampler_type
=
ins
->
ctx
->
reg_maps
->
samplers
[
reg
]
&
WINED3DSP_TEXTURETYPE_MASK
;
WINED3DSAMPLER_TEXTURE_TYPE
sampler_type
=
ins
->
ctx
->
reg_maps
->
sampler_type
[
reg
]
;
glsl_sample_function_t
sample_function
;
shader_glsl_add_src_param
(
ins
,
&
ins
->
src
[
0
],
src_mask
,
&
src0_param
);
...
...
@@ -2756,7 +2755,7 @@ static void pshader_glsl_texm3x3tex(const struct wined3d_shader_instruction *ins
DWORD
reg
=
ins
->
dst
[
0
].
register_idx
;
IWineD3DPixelShaderImpl
*
This
=
(
IWineD3DPixelShaderImpl
*
)
ins
->
ctx
->
shader
;
SHADER_PARSE_STATE
*
current_state
=
&
This
->
baseShader
.
parse_state
;
DWORD
sampler_type
=
ins
->
ctx
->
reg_maps
->
samplers
[
reg
]
&
WINED3DSP_TEXTURETYPE_MASK
;
WINED3DSAMPLER_TEXTURE_TYPE
sampler_type
=
ins
->
ctx
->
reg_maps
->
sampler_type
[
reg
]
;
glsl_sample_function_t
sample_function
;
shader_glsl_add_src_param
(
ins
,
&
ins
->
src
[
0
],
src_mask
,
&
src0_param
);
...
...
@@ -2801,7 +2800,7 @@ static void pshader_glsl_texm3x3spec(const struct wined3d_shader_instruction *in
glsl_src_param_t
src1_param
;
SHADER_BUFFER
*
buffer
=
ins
->
ctx
->
buffer
;
SHADER_PARSE_STATE
*
current_state
=
&
shader
->
baseShader
.
parse_state
;
DWORD
stype
=
ins
->
ctx
->
reg_maps
->
samplers
[
reg
]
&
WINED3DSP_TEXTURETYPE_MASK
;
WINED3DSAMPLER_TEXTURE_TYPE
stype
=
ins
->
ctx
->
reg_maps
->
sampler_type
[
reg
]
;
DWORD
src_mask
=
WINED3DSP_WRITEMASK_0
|
WINED3DSP_WRITEMASK_1
|
WINED3DSP_WRITEMASK_2
;
glsl_sample_function_t
sample_function
;
...
...
@@ -2832,7 +2831,7 @@ static void pshader_glsl_texm3x3vspec(const struct wined3d_shader_instruction *i
SHADER_PARSE_STATE
*
current_state
=
&
shader
->
baseShader
.
parse_state
;
glsl_src_param_t
src0_param
;
DWORD
src_mask
=
WINED3DSP_WRITEMASK_0
|
WINED3DSP_WRITEMASK_1
|
WINED3DSP_WRITEMASK_2
;
DWORD
sampler_type
=
ins
->
ctx
->
reg_maps
->
samplers
[
reg
]
&
WINED3DSP_TEXTURETYPE_MASK
;
WINED3DSAMPLER_TEXTURE_TYPE
sampler_type
=
ins
->
ctx
->
reg_maps
->
sampler_type
[
reg
]
;
glsl_sample_function_t
sample_function
;
shader_glsl_add_src_param
(
ins
,
&
ins
->
src
[
0
],
src_mask
,
&
src0_param
);
...
...
@@ -2864,7 +2863,7 @@ static void pshader_glsl_texbem(const struct wined3d_shader_instruction *ins)
IWineD3DDeviceImpl
*
deviceImpl
=
(
IWineD3DDeviceImpl
*
)
This
->
baseShader
.
device
;
glsl_sample_function_t
sample_function
;
glsl_src_param_t
coord_param
;
DWORD
sampler_type
;
WINED3DSAMPLER_TEXTURE_TYPE
sampler_type
;
DWORD
sampler_idx
;
DWORD
mask
;
DWORD
flags
;
...
...
@@ -2873,7 +2872,7 @@ static void pshader_glsl_texbem(const struct wined3d_shader_instruction *ins)
sampler_idx
=
ins
->
dst
[
0
].
register_idx
;
flags
=
deviceImpl
->
stateBlock
->
textureState
[
sampler_idx
][
WINED3DTSS_TEXTURETRANSFORMFLAGS
];
sampler_type
=
ins
->
ctx
->
reg_maps
->
sampler
s
[
sampler_idx
]
&
WINED3DSP_TEXTURETYPE_MASK
;
sampler_type
=
ins
->
ctx
->
reg_maps
->
sampler
_type
[
sampler_idx
]
;
/* Dependent read, not valid with conditional NP2 */
shader_glsl_get_sample_function
(
sampler_type
,
0
,
&
sample_function
);
mask
=
sample_function
.
coord_mask
;
...
...
@@ -2936,7 +2935,7 @@ static void pshader_glsl_texreg2ar(const struct wined3d_shader_instruction *ins)
{
glsl_src_param_t
src0_param
;
DWORD
sampler_idx
=
ins
->
dst
[
0
].
register_idx
;
DWORD
sampler_type
=
ins
->
ctx
->
reg_maps
->
samplers
[
sampler_idx
]
&
WINED3DSP_TEXTURETYPE_MASK
;
WINED3DSAMPLER_TEXTURE_TYPE
sampler_type
=
ins
->
ctx
->
reg_maps
->
sampler_type
[
sampler_idx
]
;
glsl_sample_function_t
sample_function
;
shader_glsl_add_src_param
(
ins
,
&
ins
->
src
[
0
],
WINED3DSP_WRITEMASK_ALL
,
&
src0_param
);
...
...
@@ -2952,7 +2951,7 @@ static void pshader_glsl_texreg2gb(const struct wined3d_shader_instruction *ins)
{
glsl_src_param_t
src0_param
;
DWORD
sampler_idx
=
ins
->
dst
[
0
].
register_idx
;
DWORD
sampler_type
=
ins
->
ctx
->
reg_maps
->
samplers
[
sampler_idx
]
&
WINED3DSP_TEXTURETYPE_MASK
;
WINED3DSAMPLER_TEXTURE_TYPE
sampler_type
=
ins
->
ctx
->
reg_maps
->
sampler_type
[
sampler_idx
]
;
glsl_sample_function_t
sample_function
;
shader_glsl_add_src_param
(
ins
,
&
ins
->
src
[
0
],
WINED3DSP_WRITEMASK_ALL
,
&
src0_param
);
...
...
@@ -2968,7 +2967,7 @@ static void pshader_glsl_texreg2rgb(const struct wined3d_shader_instruction *ins
{
glsl_src_param_t
src0_param
;
DWORD
sampler_idx
=
ins
->
dst
[
0
].
register_idx
;
DWORD
sampler_type
=
ins
->
ctx
->
reg_maps
->
samplers
[
sampler_idx
]
&
WINED3DSP_TEXTURETYPE_MASK
;
WINED3DSAMPLER_TEXTURE_TYPE
sampler_type
=
ins
->
ctx
->
reg_maps
->
sampler_type
[
sampler_idx
]
;
glsl_sample_function_t
sample_function
;
/* Dependent read, not valid with conditional NP2 */
...
...
dlls/wined3d/pixelshader.c
View file @
8d4c9049
...
...
@@ -374,7 +374,7 @@ static HRESULT WINAPI IWineD3DPixelShaderImpl_SetFunction(IWineD3DPixelShader *i
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
;
WINED3DSAMPLER_TEXTURE_TYPE
*
sampler_type
=
reg_maps
->
sampler_type
;
unsigned
int
i
;
if
(
WINED3DSHADER_VERSION_MAJOR
(
shader_version
)
!=
1
)
return
;
...
...
@@ -382,12 +382,12 @@ static void pixelshader_update_samplers(struct shader_reg_maps *reg_maps, IWineD
for
(
i
=
0
;
i
<
max
(
MAX_FRAGMENT_SAMPLERS
,
MAX_VERTEX_SAMPLERS
);
++
i
)
{
/* We don't sample from this sampler */
if
(
!
sampler
s
[
i
])
continue
;
if
(
!
sampler
_type
[
i
])
continue
;
if
(
!
textures
[
i
])
{
ERR
(
"No texture bound to sampler %u, using 2D
\n
"
,
i
);
sampler
s
[
i
]
=
(
0x1
<<
31
)
|
WINED3DSTT_2D
;
sampler
_type
[
i
]
=
WINED3DSTT_2D
;
continue
;
}
...
...
@@ -397,21 +397,21 @@ static void pixelshader_update_samplers(struct shader_reg_maps *reg_maps, IWineD
case
GL_TEXTURE_2D
:
/* We have to select between texture rectangles and 2D textures later because 2.0 and
* 3.0 shaders only have WINED3DSTT_2D as well */
sampler
s
[
i
]
=
(
1
<<
31
)
|
WINED3DSTT_2D
;
sampler
_type
[
i
]
=
WINED3DSTT_2D
;
break
;
case
GL_TEXTURE_3D
:
sampler
s
[
i
]
=
(
1
<<
31
)
|
WINED3DSTT_VOLUME
;
sampler
_type
[
i
]
=
WINED3DSTT_VOLUME
;
break
;
case
GL_TEXTURE_CUBE_MAP_ARB
:
sampler
s
[
i
]
=
(
1
<<
31
)
|
WINED3DSTT_CUBE
;
sampler
_type
[
i
]
=
WINED3DSTT_CUBE
;
break
;
default:
FIXME
(
"Unrecognized texture type %#x, using 2D
\n
"
,
IWineD3DBaseTexture_GetTextureDimensions
(
textures
[
i
]));
sampler
s
[
i
]
=
(
0x1
<<
31
)
|
WINED3DSTT_2D
;
sampler
_type
[
i
]
=
WINED3DSTT_2D
;
}
}
}
...
...
@@ -463,7 +463,7 @@ void find_ps_compile_args(IWineD3DPixelShaderImpl *shader, IWineD3DStateBlockImp
args
->
np2_fixup
=
0
;
for
(
i
=
0
;
i
<
MAX_FRAGMENT_SAMPLERS
;
i
++
)
{
if
(
shader
->
baseShader
.
reg_maps
.
samplers
[
i
]
==
0
)
continue
;
if
(
!
shader
->
baseShader
.
reg_maps
.
sampler_type
[
i
]
)
continue
;
tex
=
(
IWineD3DBaseTextureImpl
*
)
stateblock
->
textures
[
i
];
if
(
!
tex
)
{
args
->
color_fixup
[
i
]
=
COLOR_FIXUP_IDENTITY
;
...
...
dlls/wined3d/wined3d_private.h
View file @
8d4c9049
...
...
@@ -416,9 +416,7 @@ typedef struct shader_reg_maps
WORD
integer_constants
;
/* MAX_CONST_I, 16 */
WORD
boolean_constants
;
/* MAX_CONST_B, 16 */
/* Sampler usage tokens
* Use 0 as default (bit 31 is always 1 on a valid token) */
DWORD
samplers
[
max
(
MAX_FRAGMENT_SAMPLERS
,
MAX_VERTEX_SAMPLERS
)];
WINED3DSAMPLER_TEXTURE_TYPE
sampler_type
[
max
(
MAX_FRAGMENT_SAMPLERS
,
MAX_VERTEX_SAMPLERS
)];
BOOL
bumpmat
[
MAX_TEXTURES
],
luminanceparams
[
MAX_TEXTURES
];
char
usesnrm
,
vpos
,
usesdsy
;
char
usesrelconstF
;
...
...
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