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
7df7ce40
Commit
7df7ce40
authored
Apr 08, 2010
by
Roderick Colenbrander
Committed by
Alexandre Julliard
Apr 09, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Move X8L8V8U8 surface conversion to the format table.
parent
60c6294f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
61 deletions
+54
-61
surface.c
dlls/wined3d/surface.c
+0
-57
utils.c
dlls/wined3d/utils.c
+54
-4
No files found.
dlls/wined3d/surface.c
View file @
7df7ce40
...
...
@@ -2247,20 +2247,6 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_
}
break
;
case
WINED3DFMT_R8G8_SNORM_L8X8_UNORM
:
*
convert
=
CONVERT_X8L8V8U8
;
desc
->
conv_byte_count
=
4
;
if
(
gl_info
->
supported
[
NV_TEXTURE_SHADER
])
{
/* Use formats from gl table. It is a bit unfortunate, but the conversion
* is needed to set the X format to 255 to get 1.0 for alpha when sampling
* the texture. OpenGL can't use GL_DSDT8_MAG8_NV as internal format with
* the needed type and format parameter, so the internal format contains a
* 4th component, which is returned as alpha
*/
}
break
;
case
WINED3DFMT_L4A4_UNORM
:
/* WINED3DFMT_L4A4_UNORM exists as an internal gl format, but for some reason there is not
* format+type combination to load it. Thus convert it to A8L8, then load it
...
...
@@ -2612,49 +2598,6 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
break
;
}
case
CONVERT_X8L8V8U8
:
{
unsigned
int
x
,
y
;
const
DWORD
*
Source
;
unsigned
char
*
Dest
;
if
(
gl_info
->
supported
[
NV_TEXTURE_SHADER
])
{
/* This implementation works with the fixed function pipeline and shaders
* without further modification after converting the surface.
*/
for
(
y
=
0
;
y
<
height
;
y
++
)
{
Source
=
(
const
DWORD
*
)(
src
+
y
*
pitch
);
Dest
=
dst
+
y
*
outpitch
;
for
(
x
=
0
;
x
<
width
;
x
++
)
{
long
color
=
(
*
Source
++
);
/* L */
Dest
[
2
]
=
((
color
>>
16
)
&
0xff
);
/* L */
/* V */
Dest
[
1
]
=
((
color
>>
8
)
&
0xff
);
/* V */
/* U */
Dest
[
0
]
=
(
color
&
0xff
);
/* U */
/* I */
Dest
[
3
]
=
255
;
/* X */
Dest
+=
4
;
}
}
}
else
{
/* Doesn't work correctly with the fixed function pipeline, but can work in
* shaders if the shader is adjusted. (There's no use for this format in gl's
* standard fixed function pipeline anyway).
*/
for
(
y
=
0
;
y
<
height
;
y
++
)
{
Source
=
(
const
DWORD
*
)(
src
+
y
*
pitch
);
Dest
=
dst
+
y
*
outpitch
;
for
(
x
=
0
;
x
<
width
;
x
++
)
{
long
color
=
(
*
Source
++
);
/* B */
Dest
[
0
]
=
((
color
>>
16
)
&
0xff
);
/* L */
/* G */
Dest
[
1
]
=
((
color
>>
8
)
&
0xff
)
+
128
;
/* V */
/* R */
Dest
[
2
]
=
(
color
&
0xff
)
+
128
;
/* U */
Dest
+=
4
;
}
}
}
break
;
}
case
CONVERT_A4L4
:
{
unsigned
int
x
,
y
;
...
...
dlls/wined3d/utils.c
View file @
7df7ce40
...
...
@@ -263,6 +263,56 @@ static void convert_r8g8_snorm(const BYTE *src, BYTE *dst, UINT pitch, UINT widt
}
}
static
void
convert_r8g8_snorm_l8x8_unorm
(
const
BYTE
*
src
,
BYTE
*
dst
,
UINT
pitch
,
UINT
width
,
UINT
height
)
{
unsigned
int
x
,
y
;
const
DWORD
*
Source
;
unsigned
char
*
Dest
;
/* Doesn't work correctly with the fixed function pipeline, but can work in
* shaders if the shader is adjusted. (There's no use for this format in gl's
* standard fixed function pipeline anyway).
*/
for
(
y
=
0
;
y
<
height
;
y
++
)
{
Source
=
(
const
DWORD
*
)(
src
+
y
*
pitch
);
Dest
=
dst
+
y
*
pitch
;
for
(
x
=
0
;
x
<
width
;
x
++
)
{
long
color
=
(
*
Source
++
);
/* B */
Dest
[
0
]
=
((
color
>>
16
)
&
0xff
);
/* L */
/* G */
Dest
[
1
]
=
((
color
>>
8
)
&
0xff
)
+
128
;
/* V */
/* R */
Dest
[
2
]
=
(
color
&
0xff
)
+
128
;
/* U */
Dest
+=
4
;
}
}
}
static
void
convert_r8g8_snorm_l8x8_unorm_nv
(
const
BYTE
*
src
,
BYTE
*
dst
,
UINT
pitch
,
UINT
width
,
UINT
height
)
{
unsigned
int
x
,
y
;
const
DWORD
*
Source
;
unsigned
char
*
Dest
;
/* This implementation works with the fixed function pipeline and shaders
* without further modification after converting the surface.
*/
for
(
y
=
0
;
y
<
height
;
y
++
)
{
Source
=
(
const
DWORD
*
)(
src
+
y
*
pitch
);
Dest
=
dst
+
y
*
pitch
;
for
(
x
=
0
;
x
<
width
;
x
++
)
{
long
color
=
(
*
Source
++
);
/* L */
Dest
[
2
]
=
((
color
>>
16
)
&
0xff
);
/* L */
/* V */
Dest
[
1
]
=
((
color
>>
8
)
&
0xff
);
/* V */
/* U */
Dest
[
0
]
=
(
color
&
0xff
);
/* U */
/* I */
Dest
[
3
]
=
255
;
/* X */
Dest
+=
4
;
}
}
}
static
void
convert_r8g8b8a8_snorm
(
const
BYTE
*
src
,
BYTE
*
dst
,
UINT
pitch
,
UINT
width
,
UINT
height
)
{
unsigned
int
x
,
y
;
...
...
@@ -507,13 +557,13 @@ static const struct wined3d_format_texture_info format_texture_info[] =
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING
|
WINED3DFMT_FLAG_FILTERING
,
NV_TEXTURE_SHADER
,
NULL
},
{
WINED3DFMT_R8G8_SNORM_L8X8_UNORM
,
GL_RGB8
,
GL_RGB8
,
0
,
GL_BGRA
,
GL_UNSIGNED_INT_8_8_8_8_REV
,
0
,
GL_BGRA
,
GL_UNSIGNED_INT_8_8_8_8_REV
,
4
,
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING
|
WINED3DFMT_FLAG_FILTERING
,
WINED3D_GL_EXT_NONE
,
NULL
},
WINED3D_GL_EXT_NONE
,
&
convert_r8g8_snorm_l8x8_unorm
},
{
WINED3DFMT_R8G8_SNORM_L8X8_UNORM
,
GL_DSDT8_MAG8_INTENSITY8_NV
,
GL_DSDT8_MAG8_INTENSITY8_NV
,
0
,
GL_DSDT_MAG_VIB_NV
,
GL_UNSIGNED_INT_8_8_S8_S8_REV_NV
,
0
,
GL_DSDT_MAG_VIB_NV
,
GL_UNSIGNED_INT_8_8_S8_S8_REV_NV
,
4
,
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING
|
WINED3DFMT_FLAG_FILTERING
,
NV_TEXTURE_SHADER
,
NULL
},
NV_TEXTURE_SHADER
,
&
convert_r8g8_snorm_l8x8_unorm_nv
},
{
WINED3DFMT_R8G8B8A8_SNORM
,
GL_RGBA8
,
GL_RGBA8
,
0
,
GL_BGRA
,
GL_UNSIGNED_BYTE
,
4
,
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING
|
WINED3DFMT_FLAG_FILTERING
,
...
...
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