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
bbf313e7
Commit
bbf313e7
authored
Aug 14, 2008
by
Stefan Dösinger
Committed by
Alexandre Julliard
Aug 21, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9: Test for fixed function value clamping.
parent
bab367e1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
116 additions
and
5 deletions
+116
-5
visual.c
dlls/d3d9/tests/visual.c
+111
-0
arb_program_shader.c
dlls/wined3d/arb_program_shader.c
+2
-2
ati_fragment_shader.c
dlls/wined3d/ati_fragment_shader.c
+0
-0
nvidia_texture_shader.c
dlls/wined3d/nvidia_texture_shader.c
+3
-3
No files found.
dlls/d3d9/tests/visual.c
View file @
bbf313e7
...
@@ -9298,6 +9298,116 @@ static void yuv_color_test(IDirect3DDevice9 *device) {
...
@@ -9298,6 +9298,116 @@ static void yuv_color_test(IDirect3DDevice9 *device) {
IDirect3D9_Release
(
d3d
);
IDirect3D9_Release
(
d3d
);
}
}
static
void
texop_range_test
(
IDirect3DDevice9
*
device
)
{
static
const
struct
{
float
x
,
y
,
z
;
D3DCOLOR
diffuse
;
}
quad
[]
=
{
{
-
1
.
0
f
,
-
1
.
0
f
,
0
.
1
f
,
D3DCOLOR_ARGB
(
0xff
,
0xff
,
0xff
,
0xff
)},
{
-
1
.
0
f
,
1
.
0
f
,
0
.
1
f
,
D3DCOLOR_ARGB
(
0xff
,
0xff
,
0xff
,
0xff
)},
{
1
.
0
f
,
-
1
.
0
f
,
0
.
1
f
,
D3DCOLOR_ARGB
(
0xff
,
0xff
,
0xff
,
0xff
)},
{
1
.
0
f
,
1
.
0
f
,
0
.
1
f
,
D3DCOLOR_ARGB
(
0xff
,
0xff
,
0xff
,
0xff
)}
};
HRESULT
hr
;
IDirect3DTexture9
*
texture
;
D3DLOCKED_RECT
locked_rect
;
D3DCAPS9
caps
;
DWORD
color
;
/* We need ADD and SUBTRACT operations */
hr
=
IDirect3DDevice9_GetDeviceCaps
(
device
,
&
caps
);
ok
(
SUCCEEDED
(
hr
),
"GetDeviceCaps failed with 0x%08x
\n
"
,
hr
);
if
(
!
(
caps
.
TextureOpCaps
&
D3DTEXOPCAPS_ADD
))
{
skip
(
"D3DTOP_ADD is not supported, skipping value range test
\n
"
);
}
if
(
!
(
caps
.
TextureOpCaps
&
D3DTEXOPCAPS_SUBTRACT
))
{
skip
(
"D3DTEXOPCAPS_SUBTRACT is not supported, skipping value range test
\n
"
);
}
hr
=
IDirect3DDevice9_SetFVF
(
device
,
D3DFVF_XYZ
|
D3DFVF_DIFFUSE
);
ok
(
SUCCEEDED
(
hr
),
"SetFVF failed with 0x%08x
\n
"
,
hr
);
/* Stage 1: result = diffuse(=1.0) + diffuse
* stage 2: result = result - tfactor(= 0.5)
*/
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_TEXTUREFACTOR
,
0x80808080
);
ok
(
SUCCEEDED
(
hr
),
"SetRenderState failed with 0x%08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
0
,
D3DTSS_COLORARG1
,
D3DTA_DIFFUSE
);
ok
(
SUCCEEDED
(
hr
),
"SetTextureStageState failed with 0x%08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
0
,
D3DTSS_COLORARG2
,
D3DTA_DIFFUSE
);
ok
(
SUCCEEDED
(
hr
),
"SetTextureStageState failed with 0x%08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
0
,
D3DTSS_COLOROP
,
D3DTOP_ADD
);
ok
(
SUCCEEDED
(
hr
),
"SetTextureStageState failed with 0x%08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
1
,
D3DTSS_COLORARG1
,
D3DTA_CURRENT
);
ok
(
SUCCEEDED
(
hr
),
"SetTextureStageState failed with 0x%08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
1
,
D3DTSS_COLORARG2
,
D3DTA_TFACTOR
);
ok
(
SUCCEEDED
(
hr
),
"SetTextureStageState failed with 0x%08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
1
,
D3DTSS_COLOROP
,
D3DTOP_SUBTRACT
);
ok
(
SUCCEEDED
(
hr
),
"SetTextureStageState failed with 0x%08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_BeginScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"BeginScene failed with 0x%08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
quad
,
sizeof
(
*
quad
));
ok
(
SUCCEEDED
(
hr
),
"DrawPrimitiveUP failed with 0x%08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_EndScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"EndScene failed with 0x%08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Present failed with 0x%08x
\n
"
,
hr
);
color
=
getPixelColor
(
device
,
320
,
240
);
ok
(
color_match
(
color
,
0x00808080
,
1
),
"texop Range > 1.0 returned 0x%08x, expected 0x00808080
\n
"
,
color
);
hr
=
IDirect3DDevice9_CreateTexture
(
device
,
1
,
1
,
1
,
0
,
D3DFMT_A8R8G8B8
,
D3DPOOL_MANAGED
,
&
texture
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"IDirect3DDevice9_CreateTexture failed with 0x%08x
\n
"
,
hr
);
hr
=
IDirect3DTexture9_LockRect
(
texture
,
0
,
&
locked_rect
,
NULL
,
0
);
ok
(
SUCCEEDED
(
hr
),
"LockRect failed with 0x%08x
\n
"
,
hr
);
*
((
DWORD
*
)
locked_rect
.
pBits
)
=
D3DCOLOR_ARGB
(
0x00
,
0x00
,
0x00
,
0x00
);
hr
=
IDirect3DTexture9_UnlockRect
(
texture
,
0
);
ok
(
SUCCEEDED
(
hr
),
"LockRect failed with 0x%08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTexture
(
device
,
0
,
(
IDirect3DBaseTexture9
*
)
texture
);
ok
(
SUCCEEDED
(
hr
),
"SetTexture failed with 0x%08x
\n
"
,
hr
);
/* Stage 1: result = texture(=0.0) - tfactor(= 0.5)
* stage 2: result = result + diffuse(1.0)
*/
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_TEXTUREFACTOR
,
0x80808080
);
ok
(
SUCCEEDED
(
hr
),
"SetRenderState failed with 0x%08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
0
,
D3DTSS_COLORARG1
,
D3DTA_TEXTURE
);
ok
(
SUCCEEDED
(
hr
),
"SetTextureStageState failed with 0x%08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
0
,
D3DTSS_COLORARG2
,
D3DTA_TFACTOR
);
ok
(
SUCCEEDED
(
hr
),
"SetTextureStageState failed with 0x%08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
0
,
D3DTSS_COLOROP
,
D3DTOP_SUBTRACT
);
ok
(
SUCCEEDED
(
hr
),
"SetTextureStageState failed with 0x%08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
1
,
D3DTSS_COLORARG1
,
D3DTA_CURRENT
);
ok
(
SUCCEEDED
(
hr
),
"SetTextureStageState failed with 0x%08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
1
,
D3DTSS_COLORARG2
,
D3DTA_DIFFUSE
);
ok
(
SUCCEEDED
(
hr
),
"SetTextureStageState failed with 0x%08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
1
,
D3DTSS_COLOROP
,
D3DTOP_ADD
);
ok
(
SUCCEEDED
(
hr
),
"SetTextureStageState failed with 0x%08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_BeginScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"BeginScene failed with 0x%08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
quad
,
sizeof
(
*
quad
));
ok
(
SUCCEEDED
(
hr
),
"DrawPrimitiveUP failed with 0x%08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_EndScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"EndScene failed with 0x%08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Present failed with 0x%08x
\n
"
,
hr
);
color
=
getPixelColor
(
device
,
320
,
240
);
ok
(
color_match
(
color
,
0x00ffffff
,
1
),
"texop Range < 0.0 returned 0x%08x, expected 0x00ffffff
\n
"
,
color
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
0
,
D3DTSS_COLOROP
,
D3DTOP_DISABLE
);
ok
(
SUCCEEDED
(
hr
),
"SetTextureStageState failed with 0x%08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
1
,
D3DTSS_COLOROP
,
D3DTOP_DISABLE
);
ok
(
SUCCEEDED
(
hr
),
"SetTextureStageState failed with 0x%08x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetTexture
(
device
,
1
,
(
IDirect3DBaseTexture9
*
)
NULL
);
ok
(
SUCCEEDED
(
hr
),
"SetTexture failed with 0x%08x
\n
"
,
hr
);
IDirect3DTexture9_Release
(
texture
);
}
START_TEST
(
visual
)
START_TEST
(
visual
)
{
{
IDirect3DDevice9
*
device_ptr
;
IDirect3DDevice9
*
device_ptr
;
...
@@ -9455,6 +9565,7 @@ START_TEST(visual)
...
@@ -9455,6 +9565,7 @@ START_TEST(visual)
}
}
else
skip
(
"No ps_1_1 support
\n
"
);
else
skip
(
"No ps_1_1 support
\n
"
);
texop_test
(
device_ptr
);
texop_test
(
device_ptr
);
texop_range_test
(
device_ptr
);
cleanup
:
cleanup
:
if
(
device_ptr
)
{
if
(
device_ptr
)
{
...
...
dlls/wined3d/arb_program_shader.c
View file @
bbf313e7
...
@@ -2561,9 +2561,9 @@ static void gen_ffp_instr(SHADER_BUFFER *buffer, unsigned int stage, BOOL color,
...
@@ -2561,9 +2561,9 @@ static void gen_ffp_instr(SHADER_BUFFER *buffer, unsigned int stage, BOOL color,
}
}
if
(
mul
==
2
)
{
if
(
mul
==
2
)
{
shader_addline
(
buffer
,
"MUL %s%s, %s, const.y;
\n
"
,
mul_final_dest
?
"result.color"
:
dstreg
,
dstmask
,
dstreg
);
shader_addline
(
buffer
,
"MUL
_SAT
%s%s, %s, const.y;
\n
"
,
mul_final_dest
?
"result.color"
:
dstreg
,
dstmask
,
dstreg
);
}
else
if
(
mul
==
4
)
{
}
else
if
(
mul
==
4
)
{
shader_addline
(
buffer
,
"MUL %s%s, %s, const.z;
\n
"
,
mul_final_dest
?
"result.color"
:
dstreg
,
dstmask
,
dstreg
);
shader_addline
(
buffer
,
"MUL
_SAT
%s%s, %s, const.z;
\n
"
,
mul_final_dest
?
"result.color"
:
dstreg
,
dstmask
,
dstreg
);
}
}
}
}
...
...
dlls/wined3d/ati_fragment_shader.c
View file @
bbf313e7
This diff is collapsed.
Click to expand it.
dlls/wined3d/nvidia_texture_shader.c
View file @
bbf313e7
...
@@ -105,8 +105,8 @@ static GLenum d3dta_to_combiner_input(DWORD d3dta, DWORD stage, INT texture_idx)
...
@@ -105,8 +105,8 @@ static GLenum d3dta_to_combiner_input(DWORD d3dta, DWORD stage, INT texture_idx)
}
}
static
GLenum
invert_mapping
(
GLenum
mapping
)
{
static
GLenum
invert_mapping
(
GLenum
mapping
)
{
if
(
mapping
==
GL_UNSIGNED_INVERT_NV
)
return
GL_SIGNED_IDENTITY_NV
;
if
(
mapping
==
GL_UNSIGNED_INVERT_NV
)
return
GL_
UN
SIGNED_IDENTITY_NV
;
else
if
(
mapping
==
GL_SIGNED_IDENTITY_NV
)
return
GL_UNSIGNED_INVERT_NV
;
else
if
(
mapping
==
GL_
UN
SIGNED_IDENTITY_NV
)
return
GL_UNSIGNED_INVERT_NV
;
FIXME
(
"Unhandled mapping %#x
\n
"
,
mapping
);
FIXME
(
"Unhandled mapping %#x
\n
"
,
mapping
);
return
mapping
;
return
mapping
;
...
@@ -116,7 +116,7 @@ static void get_src_and_opr_nvrc(DWORD stage, DWORD arg, BOOL is_alpha, GLenum*
...
@@ -116,7 +116,7 @@ static void get_src_and_opr_nvrc(DWORD stage, DWORD arg, BOOL is_alpha, GLenum*
/* The WINED3DTA_COMPLEMENT flag specifies the complement of the input should
/* The WINED3DTA_COMPLEMENT flag specifies the complement of the input should
* be used. */
* be used. */
if
(
arg
&
WINED3DTA_COMPLEMENT
)
*
mapping
=
GL_UNSIGNED_INVERT_NV
;
if
(
arg
&
WINED3DTA_COMPLEMENT
)
*
mapping
=
GL_UNSIGNED_INVERT_NV
;
else
*
mapping
=
GL_
SIGNED_IDENTITY_NV
;
else
*
mapping
=
GL_
UNSIGNED_IDENTITY_NV
;
/* Clamp all values to positive ranges */
/* The WINED3DTA_ALPHAREPLICATE flag specifies the alpha component of the input
/* The WINED3DTA_ALPHAREPLICATE flag specifies the alpha component of the input
* should be used for all input components. */
* should be used for all input components. */
...
...
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