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
8839e7fb
Commit
8839e7fb
authored
Jul 06, 2015
by
Matteo Bruni
Committed by
Alexandre Julliard
Jul 07, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Use a lookup table to select the sampler function name.
parent
7e83d413
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
38 deletions
+29
-38
glsl_shader.c
dlls/wined3d/glsl_shader.c
+29
-38
No files found.
dlls/wined3d/glsl_shader.c
View file @
8839e7fb
...
...
@@ -2516,18 +2516,23 @@ static const char *shader_glsl_get_rel_op(enum wined3d_shader_rel_op op)
static
void
shader_glsl_get_sample_function
(
const
struct
wined3d_shader_context
*
ctx
,
DWORD
resource_idx
,
DWORD
flags
,
struct
glsl_sample_function
*
sample_function
)
{
static
const
unsigned
int
type_coord_size
[]
=
{
0
,
/* WINED3D_SHADER_RESOURCE_NONE */
1
,
/* WINED3D_SHADER_RESOURCE_BUFFER */
1
,
/* WINED3D_SHADER_RESOURCE_TEXTURE_1D */
2
,
/* WINED3D_SHADER_RESOURCE_TEXTURE_2D */
2
,
/* WINED3D_SHADER_RESOURCE_TEXTURE_2DMS */
3
,
/* WINED3D_SHADER_RESOURCE_TEXTURE_3D */
3
,
/* WINED3D_SHADER_RESOURCE_TEXTURE_CUBE */
2
,
/* WINED3D_SHADER_RESOURCE_TEXTURE_1DARRAY */
3
,
/* WINED3D_SHADER_RESOURCE_TEXTURE_2DARRAY */
3
,
/* WINED3D_SHADER_RESOURCE_TEXTURE_2DMSARRAY */
static
const
struct
{
unsigned
int
coord_size
;
const
char
*
type_part
;
}
resource_types
[]
=
{
{
0
,
""
},
/* WINED3D_SHADER_RESOURCE_NONE */
{
1
,
""
},
/* WINED3D_SHADER_RESOURCE_BUFFER */
{
1
,
"1D"
},
/* WINED3D_SHADER_RESOURCE_TEXTURE_1D */
{
2
,
"2D"
},
/* WINED3D_SHADER_RESOURCE_TEXTURE_2D */
{
2
,
""
},
/* WINED3D_SHADER_RESOURCE_TEXTURE_2DMS */
{
3
,
"3D"
},
/* WINED3D_SHADER_RESOURCE_TEXTURE_3D */
{
3
,
"Cube"
},
/* WINED3D_SHADER_RESOURCE_TEXTURE_CUBE */
{
2
,
""
},
/* WINED3D_SHADER_RESOURCE_TEXTURE_1DARRAY */
{
3
,
""
},
/* WINED3D_SHADER_RESOURCE_TEXTURE_2DARRAY */
{
3
,
""
},
/* WINED3D_SHADER_RESOURCE_TEXTURE_2DMSARRAY */
};
struct
shader_glsl_ctx_priv
*
priv
=
ctx
->
backend_data
;
enum
wined3d_shader_resource_type
resource_type
=
ctx
->
reg_maps
->
resource_info
[
resource_idx
].
type
;
...
...
@@ -2543,6 +2548,12 @@ static void shader_glsl_get_sample_function(const struct wined3d_shader_context
sample_function
->
data_type
=
ctx
->
reg_maps
->
resource_info
[
resource_idx
].
data_type
;
if
(
resource_type
>=
ARRAY_SIZE
(
resource_types
))
{
ERR
(
"Unexpected resource type %#x.
\n
"
,
resource_type
);
resource_type
=
WINED3D_SHADER_RESOURCE_TEXTURE_2D
;
}
/* Note that there's no such thing as a projected cube texture. */
if
(
resource_type
==
WINED3D_SHADER_RESOURCE_TEXTURE_CUBE
)
projected
=
FALSE
;
...
...
@@ -2550,26 +2561,11 @@ static void shader_glsl_get_sample_function(const struct wined3d_shader_context
if
(
shadow
)
base
=
"shadow"
;
switch
(
resource_type
)
{
case
WINED3D_SHADER_RESOURCE_TEXTURE_1D
:
type_part
=
"1D"
;
break
;
case
WINED3D_SHADER_RESOURCE_TEXTURE_2D
:
if
(
texrect
)
type_part
=
"2DRect"
;
else
type_part
=
"2D"
;
break
;
case
WINED3D_SHADER_RESOURCE_TEXTURE_3D
:
type_part
=
"3D"
;
break
;
case
WINED3D_SHADER_RESOURCE_TEXTURE_CUBE
:
type_part
=
"Cube"
;
break
;
default:
FIXME
(
"Unhandled resource type %#x.
\n
"
,
resource_type
);
}
type_part
=
resource_types
[
resource_type
].
type_part
;
if
(
resource_type
==
WINED3D_SHADER_RESOURCE_TEXTURE_2D
&&
texrect
)
type_part
=
"2DRect"
;
if
(
!
type_part
[
0
])
FIXME
(
"Unhandled resource type %#x.
\n
"
,
resource_type
);
if
(
!
lod
&&
grad
&&
!
gl_info
->
supported
[
EXT_GPU_SHADER4
])
{
...
...
@@ -2583,12 +2579,7 @@ static void shader_glsl_get_sample_function(const struct wined3d_shader_context
string_buffer_sprintf
(
sample_function
->
name
,
"%s%s%s%s%s"
,
base
,
type_part
,
projected
?
"Proj"
:
""
,
lod
?
"Lod"
:
grad
?
"Grad"
:
""
,
suffix
);
if
(
resource_type
>=
ARRAY_SIZE
(
type_coord_size
))
{
ERR
(
"Unexpected resource type %#x.
\n
"
,
resource_type
);
resource_type
=
WINED3D_SHADER_RESOURCE_TEXTURE_2D
;
}
coord_size
=
type_coord_size
[
resource_type
];
coord_size
=
resource_types
[
resource_type
].
coord_size
;
if
(
shadow
)
++
coord_size
;
sample_function
->
coord_mask
=
(
1
<<
coord_size
)
-
1
;
...
...
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