Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Mesa
mesa
Commits
e38f677e
Commit
e38f677e
authored
Apr 16, 2008
by
Brian Paul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gallium: finish-up and fix support for GL_COLOR matrix on pixel xfer path
parent
302daeb2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
22 deletions
+54
-22
src/mesa/state_tracker/st_atom_pixeltransfer.c
src/mesa/state_tracker/st_atom_pixeltransfer.c
+53
-22
src/mesa/state_tracker/st_extensions.c
src/mesa/state_tracker/st_extensions.c
+1
-0
No files found.
src/mesa/state_tracker/st_atom_pixeltransfer.c
View file @
e38f677e
...
...
@@ -50,6 +50,7 @@ struct state_key
{
GLuint
scaleAndBias
:
1
;
GLuint
colorMatrix
:
1
;
GLuint
colorMatrixPostScaleBias
:
1
;
#if 0
GLfloat Maps[3][256][4];
...
...
@@ -80,6 +81,9 @@ is_identity(const GLfloat m[16])
static
void
make_state_key
(
GLcontext
*
ctx
,
struct
state_key
*
key
)
{
static
const
GLfloat
zero
[
4
]
=
{
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
};
static
const
GLfloat
one
[
4
]
=
{
1
.
0
f
,
1
.
0
f
,
1
.
0
f
,
1
.
0
f
};
memset
(
key
,
0
,
sizeof
(
*
key
));
if
(
ctx
->
Pixel
.
RedBias
!=
0
.
0
||
ctx
->
Pixel
.
RedScale
!=
1
.
0
||
...
...
@@ -92,8 +96,12 @@ make_state_key(GLcontext *ctx, struct state_key *key)
if
(
!
is_identity
(
ctx
->
ColorMatrixStack
.
Top
->
m
))
{
key
->
colorMatrix
=
1
;
}
}
if
(
!
TEST_EQ_4V
(
ctx
->
Pixel
.
PostColorMatrixScale
,
one
)
||
!
TEST_EQ_4V
(
ctx
->
Pixel
.
PostColorMatrixBias
,
zero
))
{
key
->
colorMatrixPostScaleBias
=
1
;
}
}
...
...
@@ -182,64 +190,87 @@ get_pixel_transfer_program(GLcontext *ctx, const struct state_key *key)
GLint
row3_p
=
_mesa_add_state_reference
(
params
,
row3_state
);
const
GLuint
temp
=
1
;
/* MOV temp, colorTemp; */
_mesa_init_instructions
(
inst
+
ic
,
1
);
inst
[
ic
].
Opcode
=
OPCODE_MOV
;
inst
[
ic
].
DstReg
.
File
=
PROGRAM_TEMPORARY
;
inst
[
ic
].
DstReg
.
Index
=
temp
;
inst
[
ic
].
SrcReg
[
0
].
File
=
PROGRAM_TEMPORARY
;
inst
[
ic
].
SrcReg
[
0
].
Index
=
colorTemp
;
ic
++
;
/* XXX reimplement in terms of MUL/MAD (see t_vp_build.c) */
/* DP4
colorT
emp.x,
t
emp, matrow0; */
/* DP4
t
emp.x,
colorT
emp, matrow0; */
_mesa_init_instructions
(
inst
+
ic
,
1
);
inst
[
ic
].
Opcode
=
OPCODE_DP4
;
inst
[
ic
].
DstReg
.
File
=
PROGRAM_TEMPORARY
;
inst
[
ic
].
DstReg
.
Index
=
colorT
emp
;
inst
[
ic
].
DstReg
.
Index
=
t
emp
;
inst
[
ic
].
DstReg
.
WriteMask
=
WRITEMASK_X
;
inst
[
ic
].
SrcReg
[
0
].
File
=
PROGRAM_TEMPORARY
;
inst
[
ic
].
SrcReg
[
0
].
Index
=
t
emp
;
inst
[
ic
].
SrcReg
[
0
].
Index
=
colorT
emp
;
inst
[
ic
].
SrcReg
[
1
].
File
=
PROGRAM_STATE_VAR
;
inst
[
ic
].
SrcReg
[
1
].
Index
=
row0_p
;
ic
++
;
/* DP4
colorT
emp.y,
t
emp, matrow1; */
/* DP4
t
emp.y,
colorT
emp, matrow1; */
_mesa_init_instructions
(
inst
+
ic
,
1
);
inst
[
ic
].
Opcode
=
OPCODE_DP4
;
inst
[
ic
].
DstReg
.
File
=
PROGRAM_TEMPORARY
;
inst
[
ic
].
DstReg
.
Index
=
colorT
emp
;
inst
[
ic
].
DstReg
.
Index
=
t
emp
;
inst
[
ic
].
DstReg
.
WriteMask
=
WRITEMASK_Y
;
inst
[
ic
].
SrcReg
[
0
].
File
=
PROGRAM_TEMPORARY
;
inst
[
ic
].
SrcReg
[
0
].
Index
=
t
emp
;
inst
[
ic
].
SrcReg
[
0
].
Index
=
colorT
emp
;
inst
[
ic
].
SrcReg
[
1
].
File
=
PROGRAM_STATE_VAR
;
inst
[
ic
].
SrcReg
[
1
].
Index
=
row1_p
;
ic
++
;
/* DP4
colorT
emp.z,
t
emp, matrow2; */
/* DP4
t
emp.z,
colorT
emp, matrow2; */
_mesa_init_instructions
(
inst
+
ic
,
1
);
inst
[
ic
].
Opcode
=
OPCODE_DP4
;
inst
[
ic
].
DstReg
.
File
=
PROGRAM_TEMPORARY
;
inst
[
ic
].
DstReg
.
Index
=
colorT
emp
;
inst
[
ic
].
DstReg
.
Index
=
t
emp
;
inst
[
ic
].
DstReg
.
WriteMask
=
WRITEMASK_Z
;
inst
[
ic
].
SrcReg
[
0
].
File
=
PROGRAM_TEMPORARY
;
inst
[
ic
].
SrcReg
[
0
].
Index
=
t
emp
;
inst
[
ic
].
SrcReg
[
0
].
Index
=
colorT
emp
;
inst
[
ic
].
SrcReg
[
1
].
File
=
PROGRAM_STATE_VAR
;
inst
[
ic
].
SrcReg
[
1
].
Index
=
row2_p
;
ic
++
;
/* DP4
colorT
emp.w,
t
emp, matrow3; */
/* DP4
t
emp.w,
colorT
emp, matrow3; */
_mesa_init_instructions
(
inst
+
ic
,
1
);
inst
[
ic
].
Opcode
=
OPCODE_DP4
;
inst
[
ic
].
DstReg
.
File
=
PROGRAM_TEMPORARY
;
inst
[
ic
].
DstReg
.
Index
=
colorT
emp
;
inst
[
ic
].
DstReg
.
Index
=
t
emp
;
inst
[
ic
].
DstReg
.
WriteMask
=
WRITEMASK_W
;
inst
[
ic
].
SrcReg
[
0
].
File
=
PROGRAM_TEMPORARY
;
inst
[
ic
].
SrcReg
[
0
].
Index
=
t
emp
;
inst
[
ic
].
SrcReg
[
0
].
Index
=
colorT
emp
;
inst
[
ic
].
SrcReg
[
1
].
File
=
PROGRAM_STATE_VAR
;
inst
[
ic
].
SrcReg
[
1
].
Index
=
row3_p
;
ic
++
;
/* MOV colorTemp, temp; */
_mesa_init_instructions
(
inst
+
ic
,
1
);
inst
[
ic
].
Opcode
=
OPCODE_MOV
;
inst
[
ic
].
DstReg
.
File
=
PROGRAM_TEMPORARY
;
inst
[
ic
].
DstReg
.
Index
=
colorTemp
;
inst
[
ic
].
SrcReg
[
0
].
File
=
PROGRAM_TEMPORARY
;
inst
[
ic
].
SrcReg
[
0
].
Index
=
temp
;
ic
++
;
}
if
(
key
->
colorMatrixPostScaleBias
)
{
static
const
gl_state_index
scale_state
[
STATE_LENGTH
]
=
{
STATE_INTERNAL
,
STATE_PT_SCALE
,
0
,
0
,
0
};
static
const
gl_state_index
bias_state
[
STATE_LENGTH
]
=
{
STATE_INTERNAL
,
STATE_PT_BIAS
,
0
,
0
,
0
};
GLint
scale_param
,
bias_param
;
scale_param
=
_mesa_add_state_reference
(
params
,
scale_state
);
bias_param
=
_mesa_add_state_reference
(
params
,
bias_state
);
_mesa_init_instructions
(
inst
+
ic
,
1
);
inst
[
ic
].
Opcode
=
OPCODE_MAD
;
inst
[
ic
].
DstReg
.
File
=
PROGRAM_TEMPORARY
;
inst
[
ic
].
DstReg
.
Index
=
colorTemp
;
inst
[
ic
].
SrcReg
[
0
].
File
=
PROGRAM_TEMPORARY
;
inst
[
ic
].
SrcReg
[
0
].
Index
=
colorTemp
;
inst
[
ic
].
SrcReg
[
1
].
File
=
PROGRAM_STATE_VAR
;
inst
[
ic
].
SrcReg
[
1
].
Index
=
scale_param
;
inst
[
ic
].
SrcReg
[
2
].
File
=
PROGRAM_STATE_VAR
;
inst
[
ic
].
SrcReg
[
2
].
Index
=
bias_param
;
ic
++
;
}
/* Modify last instruction's dst reg to write to result.color */
...
...
src/mesa/state_tracker/st_extensions.c
View file @
e38f677e
...
...
@@ -164,6 +164,7 @@ void st_init_extensions(struct st_context *st)
ctx
->
Extensions
.
NV_blend_square
=
GL_TRUE
;
ctx
->
Extensions
.
NV_texgen_reflection
=
GL_TRUE
;
ctx
->
Extensions
.
SGI_color_matrix
=
GL_TRUE
;
ctx
->
Extensions
.
SGIS_generate_mipmap
=
GL_TRUE
;
/* XXX temp */
/*
...
...
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