summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2009-12-08 19:26:20 +0100
committerRoland Scheidegger <[email protected]>2009-12-08 19:26:20 +0100
commit4ebc54795dc93f7eee200312abfa2da1b49506e3 (patch)
tree3303b9bd235763ddfe55603f3e16d54fc41d83c5 /src/gallium/state_trackers
parentbc7567d9665924650c43c661d07ae9a922554bee (diff)
parentee1720b99dfb5964962f2346406a4e3e88374a68 (diff)
Merge branch 'gallium-strict-aliasing'
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/python/st_device.c3
-rw-r--r--src/gallium/state_trackers/vega/vg_translate.c190
2 files changed, 138 insertions, 55 deletions
diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c
index 2966b24cdcc..10c7ecbd78f 100644
--- a/src/gallium/state_trackers/python/st_device.c
+++ b/src/gallium/state_trackers/python/st_device.c
@@ -62,8 +62,9 @@ st_device_reference(struct st_device **ptr, struct st_device *st_dev)
{
struct st_device *old_dev = *ptr;
- if (pipe_reference((struct pipe_reference **)ptr, &st_dev->reference))
+ if (pipe_reference(&(*ptr)->reference, &st_dev->reference))
st_device_really_destroy(old_dev);
+ *ptr = st_dev;
}
diff --git a/src/gallium/state_trackers/vega/vg_translate.c b/src/gallium/state_trackers/vega/vg_translate.c
index 00e07647062..03575ca3ddd 100644
--- a/src/gallium/state_trackers/vega/vg_translate.c
+++ b/src/gallium/state_trackers/vega/vg_translate.c
@@ -474,6 +474,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
VGfloat rgba[][4])
{
VGint i;
+ union util_color uc;
switch (dataFormat) {
case VG_sRGBX_8888: {
@@ -486,8 +487,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
b = (*src >> 8) & 0xff;
a = 0xff;
- util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT,
- rgba[i]);
+ util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc);
+ rgba[i][0] = uc.f[0];
+ rgba[i][1] = uc.f[1];
+ rgba[i][2] = uc.f[2];
+ rgba[i][3] = uc.f[3];
++src;
}
}
@@ -502,8 +506,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
b = (*src >> 8) & 0xff;
a = (*src >> 0) & 0xff;
- util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT,
- rgba[i]);
+ util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc);
+ rgba[i][0] = uc.f[0];
+ rgba[i][1] = uc.f[1];
+ rgba[i][2] = uc.f[2];
+ rgba[i][3] = uc.f[3];
++src;
}
return;
@@ -519,8 +526,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
b = (*src >> 8) & 0xff;
a = (*src >> 0) & 0xff;
- util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT,
- rgba[i]);
+ util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc);
+ rgba[i][0] = uc.f[0];
+ rgba[i][1] = uc.f[1];
+ rgba[i][2] = uc.f[2];
+ rgba[i][3] = uc.f[3];
++src;
}
return;
@@ -536,8 +546,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
clr[2] = ((*src >> 0) & 31)/31.;
clr[3] = 1.f;
- util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT,
- rgba[i]);
+ util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc);
+ rgba[i][0] = uc.f[0];
+ rgba[i][1] = uc.f[1];
+ rgba[i][2] = uc.f[2];
+ rgba[i][3] = uc.f[3];
++src;
}
}
@@ -552,8 +565,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
clr[2] = ((*src >> 1) & 31)/31.;
clr[3] = ((*src >> 0) & 1)/1.;
- util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT,
- rgba[i]);
+ util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc);
+ rgba[i][0] = uc.f[0];
+ rgba[i][1] = uc.f[1];
+ rgba[i][2] = uc.f[2];
+ rgba[i][3] = uc.f[3];
++src;
}
}
@@ -568,8 +584,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
clr[2] = ((*src >> 4) & 15)/15.;
clr[3] = ((*src >> 0) & 15)/15.;
- util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT,
- rgba[i]);
+ util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc);
+ rgba[i][0] = uc.f[0];
+ rgba[i][1] = uc.f[1];
+ rgba[i][2] = uc.f[2];
+ rgba[i][3] = uc.f[3];
++src;
}
}
@@ -578,8 +597,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
VGubyte *src = (VGubyte *)data;
src += offset;
for (i = 0; i < n; ++i) {
- util_pack_color_ub(0xff, 0xff, 0xff, *src, PIPE_FORMAT_R32G32B32A32_FLOAT,
- rgba[i]);
+ util_pack_color_ub(0xff, 0xff, 0xff, *src, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc);
+ rgba[i][0] = uc.f[0];
+ rgba[i][1] = uc.f[1];
+ rgba[i][2] = uc.f[2];
+ rgba[i][3] = uc.f[3];
++src;
}
}
@@ -594,8 +616,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
b = (*src >> 8) & 0xff;
a = 0xff;
- util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT,
- rgba[i]);
+ util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc);
+ rgba[i][0] = uc.f[0];
+ rgba[i][1] = uc.f[1];
+ rgba[i][2] = uc.f[2];
+ rgba[i][3] = uc.f[3];
++src;
}
}
@@ -610,8 +635,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
b = (*src >> 8) & 0xff;
a = (*src >> 0) & 0xff;
- util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT,
- rgba[i]);
+ util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc);
+ rgba[i][0] = uc.f[0];
+ rgba[i][1] = uc.f[1];
+ rgba[i][2] = uc.f[2];
+ rgba[i][3] = uc.f[3];
++src;
}
return;
@@ -627,8 +655,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
b = (*src >> 8) & 0xff;
a = (*src >> 0) & 0xff;
- util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT,
- rgba[i]);
+ util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc);
+ rgba[i][0] = uc.f[0];
+ rgba[i][1] = uc.f[1];
+ rgba[i][2] = uc.f[2];
+ rgba[i][3] = uc.f[3];
++src;
}
return;
@@ -638,8 +669,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
VGubyte *src = (VGubyte *)data;
src += offset;
for (i = 0; i < n; ++i) {
- util_pack_color_ub(0xff, 0xff, 0xff, *src, PIPE_FORMAT_R32G32B32A32_FLOAT,
- rgba[i]);
+ util_pack_color_ub(0xff, 0xff, 0xff, *src, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc);
+ rgba[i][0] = uc.f[0];
+ rgba[i][1] = uc.f[1];
+ rgba[i][2] = uc.f[2];
+ rgba[i][3] = uc.f[3];
++src;
}
}
@@ -648,8 +682,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
VGubyte *src = (VGubyte *)data;
src += offset;
for (i = 0; i < n; ++i) {
- util_pack_color_ub(0xff, 0xff, 0xff, *src, PIPE_FORMAT_R32G32B32A32_FLOAT,
- rgba[i]);
+ util_pack_color_ub(0xff, 0xff, 0xff, *src, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc);
+ rgba[i][0] = uc.f[0];
+ rgba[i][1] = uc.f[1];
+ rgba[i][2] = uc.f[2];
+ rgba[i][3] = uc.f[3];
++src;
}
}
@@ -667,8 +704,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
clr[2] = clr[0];
clr[3] = 1.f;
- util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT,
- rgba[i+j]);
+ util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc);
+ rgba[i+j][0] = uc.f[0];
+ rgba[i+j][1] = uc.f[1];
+ rgba[i+j][2] = uc.f[2];
+ rgba[i+j][3] = uc.f[3];
}
++src;
}
@@ -688,8 +728,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
clr[2] = 0.f;
clr[3] = (((*src) & (1<<shift)) >> shift);
- util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT,
- rgba[i+j]);
+ util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc);
+ rgba[i+j][0] = uc.f[0];
+ rgba[i+j][1] = uc.f[1];
+ rgba[i+j][2] = uc.f[2];
+ rgba[i+j][3] = uc.f[3];
}
++src;
}
@@ -715,8 +758,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
clr[2] = 0.f;
clr[3] = ((*src) & (bitter)) >> shift;
- util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT,
- rgba[i +j]);
+ util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc);
+ rgba[i+j][0] = uc.f[0];
+ rgba[i+j][1] = uc.f[1];
+ rgba[i+j][2] = uc.f[2];
+ rgba[i+j][3] = uc.f[3];
}
++src;
}
@@ -735,8 +781,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
g = (*src >> 8) & 0xff;
b = (*src >> 0) & 0xff;
- util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT,
- rgba[i]);
+ util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc);
+ rgba[i][0] = uc.f[0];
+ rgba[i][1] = uc.f[1];
+ rgba[i][2] = uc.f[2];
+ rgba[i][3] = uc.f[3];
++src;
}
return;
@@ -752,8 +801,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
g = (*src >> 8) & 0xff;
b = (*src >> 0) & 0xff;
- util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT,
- rgba[i]);
+ util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc);
+ rgba[i][0] = uc.f[0];
+ rgba[i][1] = uc.f[1];
+ rgba[i][2] = uc.f[2];
+ rgba[i][3] = uc.f[3];
++src;
}
return;
@@ -775,8 +827,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
g = (*src >> 8) & 0xff;
b = (*src >> 0) & 0xff;
- util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT,
- rgba[i]);
+ util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc);
+ rgba[i][0] = uc.f[0];
+ rgba[i][1] = uc.f[1];
+ rgba[i][2] = uc.f[2];
+ rgba[i][3] = uc.f[3];
++src;
}
return;
@@ -792,8 +847,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
g = (*src >> 8) & 0xff;
b = (*src >> 0) & 0xff;
- util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT,
- rgba[i]);
+ util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc);
+ rgba[i][0] = uc.f[0];
+ rgba[i][1] = uc.f[1];
+ rgba[i][2] = uc.f[2];
+ rgba[i][3] = uc.f[3];
++src;
}
return;
@@ -811,8 +869,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
r = (*src >> 8) & 0xff;
a = (*src >> 0) & 0xff;
- util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT,
- rgba[i]);
+ util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc);
+ rgba[i][0] = uc.f[0];
+ rgba[i][1] = uc.f[1];
+ rgba[i][2] = uc.f[2];
+ rgba[i][3] = uc.f[3];
++src;
}
return;
@@ -828,8 +889,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
r = (*src >> 8) & 0xff;
a = (*src >> 0) & 0xff;
- util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT,
- rgba[i]);
+ util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc);
+ rgba[i][0] = uc.f[0];
+ rgba[i][1] = uc.f[1];
+ rgba[i][2] = uc.f[2];
+ rgba[i][3] = uc.f[3];
++src;
}
return;
@@ -853,8 +917,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
r = (*src >> 8) & 0xff;
a = (*src >> 0) & 0xff;
- util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT,
- rgba[i]);
+ util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc);
+ rgba[i][0] = uc.f[0];
+ rgba[i][1] = uc.f[1];
+ rgba[i][2] = uc.f[2];
+ rgba[i][3] = uc.f[3];
++src;
}
return;
@@ -870,8 +937,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
r = (*src >> 8) & 0xff;
a = (*src >> 0) & 0xff;
- util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT,
- rgba[i]);
+ util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc);
+ rgba[i][0] = uc.f[0];
+ rgba[i][1] = uc.f[1];
+ rgba[i][2] = uc.f[2];
+ rgba[i][3] = uc.f[3];
++src;
}
return;
@@ -889,8 +959,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
g = (*src >> 8) & 0xff;
r = (*src >> 0) & 0xff;
- util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT,
- rgba[i]);
+ util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc);
+ rgba[i][0] = uc.f[0];
+ rgba[i][1] = uc.f[1];
+ rgba[i][2] = uc.f[2];
+ rgba[i][3] = uc.f[3];
++src;
}
return;
@@ -906,8 +979,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
g = (*src >> 8) & 0xff;
r = (*src >> 0) & 0xff;
- util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT,
- rgba[i]);
+ util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc);
+ rgba[i][0] = uc.f[0];
+ rgba[i][1] = uc.f[1];
+ rgba[i][2] = uc.f[2];
+ rgba[i][3] = uc.f[3];
++src;
}
return;
@@ -929,8 +1005,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
g = (*src >> 8) & 0xff;
r = (*src >> 0) & 0xff;
- util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT,
- rgba[i]);
+ util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc);
+ rgba[i][0] = uc.f[0];
+ rgba[i][1] = uc.f[1];
+ rgba[i][2] = uc.f[2];
+ rgba[i][3] = uc.f[3];
++src;
}
return;
@@ -946,8 +1025,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx,
g = (*src >> 8) & 0xff;
r = (*src >> 0) & 0xff;
- util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT,
- rgba[i]);
+ util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc);
+ rgba[i][0] = uc.f[0];
+ rgba[i][1] = uc.f[1];
+ rgba[i][2] = uc.f[2];
+ rgba[i][3] = uc.f[3];
++src;
}
return;