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
2e52b36b
Commit
2e52b36b
authored
Jul 28, 2006
by
Jason Green
Committed by
Alexandre Julliard
Jul 29, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Declare a 1D sampler for TEXDP3TEX (GLSL).
parent
d353ab78
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
29 deletions
+52
-29
baseshader.c
dlls/wined3d/baseshader.c
+12
-6
glsl_shader.c
dlls/wined3d/glsl_shader.c
+26
-23
d3d9types.h
include/d3d9types.h
+1
-0
wined3d_types.h
include/wine/wined3d_types.h
+13
-0
No files found.
dlls/wined3d/baseshader.c
View file @
2e52b36b
...
...
@@ -299,7 +299,7 @@ HRESULT shader_get_registers_used(
/* Fake sampler usage, only set reserved bit and ttype */
DWORD
sampler_code
=
*
pToken
&
D3DSP_REGNUM_MASK
;
reg_maps
->
samplers
[
sampler_code
]
=
(
0x1
<<
31
)
|
D3DSTT_2D
;
reg_maps
->
samplers
[
sampler_code
]
=
(
0x1
<<
31
)
|
WINE
D3DSTT_2D
;
}
else
if
(
D3DSHADER_VERSION_MAJOR
(
This
->
baseShader
.
hex_version
)
==
1
&&
(
D3DSIO_TEXM3x3SPEC
==
curOpcode
->
opcode
||
...
...
@@ -310,7 +310,13 @@ HRESULT shader_get_registers_used(
* we waited to generate the shader until the textures were all bound.
* For now, use Cube textures because they are more common. */
DWORD
sampler_code
=
*
pToken
&
D3DSP_REGNUM_MASK
;
reg_maps
->
samplers
[
sampler_code
]
=
(
0x1
<<
31
)
|
D3DSTT_CUBE
;
reg_maps
->
samplers
[
sampler_code
]
=
(
0x1
<<
31
)
|
WINED3DSTT_CUBE
;
}
else
if
(
D3DSHADER_VERSION_MAJOR
(
This
->
baseShader
.
hex_version
)
==
1
&&
(
D3DSIO_TEXDP3TEX
==
curOpcode
->
opcode
))
{
/* 1D Sampler usage */
DWORD
sampler_code
=
*
pToken
&
D3DSP_REGNUM_MASK
;
reg_maps
->
samplers
[
sampler_code
]
=
(
0x1
<<
31
)
|
WINED3DSTT_1D
;
}
/* This will loop over all the registers and try to
...
...
@@ -364,12 +370,12 @@ static void shader_dump_decl_usage(
TRACE
(
"dcl"
);
if
(
regtype
==
D3DSPR_SAMPLER
)
{
DWORD
ttype
=
decl
&
D3DSP_TEXTURETYPE_MASK
;
DWORD
ttype
=
decl
&
WINE
D3DSP_TEXTURETYPE_MASK
;
switch
(
ttype
)
{
case
D3DSTT_2D
:
TRACE
(
"_2d"
);
break
;
case
D3DSTT_CUBE
:
TRACE
(
"_cube"
);
break
;
case
D3DSTT_VOLUME
:
TRACE
(
"_volume"
);
break
;
case
WINE
D3DSTT_2D
:
TRACE
(
"_2d"
);
break
;
case
WINE
D3DSTT_CUBE
:
TRACE
(
"_cube"
);
break
;
case
WINE
D3DSTT_VOLUME
:
TRACE
(
"_volume"
);
break
;
default:
TRACE
(
"_unknown_ttype(%08lx)"
,
ttype
);
}
...
...
dlls/wined3d/glsl_shader.c
View file @
2e52b36b
...
...
@@ -355,16 +355,19 @@ void shader_generate_glsl_declarations(
for
(
i
=
0
;
i
<
This
->
baseShader
.
limits
.
sampler
;
i
++
)
{
if
(
reg_maps
->
samplers
[
i
])
{
DWORD
stype
=
reg_maps
->
samplers
[
i
]
&
D3DSP_TEXTURETYPE_MASK
;
DWORD
stype
=
reg_maps
->
samplers
[
i
]
&
WINE
D3DSP_TEXTURETYPE_MASK
;
switch
(
stype
)
{
case
D3DSTT_2D
:
case
WINED3DSTT_1D
:
shader_addline
(
buffer
,
"uniform sampler1D %csampler%lu;
\n
"
,
prefix
,
i
);
break
;
case
WINED3DSTT_2D
:
shader_addline
(
buffer
,
"uniform sampler2D %csampler%lu;
\n
"
,
prefix
,
i
);
break
;
case
D3DSTT_CUBE
:
case
WINE
D3DSTT_CUBE
:
shader_addline
(
buffer
,
"uniform samplerCube %csampler%lu;
\n
"
,
prefix
,
i
);
break
;
case
D3DSTT_VOLUME
:
case
WINE
D3DSTT_VOLUME
:
shader_addline
(
buffer
,
"uniform sampler3D %csampler%lu;
\n
"
,
prefix
,
i
);
break
;
default:
...
...
@@ -1341,16 +1344,16 @@ void pshader_glsl_tex(SHADER_OPCODE_ARG* arg) {
sampler_code
=
arg
->
src
[
1
]
&
D3DSP_REGNUM_MASK
;
}
sampler_type
=
arg
->
reg_maps
->
samplers
[
sampler_code
]
&
D3DSP_TEXTURETYPE_MASK
;
sampler_type
=
arg
->
reg_maps
->
samplers
[
sampler_code
]
&
WINE
D3DSP_TEXTURETYPE_MASK
;
switch
(
sampler_type
)
{
case
D3DSTT_2D
:
case
WINE
D3DSTT_2D
:
shader_addline
(
buffer
,
"%s = texture2D(%s, %s.st);
\n
"
,
dst_str
,
sampler_str
,
coord_reg
);
break
;
case
D3DSTT_CUBE
:
case
WINE
D3DSTT_CUBE
:
shader_addline
(
buffer
,
"%s = textureCube(%s, %s.stp);
\n
"
,
dst_str
,
sampler_str
,
coord_reg
);
break
;
case
D3DSTT_VOLUME
:
case
WINE
D3DSTT_VOLUME
:
shader_addline
(
buffer
,
"%s = texture3D(%s, %s.stp);
\n
"
,
dst_str
,
sampler_str
,
coord_reg
);
break
;
default:
...
...
@@ -1505,14 +1508,14 @@ void pshader_glsl_texm3x3tex(SHADER_OPCODE_ARG* arg) {
char
dimensions
[
5
];
DWORD
reg
=
arg
->
dst
&
D3DSP_REGNUM_MASK
;
DWORD
src0_regnum
=
arg
->
src
[
0
]
&
D3DSP_REGNUM_MASK
;
DWORD
stype
=
arg
->
reg_maps
->
samplers
[
src0_regnum
]
&
D3DSP_TEXTURETYPE_MASK
;
DWORD
stype
=
arg
->
reg_maps
->
samplers
[
src0_regnum
]
&
WINE
D3DSP_TEXTURETYPE_MASK
;
IWineD3DPixelShaderImpl
*
This
=
(
IWineD3DPixelShaderImpl
*
)
arg
->
shader
;
SHADER_PARSE_STATE
*
current_state
=
&
This
->
baseShader
.
parse_state
;
switch
(
stype
)
{
case
D3DSTT_2D
:
strcpy
(
dimensions
,
"2D"
);
break
;
case
D3DSTT_CUBE
:
strcpy
(
dimensions
,
"Cube"
);
break
;
case
D3DSTT_VOLUME
:
strcpy
(
dimensions
,
"3D"
);
break
;
case
WINE
D3DSTT_2D
:
strcpy
(
dimensions
,
"2D"
);
break
;
case
WINE
D3DSTT_CUBE
:
strcpy
(
dimensions
,
"Cube"
);
break
;
case
WINE
D3DSTT_VOLUME
:
strcpy
(
dimensions
,
"3D"
);
break
;
default:
strcpy
(
dimensions
,
""
);
FIXME
(
"Unrecognized sampler type: %#lx
\n
"
,
stype
);
...
...
@@ -1522,7 +1525,7 @@ void pshader_glsl_texm3x3tex(SHADER_OPCODE_ARG* arg) {
shader_glsl_add_param
(
arg
,
arg
->
src
[
0
],
arg
->
src_addr
[
0
],
TRUE
,
src0_name
,
src0_mask
,
src0_str
);
shader_addline
(
arg
->
buffer
,
"tmp0.z = dot(vec3(T%lu), vec3(%s));
\n
"
,
reg
,
src0_str
);
shader_addline
(
arg
->
buffer
,
"T%lu = texture%s(Psampler%lu, tmp0.%s);
\n
"
,
reg
,
dimensions
,
reg
,
(
stype
==
D3DSTT_2D
)
?
"xy"
:
"xyz"
);
reg
,
dimensions
,
reg
,
(
stype
==
WINE
D3DSTT_2D
)
?
"xy"
:
"xyz"
);
current_state
->
current_row
=
0
;
}
...
...
@@ -1555,12 +1558,12 @@ void pshader_glsl_texm3x3spec(SHADER_OPCODE_ARG* arg) {
char
src1_str
[
100
],
src1_name
[
50
],
src1_mask
[
6
];
SHADER_BUFFER
*
buffer
=
arg
->
buffer
;
SHADER_PARSE_STATE
*
current_state
=
&
shader
->
baseShader
.
parse_state
;
DWORD
stype
=
arg
->
reg_maps
->
samplers
[
reg
]
&
D3DSP_TEXTURETYPE_MASK
;
DWORD
stype
=
arg
->
reg_maps
->
samplers
[
reg
]
&
WINE
D3DSP_TEXTURETYPE_MASK
;
switch
(
stype
)
{
case
D3DSTT_2D
:
strcpy
(
dimensions
,
"2D"
);
break
;
case
D3DSTT_CUBE
:
strcpy
(
dimensions
,
"Cube"
);
break
;
case
D3DSTT_VOLUME
:
strcpy
(
dimensions
,
"3D"
);
break
;
case
WINE
D3DSTT_2D
:
strcpy
(
dimensions
,
"2D"
);
break
;
case
WINE
D3DSTT_CUBE
:
strcpy
(
dimensions
,
"Cube"
);
break
;
case
WINE
D3DSTT_VOLUME
:
strcpy
(
dimensions
,
"3D"
);
break
;
default:
strcpy
(
dimensions
,
""
);
FIXME
(
"Unrecognized sampler type: %#lx
\n
"
,
stype
);
...
...
@@ -1578,7 +1581,7 @@ void pshader_glsl_texm3x3spec(SHADER_OPCODE_ARG* arg) {
/* Sample the texture */
shader_addline
(
buffer
,
"T%lu = texture%s(Psampler%lu, tmp0.%s);
\n
"
,
reg
,
dimensions
,
reg
,
(
stype
==
D3DSTT_2D
)
?
"xy"
:
"xyz"
);
reg
,
dimensions
,
reg
,
(
stype
==
WINE
D3DSTT_2D
)
?
"xy"
:
"xyz"
);
current_state
->
current_row
=
0
;
}
...
...
@@ -1677,11 +1680,11 @@ void pshader_glsl_texreg2rgb(SHADER_OPCODE_ARG* arg) {
char
dst_mask
[
6
],
src0_mask
[
6
];
char
dimensions
[
5
];
DWORD
src0_regnum
=
arg
->
src
[
0
]
&
D3DSP_REGNUM_MASK
;
DWORD
stype
=
arg
->
reg_maps
->
samplers
[
src0_regnum
]
&
D3DSP_TEXTURETYPE_MASK
;
DWORD
stype
=
arg
->
reg_maps
->
samplers
[
src0_regnum
]
&
WINE
D3DSP_TEXTURETYPE_MASK
;
switch
(
stype
)
{
case
D3DSTT_2D
:
strcpy
(
dimensions
,
"2D"
);
break
;
case
D3DSTT_CUBE
:
strcpy
(
dimensions
,
"Cube"
);
break
;
case
D3DSTT_VOLUME
:
strcpy
(
dimensions
,
"3D"
);
break
;
case
WINE
D3DSTT_2D
:
strcpy
(
dimensions
,
"2D"
);
break
;
case
WINE
D3DSTT_CUBE
:
strcpy
(
dimensions
,
"Cube"
);
break
;
case
WINE
D3DSTT_VOLUME
:
strcpy
(
dimensions
,
"3D"
);
break
;
default:
strcpy
(
dimensions
,
""
);
FIXME
(
"Unrecognized sampler type: %#lx
\n
"
,
stype
);
...
...
@@ -1693,7 +1696,7 @@ void pshader_glsl_texreg2rgb(SHADER_OPCODE_ARG* arg) {
shader_glsl_add_dst
(
arg
->
dst
,
dst_reg
,
dst_mask
,
tmpLine
);
shader_addline
(
arg
->
buffer
,
"%stexture%s(Psampler%lu, %s.%s))%s;
\n
"
,
tmpLine
,
dimensions
,
src0_regnum
,
dst_reg
,
(
stype
==
D3DSTT_2D
)
?
"xy"
:
"xyz"
,
dst_mask
);
tmpLine
,
dimensions
,
src0_regnum
,
dst_reg
,
(
stype
==
WINE
D3DSTT_2D
)
?
"xy"
:
"xyz"
,
dst_mask
);
}
/** Process the D3DSIO_TEXKILL instruction in GLSL.
...
...
include/d3d9types.h
View file @
2e52b36b
...
...
@@ -471,6 +471,7 @@ typedef enum _D3DSHADER_INSTRUCTION_OPCODE_TYPE {
typedef
enum
_D3DSAMPLER_TEXTURE_TYPE
{
D3DSTT_UNKNOWN
=
0
<<
D3DSP_TEXTURETYPE_SHIFT
,
D3DSTT_1D
=
1
<<
D3DSP_TEXTURETYPE_SHIFT
,
D3DSTT_2D
=
2
<<
D3DSP_TEXTURETYPE_SHIFT
,
D3DSTT_CUBE
=
3
<<
D3DSP_TEXTURETYPE_SHIFT
,
D3DSTT_VOLUME
=
4
<<
D3DSP_TEXTURETYPE_SHIFT
,
...
...
include/wine/wined3d_types.h
View file @
2e52b36b
...
...
@@ -994,6 +994,19 @@ typedef enum _WINED3DDECLUSAGE {
WINED3DSHADERDECLUSAGE_MAX_USAGE
}
WINED3DSHADERDECLUSAGE
;
#define WINED3DSP_TEXTURETYPE_SHIFT 27
#define WINED3DSP_TEXTURETYPE_MASK 0x78000000
typedef
enum
_WINED3DSAMPLER_TEXTURE_TYPE
{
WINED3DSTT_UNKNOWN
=
0
<<
WINED3DSP_TEXTURETYPE_SHIFT
,
WINED3DSTT_1D
=
1
<<
WINED3DSP_TEXTURETYPE_SHIFT
,
WINED3DSTT_2D
=
2
<<
WINED3DSP_TEXTURETYPE_SHIFT
,
WINED3DSTT_CUBE
=
3
<<
WINED3DSP_TEXTURETYPE_SHIFT
,
WINED3DSTT_VOLUME
=
4
<<
WINED3DSP_TEXTURETYPE_SHIFT
,
WINED3DSTT_FORCE_DWORD
=
0x7FFFFFFF
}
WINED3DSAMPLER_TEXTURE_TYPE
;
#define WINED3DUSAGE_RENDERTARGET 0x00000001L
#define WINED3DUSAGE_DEPTHSTENCIL 0x00000002L
#define WINED3DUSAGE_WRITEONLY 0x00000008L
...
...
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