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
c2d97b23
Commit
c2d97b23
authored
Feb 17, 2008
by
Stefan Dösinger
Committed by
Alexandre Julliard
Feb 18, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Add a test for fixed function bump mapping.
parent
d49c9bbc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
212 additions
and
53 deletions
+212
-53
visual.c
dlls/d3d9/tests/visual.c
+197
-47
state.c
dlls/wined3d/state.c
+15
-6
No files found.
dlls/d3d9/tests/visual.c
View file @
c2d97b23
...
...
@@ -1322,53 +1322,9 @@ static void fog_with_shader_test(IDirect3DDevice9 *device)
IDirect3DVertexDeclaration9_Release
(
vertex_declaration
);
}
/* test the behavior of the texbem instruction
* with normal 2D and projective 2D textures
*/
static
void
texbem_test
(
IDirect3DDevice9
*
device
)
{
HRESULT
hr
;
DWORD
color
;
static
void
generate_bumpmap_textures
(
IDirect3DDevice9
*
device
)
{
unsigned
int
i
,
x
,
y
;
static
const
DWORD
pixel_shader_code
[]
=
{
0xffff0101
,
/* ps_1_1*/
0x00000042
,
0xb00f0000
,
/* tex t0*/
0x00000043
,
0xb00f0001
,
0xb0e40000
,
/* texbem t1, t0*/
0x00000001
,
0x800f0000
,
0xb0e40001
,
/* mov r0, t1*/
0x0000ffff
};
static
const
float
quad
[][
7
]
=
{
{
-
128
.
0
f
/
640
.
0
f
,
-
128
.
0
f
/
480
.
0
f
,
0
.
1
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
},
{
-
128
.
0
f
/
640
.
0
f
,
128
.
0
f
/
480
.
0
f
,
0
.
1
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
1
.
0
f
},
{
128
.
0
f
/
640
.
0
f
,
-
128
.
0
f
/
480
.
0
f
,
0
.
1
f
,
1
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
128
.
0
f
/
640
.
0
f
,
128
.
0
f
/
480
.
0
f
,
0
.
1
f
,
1
.
0
f
,
1
.
0
f
,
1
.
0
f
,
1
.
0
f
},
};
static
const
float
quad_proj
[][
9
]
=
{
{
-
128
.
0
f
/
640
.
0
f
,
-
128
.
0
f
/
480
.
0
f
,
0
.
1
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
128
.
0
f
},
{
-
128
.
0
f
/
640
.
0
f
,
128
.
0
f
/
480
.
0
f
,
0
.
1
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
128
.
0
f
,
0
.
0
f
,
128
.
0
f
},
{
128
.
0
f
/
640
.
0
f
,
-
128
.
0
f
/
480
.
0
f
,
0
.
1
f
,
1
.
0
f
,
0
.
0
f
,
128
.
0
f
,
0
.
0
f
,
0
.
0
f
,
128
.
0
f
},
{
128
.
0
f
/
640
.
0
f
,
128
.
0
f
/
480
.
0
f
,
0
.
1
f
,
1
.
0
f
,
1
.
0
f
,
128
.
0
f
,
128
.
0
f
,
0
.
0
f
,
128
.
0
f
},
};
static
const
D3DVERTEXELEMENT9
decl_elements
[][
4
]
=
{
{
{
0
,
0
,
D3DDECLTYPE_FLOAT3
,
D3DDECLMETHOD_DEFAULT
,
D3DDECLUSAGE_POSITION
,
0
},
{
0
,
12
,
D3DDECLTYPE_FLOAT2
,
D3DDECLMETHOD_DEFAULT
,
D3DDECLUSAGE_TEXCOORD
,
0
},
{
0
,
20
,
D3DDECLTYPE_FLOAT2
,
D3DDECLMETHOD_DEFAULT
,
D3DDECLUSAGE_TEXCOORD
,
1
},
D3DDECL_END
()
},{
{
0
,
0
,
D3DDECLTYPE_FLOAT3
,
D3DDECLMETHOD_DEFAULT
,
D3DDECLUSAGE_POSITION
,
0
},
{
0
,
12
,
D3DDECLTYPE_FLOAT2
,
D3DDECLMETHOD_DEFAULT
,
D3DDECLUSAGE_TEXCOORD
,
0
},
{
0
,
20
,
D3DDECLTYPE_FLOAT4
,
D3DDECLMETHOD_DEFAULT
,
D3DDECLUSAGE_TEXCOORD
,
1
},
D3DDECL_END
()
}
};
/* use assymetric matrix to test loading */
float
bumpenvmat
[
4
]
=
{
0
.
0
,
0
.
5
,
-
0
.
5
,
0
.
0
};
IDirect3DVertexDeclaration9
*
vertex_declaration
=
NULL
;
IDirect3DPixelShader9
*
pixel_shader
=
NULL
;
HRESULT
hr
;
IDirect3DTexture9
*
texture
[
2
]
=
{
NULL
,
NULL
};
D3DLOCKED_RECT
locked_rect
;
...
...
@@ -1435,6 +1391,58 @@ static void texbem_test(IDirect3DDevice9 *device)
hr
=
IDirect3DDevice9_SetSamplerState
(
device
,
i
,
D3DSAMP_ADDRESSV
,
D3DTADDRESS_CLAMP
);
ok
(
SUCCEEDED
(
hr
),
"SetSamplerState D3DSAMP_ADDRESSV failed (0x%08x)
\n
"
,
hr
);
}
}
/* test the behavior of the texbem instruction
* with normal 2D and projective 2D textures
*/
static
void
texbem_test
(
IDirect3DDevice9
*
device
)
{
HRESULT
hr
;
DWORD
color
;
int
i
;
static
const
DWORD
pixel_shader_code
[]
=
{
0xffff0101
,
/* ps_1_1*/
0x00000042
,
0xb00f0000
,
/* tex t0*/
0x00000043
,
0xb00f0001
,
0xb0e40000
,
/* texbem t1, t0*/
0x00000001
,
0x800f0000
,
0xb0e40001
,
/* mov r0, t1*/
0x0000ffff
};
static
const
float
quad
[][
7
]
=
{
{
-
128
.
0
f
/
640
.
0
f
,
-
128
.
0
f
/
480
.
0
f
,
0
.
1
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
},
{
-
128
.
0
f
/
640
.
0
f
,
128
.
0
f
/
480
.
0
f
,
0
.
1
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
1
.
0
f
},
{
128
.
0
f
/
640
.
0
f
,
-
128
.
0
f
/
480
.
0
f
,
0
.
1
f
,
1
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
128
.
0
f
/
640
.
0
f
,
128
.
0
f
/
480
.
0
f
,
0
.
1
f
,
1
.
0
f
,
1
.
0
f
,
1
.
0
f
,
1
.
0
f
},
};
static
const
float
quad_proj
[][
9
]
=
{
{
-
128
.
0
f
/
640
.
0
f
,
-
128
.
0
f
/
480
.
0
f
,
0
.
1
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
128
.
0
f
},
{
-
128
.
0
f
/
640
.
0
f
,
128
.
0
f
/
480
.
0
f
,
0
.
1
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
128
.
0
f
,
0
.
0
f
,
128
.
0
f
},
{
128
.
0
f
/
640
.
0
f
,
-
128
.
0
f
/
480
.
0
f
,
0
.
1
f
,
1
.
0
f
,
0
.
0
f
,
128
.
0
f
,
0
.
0
f
,
0
.
0
f
,
128
.
0
f
},
{
128
.
0
f
/
640
.
0
f
,
128
.
0
f
/
480
.
0
f
,
0
.
1
f
,
1
.
0
f
,
1
.
0
f
,
128
.
0
f
,
128
.
0
f
,
0
.
0
f
,
128
.
0
f
},
};
static
const
D3DVERTEXELEMENT9
decl_elements
[][
4
]
=
{
{
{
0
,
0
,
D3DDECLTYPE_FLOAT3
,
D3DDECLMETHOD_DEFAULT
,
D3DDECLUSAGE_POSITION
,
0
},
{
0
,
12
,
D3DDECLTYPE_FLOAT2
,
D3DDECLMETHOD_DEFAULT
,
D3DDECLUSAGE_TEXCOORD
,
0
},
{
0
,
20
,
D3DDECLTYPE_FLOAT2
,
D3DDECLMETHOD_DEFAULT
,
D3DDECLUSAGE_TEXCOORD
,
1
},
D3DDECL_END
()
},{
{
0
,
0
,
D3DDECLTYPE_FLOAT3
,
D3DDECLMETHOD_DEFAULT
,
D3DDECLUSAGE_POSITION
,
0
},
{
0
,
12
,
D3DDECLTYPE_FLOAT2
,
D3DDECLMETHOD_DEFAULT
,
D3DDECLUSAGE_TEXCOORD
,
0
},
{
0
,
20
,
D3DDECLTYPE_FLOAT4
,
D3DDECLMETHOD_DEFAULT
,
D3DDECLUSAGE_TEXCOORD
,
1
},
D3DDECL_END
()
}
};
/* use assymetric matrix to test loading */
float
bumpenvmat
[
4
]
=
{
0
.
0
,
0
.
5
,
-
0
.
5
,
0
.
0
};
IDirect3DVertexDeclaration9
*
vertex_declaration
=
NULL
;
IDirect3DPixelShader9
*
pixel_shader
=
NULL
;
IDirect3DTexture9
*
texture
=
NULL
;
generate_bumpmap_textures
(
device
);
IDirect3DDevice9_SetTextureStageState
(
device
,
1
,
D3DTSS_BUMPENVMAT00
,
*
(
LPDWORD
)
&
bumpenvmat
[
0
]);
IDirect3DDevice9_SetTextureStageState
(
device
,
1
,
D3DTSS_BUMPENVMAT01
,
*
(
LPDWORD
)
&
bumpenvmat
[
1
]);
...
...
@@ -1508,9 +1516,12 @@ static void texbem_test(IDirect3DDevice9 *device)
for
(
i
=
0
;
i
<
2
;
i
++
)
{
hr
=
IDirect3DDevice9_GetTexture
(
device
,
i
,
(
IDirect3DBaseTexture9
**
)
&
texture
);
ok
(
SUCCEEDED
(
hr
),
"IDirect3DDevice9_GetTexture failed (0x%08x)
\n
"
,
hr
);
IDirect3DTexture9_Release
(
texture
);
/* For the GetTexture */
hr
=
IDirect3DDevice9_SetTexture
(
device
,
i
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"SetTexture failed (0x%08x)
\n
"
,
hr
);
IDirect3D
CubeTexture9_Release
(
texture
[
i
]
);
IDirect3D
Texture9_Release
(
texture
);
}
}
...
...
@@ -6314,6 +6325,144 @@ static void vFace_register_test(IDirect3DDevice9 *device)
IDirect3DTexture9_Release
(
texture
);
}
static
void
fixed_function_bumpmap_test
(
IDirect3DDevice9
*
device
)
{
HRESULT
hr
;
DWORD
color
;
int
i
;
D3DCAPS9
caps
;
static
const
float
quad
[][
7
]
=
{
{
-
128
.
0
f
/
640
.
0
f
,
-
128
.
0
f
/
480
.
0
f
,
0
.
1
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
},
{
-
128
.
0
f
/
640
.
0
f
,
128
.
0
f
/
480
.
0
f
,
0
.
1
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
1
.
0
f
},
{
128
.
0
f
/
640
.
0
f
,
-
128
.
0
f
/
480
.
0
f
,
0
.
1
f
,
1
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
128
.
0
f
/
640
.
0
f
,
128
.
0
f
/
480
.
0
f
,
0
.
1
f
,
1
.
0
f
,
1
.
0
f
,
1
.
0
f
,
1
.
0
f
},
};
static
const
D3DVERTEXELEMENT9
decl_elements
[]
=
{
{
0
,
0
,
D3DDECLTYPE_FLOAT3
,
D3DDECLMETHOD_DEFAULT
,
D3DDECLUSAGE_POSITION
,
0
},
{
0
,
12
,
D3DDECLTYPE_FLOAT2
,
D3DDECLMETHOD_DEFAULT
,
D3DDECLUSAGE_TEXCOORD
,
0
},
{
0
,
20
,
D3DDECLTYPE_FLOAT2
,
D3DDECLMETHOD_DEFAULT
,
D3DDECLUSAGE_TEXCOORD
,
1
},
D3DDECL_END
()
};
/* use assymetric matrix to test loading */
float
bumpenvmat
[
4
]
=
{
0
.
0
,
0
.
5
,
-
0
.
5
,
0
.
0
};
IDirect3DVertexDeclaration9
*
vertex_declaration
=
NULL
;
IDirect3DTexture9
*
texture
=
NULL
;
memset
(
&
caps
,
0
,
sizeof
(
caps
));
hr
=
IDirect3DDevice9_GetDeviceCaps
(
device
,
&
caps
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_GetDeviceCaps failed hr=%s
\n
"
,
DXGetErrorString9
(
hr
));
if
(
!
(
caps
.
TextureOpCaps
&
D3DTEXOPCAPS_BUMPENVMAP
))
{
skip
(
"D3DTEXOPCAPS_BUMPENVMAP not set, skipping bumpmap tests
\n
"
);
return
;
}
else
{
IDirect3D9
*
d3d9
;
IDirect3DDevice9_GetDirect3D
(
device
,
&
d3d9
);
hr
=
IDirect3D9_CheckDeviceFormat
(
d3d9
,
0
,
D3DDEVTYPE_HAL
,
D3DFMT_X8R8G8B8
,
D3DUSAGE_QUERY_LEGACYBUMPMAP
,
D3DRTYPE_TEXTURE
,
D3DFMT_V8U8
);
IDirect3D9_Release
(
d3d9
);
if
(
FAILED
(
hr
))
{
skip
(
"D3DFMT_V8U8 not supported for legacy bump mapping
\n
"
);
return
;
}
}
/* Generate the textures */
generate_bumpmap_textures
(
device
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
0
,
D3DTSS_BUMPENVMAT00
,
*
(
LPDWORD
)
&
bumpenvmat
[
0
]);
ok
(
SUCCEEDED
(
hr
),
"SetTextureStageState failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
0
,
D3DTSS_BUMPENVMAT01
,
*
(
LPDWORD
)
&
bumpenvmat
[
1
]);
ok
(
SUCCEEDED
(
hr
),
"SetTextureStageState failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
0
,
D3DTSS_BUMPENVMAT10
,
*
(
LPDWORD
)
&
bumpenvmat
[
2
]);
ok
(
SUCCEEDED
(
hr
),
"SetTextureStageState failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
0
,
D3DTSS_BUMPENVMAT11
,
*
(
LPDWORD
)
&
bumpenvmat
[
3
]);
ok
(
SUCCEEDED
(
hr
),
"SetTextureStageState failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
0
,
D3DTSS_COLOROP
,
D3DTOP_BUMPENVMAP
);
ok
(
SUCCEEDED
(
hr
),
"SetTextureStageState failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
0
,
D3DTSS_COLORARG1
,
D3DTA_TEXTURE
);
ok
(
SUCCEEDED
(
hr
),
"SetTextureStageState failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
0
,
D3DTSS_COLORARG2
,
D3DTA_CURRENT
);
ok
(
SUCCEEDED
(
hr
),
"SetTextureStageState failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
1
,
D3DTSS_COLOROP
,
D3DTOP_SELECTARG1
);
ok
(
SUCCEEDED
(
hr
),
"SetTextureStageState failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
1
,
D3DTSS_COLORARG1
,
D3DTA_TEXTURE
);
ok
(
SUCCEEDED
(
hr
),
"SetTextureStageState failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
1
,
D3DTSS_COLORARG2
,
D3DTA_CURRENT
);
ok
(
SUCCEEDED
(
hr
),
"SetTextureStageState failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
2
,
D3DTSS_COLOROP
,
D3DTOP_DISABLE
);
ok
(
SUCCEEDED
(
hr
),
"SetTextureStageState failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetVertexShader
(
device
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexShader failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
,
0xffff00ff
,
0
.
0
,
0
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_Clear failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_CreateVertexDeclaration
(
device
,
decl_elements
,
&
vertex_declaration
);
ok
(
SUCCEEDED
(
hr
),
"CreateVertexDeclaration failed (0x%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetVertexDeclaration
(
device
,
vertex_declaration
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexDeclaration failed (0x%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_BeginScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"BeginScene failed (0x%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
&
quad
[
0
],
sizeof
(
quad
[
0
]));
ok
(
SUCCEEDED
(
hr
),
"DrawPrimitiveUP failed (0x%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_EndScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"EndScene failed (0x%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Present failed (0x%08x)
\n
"
,
hr
);
color
=
getPixelColor
(
device
,
320
-
32
,
240
);
ok
(
color
==
0x00ffffff
,
"bumpmap failed: Got color 0x%08x, expected 0x00ffffff.
\n
"
,
color
);
color
=
getPixelColor
(
device
,
320
+
32
,
240
);
ok
(
color
==
0x00ffffff
,
"bumpmap failed: Got color 0x%08x, expected 0x00ffffff.
\n
"
,
color
);
color
=
getPixelColor
(
device
,
320
,
240
-
32
);
ok
(
color
==
0x00ffffff
,
"bumpmap failed: Got color 0x%08x, expected 0x00ffffff.
\n
"
,
color
);
color
=
getPixelColor
(
device
,
320
,
240
+
32
);
ok
(
color
==
0x00ffffff
,
"bumpmap failed: Got color 0x%08x, expected 0x00ffffff.
\n
"
,
color
);
color
=
getPixelColor
(
device
,
320
,
240
);
ok
(
color
==
0x00000000
,
"bumpmap failed: Got color 0x%08x, expected 0x00000000.
\n
"
,
color
);
color
=
getPixelColor
(
device
,
320
+
32
,
240
+
32
);
ok
(
color
==
0x00000000
,
"bumpmap failed: Got color 0x%08x, expected 0x00000000.
\n
"
,
color
);
color
=
getPixelColor
(
device
,
320
-
32
,
240
+
32
);
ok
(
color
==
0x00000000
,
"bumpmap failed: Got color 0x%08x, expected 0x00000000.
\n
"
,
color
);
color
=
getPixelColor
(
device
,
320
+
32
,
240
-
32
);
ok
(
color
==
0x00000000
,
"bumpmap failed: Got color 0x%08x, expected 0x00000000.
\n
"
,
color
);
color
=
getPixelColor
(
device
,
320
-
32
,
240
-
32
);
ok
(
color
==
0x00000000
,
"bumpmap failed: Got color 0x%08x, expected 0x00000000.
\n
"
,
color
);
hr
=
IDirect3DDevice9_SetVertexDeclaration
(
device
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexDeclaration failed (%08x)
\n
"
,
hr
);
IDirect3DVertexDeclaration9_Release
(
vertex_declaration
);
for
(
i
=
0
;
i
<
2
;
i
++
)
{
hr
=
IDirect3DDevice9_GetTexture
(
device
,
i
,
(
IDirect3DBaseTexture9
**
)
&
texture
);
ok
(
SUCCEEDED
(
hr
),
"IDirect3DDevice9_GetTexture failed (0x%08x)
\n
"
,
hr
);
IDirect3DTexture9_Release
(
texture
);
/* For the GetTexture */
hr
=
IDirect3DDevice9_SetTexture
(
device
,
i
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"SetTexture failed (0x%08x)
\n
"
,
hr
);
IDirect3DTexture9_Release
(
texture
);
/* To destroy it */
}
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
1
,
D3DTSS_COLOROP
,
D3DTOP_DISABLE
);
ok
(
SUCCEEDED
(
hr
),
"SetTextureStageState failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
0
,
D3DTSS_COLOROP
,
D3DTOP_MODULATE
);
ok
(
SUCCEEDED
(
hr
),
"SetTextureStageState failed (%08x)
\n
"
,
hr
);
}
START_TEST
(
visual
)
{
IDirect3DDevice9
*
device_ptr
;
...
...
@@ -6396,6 +6545,7 @@ START_TEST(visual)
autogen_mipmap_test
(
device_ptr
);
fixed_function_decl_test
(
device_ptr
);
conditional_np2_repeat_test
(
device_ptr
);
fixed_function_bumpmap_test
(
device_ptr
);
if
(
caps
.
VertexShaderVersion
>=
D3DVS_VERSION
(
1
,
1
))
{
...
...
dlls/wined3d/state.c
View file @
c2d97b23
...
...
@@ -2526,6 +2526,7 @@ static void pixelshader(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D
static
void
tex_bumpenvmat
(
DWORD
state
,
IWineD3DStateBlockImpl
*
stateblock
,
WineD3DContext
*
context
)
{
DWORD
stage
=
(
state
-
STATE_TEXTURESTAGE
(
0
,
0
))
/
WINED3D_HIGHEST_TEXTURE_STATE
;
float
mat
[
2
][
2
];
if
(
stateblock
->
pixelShader
&&
stage
!=
0
&&
((
IWineD3DPixelShaderImpl
*
)
stateblock
->
pixelShader
)
->
needsbumpmat
==
stage
)
{
...
...
@@ -2545,11 +2546,13 @@ static void tex_bumpenvmat(DWORD state, IWineD3DStateBlockImpl *stateblock, Wine
GL_EXTCALL
(
glActiveTextureARB
(
GL_TEXTURE0_ARB
+
stage
));
checkGLcall
(
"GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + stage))"
);
}
GL_EXTCALL
(
glTexBumpParameterfvATI
(
GL_BUMP_ROT_MATRIX_ATI
,
(
float
*
)
&
(
stateblock
->
textureState
[
stage
][
WINED3DTSS_BUMPENVMAT00
])));
mat
[
0
][
0
]
=
*
((
float
*
)
&
stateblock
->
textureState
[
stage
][
WINED3DTSS_BUMPENVMAT00
]);
mat
[
1
][
0
]
=
*
((
float
*
)
&
stateblock
->
textureState
[
stage
][
WINED3DTSS_BUMPENVMAT01
]);
mat
[
0
][
1
]
=
*
((
float
*
)
&
stateblock
->
textureState
[
stage
][
WINED3DTSS_BUMPENVMAT10
]);
mat
[
1
][
1
]
=
*
((
float
*
)
&
stateblock
->
textureState
[
stage
][
WINED3DTSS_BUMPENVMAT11
]);
GL_EXTCALL
(
glTexBumpParameterfvATI
(
GL_BUMP_ROT_MATRIX_ATI
,
(
float
*
)
mat
));
checkGLcall
(
"glTexBumpParameterfvATI"
);
}
if
(
GL_SUPPORT
(
NV_TEXTURE_SHADER2
))
{
}
else
if
(
GL_SUPPORT
(
NV_TEXTURE_SHADER2
))
{
/* Direct3D sets the matrix in the stage reading the perturbation map. The result is used to
* offset the destination stage(always stage + 1 in d3d). In GL_NV_texture_shader, the bump
* map offseting is done in the stage reading the bump mapped texture, and the perturbation
...
...
@@ -2562,8 +2565,14 @@ static void tex_bumpenvmat(DWORD state, IWineD3DStateBlockImpl *stateblock, Wine
GL_EXTCALL
(
glActiveTextureARB
(
GL_TEXTURE0_ARB
+
mapped_stage
));
checkGLcall
(
"GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage))"
);
glTexEnvfv
(
GL_TEXTURE_SHADER_NV
,
GL_OFFSET_TEXTURE_MATRIX_NV
,
(
float
*
)
&
(
stateblock
->
textureState
[
stage
][
WINED3DTSS_BUMPENVMAT00
]));
/* We can't just pass a pointer to the stateblock to GL due to the different matrix
* format(column major vs row major)
*/
mat
[
0
][
0
]
=
*
((
float
*
)
&
stateblock
->
textureState
[
stage
][
WINED3DTSS_BUMPENVMAT00
]);
mat
[
1
][
0
]
=
*
((
float
*
)
&
stateblock
->
textureState
[
stage
][
WINED3DTSS_BUMPENVMAT01
]);
mat
[
0
][
1
]
=
*
((
float
*
)
&
stateblock
->
textureState
[
stage
][
WINED3DTSS_BUMPENVMAT10
]);
mat
[
1
][
1
]
=
*
((
float
*
)
&
stateblock
->
textureState
[
stage
][
WINED3DTSS_BUMPENVMAT11
]);
glTexEnvfv
(
GL_TEXTURE_SHADER_NV
,
GL_OFFSET_TEXTURE_MATRIX_NV
,
(
float
*
)
mat
);
checkGLcall
(
"glTexEnvfv(GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_MATRIX_NV, mat)"
);
}
}
...
...
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