Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
xserver
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Drew DeVault
xserver
Commits
003dee4c
Commit
003dee4c
authored
Feb 19, 2010
by
Eric Anholt
Committed by
Zhigang Gong
Sep 26, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
glamor: Replace the immediate mode in glamor_fill() with glDrawArrays().
parent
60775e21
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
35 deletions
+28
-35
glamor/glamor_fill.c
glamor/glamor_fill.c
+17
-25
glamor/glamor_priv.h
glamor/glamor_priv.h
+0
-1
glamor/glamor_putimage.c
glamor/glamor_putimage.c
+11
-9
No files found.
glamor/glamor_fill.c
View file @
003dee4c
...
...
@@ -92,29 +92,15 @@ glamor_init_solid_shader(ScreenPtr screen)
glamor_screen_private
*
glamor_priv
=
glamor_get_screen_private
(
screen
);
const
char
*
solid_vs_only
=
"uniform vec4 color;
\n
"
"uniform float x_bias;
\n
"
"uniform float x_scale;
\n
"
"uniform float y_bias;
\n
"
"uniform float y_scale;
\n
"
"void main()
\n
"
"{
\n
"
" gl_Position = vec4((gl_Vertex.x + x_bias) * x_scale,
\n
"
" (gl_Vertex.y + y_bias) * y_scale,
\n
"
" 0,
\n
"
" 1);
\n
"
" gl_Position = gl_Vertex;
\n
"
" gl_Color = color;
\n
"
"}
\n
"
;
const
char
*
solid_vs
=
"uniform float x_bias;
\n
"
"uniform float x_scale;
\n
"
"uniform float y_bias;
\n
"
"uniform float y_scale;
\n
"
"void main()
\n
"
"{
\n
"
" gl_Position = vec4((gl_Vertex.x + x_bias) * x_scale,
\n
"
" (gl_Vertex.y + y_bias) * y_scale,
\n
"
" 0,
\n
"
" 1);
\n
"
" gl_Position = gl_Vertex;
\n
"
"}
\n
"
;
const
char
*
solid_fs
=
"uniform vec4 color;
\n
"
...
...
@@ -138,8 +124,6 @@ glamor_init_solid_shader(ScreenPtr screen)
glamor_priv
->
solid_color_uniform_location
=
glGetUniformLocationARB
(
glamor_priv
->
solid_prog
,
"color"
);
glamor_get_transform_uniform_locations
(
glamor_priv
->
solid_prog
,
&
glamor_priv
->
solid_transform
);
}
void
...
...
@@ -153,6 +137,7 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
int
y1
=
y
;
int
y2
=
y
+
height
;
GLfloat
color
[
4
];
float
vertices
[
4
][
2
];
if
(
!
glamor_set_destination_pixmap
(
pixmap
))
return
;
...
...
@@ -163,15 +148,22 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
glUseProgramObjectARB
(
glamor_priv
->
solid_prog
);
glamor_get_color_4f_from_pixel
(
pixmap
,
fg_pixel
,
color
);
glUniform4fvARB
(
glamor_priv
->
solid_color_uniform_location
,
1
,
color
);
glamor_set_transform_for_pixmap
(
pixmap
,
&
glamor_priv
->
solid_transform
);
glBegin
(
GL_TRIANGLE_FAN
);
glVertex2f
(
x1
,
y1
);
glVertex2f
(
x1
,
y2
);
glVertex2f
(
x2
,
y2
);
glVertex2f
(
x2
,
y1
);
glEnd
();
glVertexPointer
(
2
,
GL_FLOAT
,
sizeof
(
float
)
*
2
,
vertices
);
glEnableClientState
(
GL_VERTEX_ARRAY
);
vertices
[
0
][
0
]
=
v_from_x_coord_x
(
pixmap
,
x1
);
vertices
[
0
][
1
]
=
v_from_x_coord_y
(
pixmap
,
y1
);
vertices
[
1
][
0
]
=
v_from_x_coord_x
(
pixmap
,
x2
);
vertices
[
1
][
1
]
=
v_from_x_coord_y
(
pixmap
,
y1
);
vertices
[
2
][
0
]
=
v_from_x_coord_x
(
pixmap
,
x2
);
vertices
[
2
][
1
]
=
v_from_x_coord_y
(
pixmap
,
y2
);
vertices
[
3
][
0
]
=
v_from_x_coord_x
(
pixmap
,
x1
);
vertices
[
3
][
1
]
=
v_from_x_coord_y
(
pixmap
,
y2
);
glDrawArrays
(
GL_TRIANGLE_FAN
,
0
,
4
);
glDisableClientState
(
GL_VERTEX_ARRAY
);
glUseProgramObjectARB
(
0
);
fail:
glamor_set_alu
(
GXcopy
);
...
...
glamor/glamor_priv.h
View file @
003dee4c
...
...
@@ -150,7 +150,6 @@ typedef struct glamor_screen_private {
/* glamor_solid */
GLint
solid_prog
;
GLint
solid_color_uniform_location
;
glamor_transform_uniforms
solid_transform
;
/* glamor_tile */
GLint
tile_prog
;
...
...
glamor/glamor_putimage.c
View file @
003dee4c
...
...
@@ -124,12 +124,7 @@ glamor_put_image_xybitmap(DrawablePtr drawable, GCPtr gc,
RegionPtr
clip
;
BoxPtr
box
;
int
nbox
;
float
dest_coords
[
8
]
=
{
x
,
y
,
x
+
w
,
y
,
x
+
w
,
y
+
h
,
x
,
y
+
h
,
};
float
dest_coords
[
4
][
2
];
const
float
bitmap_coords
[
8
]
=
{
0
.
0
,
0
.
0
,
1
.
0
,
0
.
0
,
...
...
@@ -137,7 +132,16 @@ glamor_put_image_xybitmap(DrawablePtr drawable, GCPtr gc,
0
.
0
,
1
.
0
,
};
glamor_fallback
(
"glamor_put_image_xybitmap: disabled
\n
"
);
dest_coords
[
0
][
0
]
=
v_from_x_coord_x
(
pixmap
,
x
);
dest_coords
[
0
][
1
]
=
v_from_x_coord_y
(
pixmap
,
y
);
dest_coords
[
1
][
0
]
=
v_from_x_coord_x
(
pixmap
,
x
+
w
);
dest_coords
[
1
][
1
]
=
v_from_x_coord_y
(
pixmap
,
y
);
dest_coords
[
2
][
0
]
=
v_from_x_coord_x
(
pixmap
,
x
+
w
);
dest_coords
[
2
][
1
]
=
v_from_x_coord_y
(
pixmap
,
y
+
h
);
dest_coords
[
3
][
0
]
=
v_from_x_coord_x
(
pixmap
,
x
);
dest_coords
[
3
][
1
]
=
v_from_x_coord_y
(
pixmap
,
y
+
h
);
glamor_fallback
(
"glamor_put_image_xybitmap: disabled
\n
"
);
goto
fail
;
if
(
glamor_priv
->
put_image_xybitmap_prog
==
0
)
{
...
...
@@ -158,8 +162,6 @@ glamor_put_image_xybitmap(DrawablePtr drawable, GCPtr gc,
glUniform4fvARB
(
glamor_priv
->
put_image_xybitmap_bg_uniform_location
,
1
,
bg
);
glamor_set_transform_for_pixmap
(
pixmap
,
&
glamor_priv
->
solid_transform
);
glGenTextures
(
1
,
&
tex
);
glActiveTexture
(
GL_TEXTURE0
);
glEnable
(
GL_TEXTURE_2D
);
...
...
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