Merge branch 'gallium-strict-aliasing'
This commit is contained in:
@@ -237,8 +237,9 @@ pb_reference(struct pb_buffer **dst,
|
||||
{
|
||||
struct pb_buffer *old = *dst;
|
||||
|
||||
if (pipe_reference((struct pipe_reference**)dst, &src->base.reference))
|
||||
if (pipe_reference(&(*dst)->base.reference, &src->base.reference))
|
||||
pb_destroy( old );
|
||||
*dst = src;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -243,6 +243,7 @@ fenced_buffer_list_check_free_locked(struct fenced_buffer_list *fenced_list,
|
||||
struct pb_fence_ops *ops = fenced_list->ops;
|
||||
struct list_head *curr, *next;
|
||||
struct fenced_buffer *fenced_buf;
|
||||
struct pb_buffer *pb_buf;
|
||||
struct pipe_fence_handle *prev_fence = NULL;
|
||||
|
||||
curr = fenced_list->delayed.next;
|
||||
@@ -271,7 +272,9 @@ fenced_buffer_list_check_free_locked(struct fenced_buffer_list *fenced_list,
|
||||
fenced_buffer_remove_locked(fenced_list, fenced_buf);
|
||||
pipe_mutex_unlock(fenced_buf->mutex);
|
||||
|
||||
pb_reference((struct pb_buffer **)&fenced_buf, NULL);
|
||||
pb_buf = &fenced_buf->base;
|
||||
pb_reference(&pb_buf, NULL);
|
||||
|
||||
|
||||
curr = next;
|
||||
next = curr->next;
|
||||
|
@@ -294,7 +294,7 @@ pb_cache_manager_create_buffer(struct pb_manager *_mgr,
|
||||
LIST_DEL(&buf->head);
|
||||
pipe_mutex_unlock(mgr->mutex);
|
||||
/* Increase refcount */
|
||||
pb_reference((struct pb_buffer**)&buf, &buf->base);
|
||||
pipe_reference(NULL, &buf->base.base.reference);
|
||||
return &buf->base;
|
||||
}
|
||||
|
||||
|
@@ -46,13 +46,13 @@ util_clear(struct pipe_context *pipe,
|
||||
{
|
||||
if (buffers & PIPE_CLEAR_COLOR) {
|
||||
struct pipe_surface *ps = framebuffer->cbufs[0];
|
||||
unsigned color;
|
||||
union util_color uc;
|
||||
|
||||
util_pack_color(rgba, ps->format, &color);
|
||||
util_pack_color(rgba, ps->format, &uc);
|
||||
if (pipe->surface_fill) {
|
||||
pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, color);
|
||||
pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, uc.ui);
|
||||
} else {
|
||||
util_surface_fill(pipe, ps, 0, 0, ps->width, ps->height, color);
|
||||
util_surface_fill(pipe, ps, 0, 0, ps->width, ps->height, uc.ui);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -40,101 +40,97 @@
|
||||
#include "util/u_math.h"
|
||||
|
||||
|
||||
|
||||
union util_color {
|
||||
ubyte ub;
|
||||
ushort us;
|
||||
uint ui;
|
||||
float f[4];
|
||||
};
|
||||
|
||||
/**
|
||||
* Pack ubyte R,G,B,A into dest pixel.
|
||||
*/
|
||||
static INLINE void
|
||||
util_pack_color_ub(ubyte r, ubyte g, ubyte b, ubyte a,
|
||||
enum pipe_format format, void *dest)
|
||||
enum pipe_format format, union util_color *uc)
|
||||
{
|
||||
switch (format) {
|
||||
case PIPE_FORMAT_R8G8B8A8_UNORM:
|
||||
{
|
||||
uint *d = (uint *) dest;
|
||||
*d = (r << 24) | (g << 16) | (b << 8) | a;
|
||||
uc->ui = (r << 24) | (g << 16) | (b << 8) | a;
|
||||
}
|
||||
return;
|
||||
case PIPE_FORMAT_R8G8B8X8_UNORM:
|
||||
{
|
||||
uint *d = (uint *) dest;
|
||||
*d = (r << 24) | (g << 16) | (b << 8) | 0xff;
|
||||
uc->ui = (r << 24) | (g << 16) | (b << 8) | 0xff;
|
||||
}
|
||||
return;
|
||||
case PIPE_FORMAT_A8R8G8B8_UNORM:
|
||||
{
|
||||
uint *d = (uint *) dest;
|
||||
*d = (a << 24) | (r << 16) | (g << 8) | b;
|
||||
uc->ui = (a << 24) | (r << 16) | (g << 8) | b;
|
||||
}
|
||||
return;
|
||||
case PIPE_FORMAT_X8R8G8B8_UNORM:
|
||||
{
|
||||
uint *d = (uint *) dest;
|
||||
*d = (0xff << 24) | (r << 16) | (g << 8) | b;
|
||||
uc->ui = (0xff << 24) | (r << 16) | (g << 8) | b;
|
||||
}
|
||||
return;
|
||||
case PIPE_FORMAT_B8G8R8A8_UNORM:
|
||||
{
|
||||
uint *d = (uint *) dest;
|
||||
*d = (b << 24) | (g << 16) | (r << 8) | a;
|
||||
uc->ui = (b << 24) | (g << 16) | (r << 8) | a;
|
||||
}
|
||||
return;
|
||||
case PIPE_FORMAT_B8G8R8X8_UNORM:
|
||||
{
|
||||
uint *d = (uint *) dest;
|
||||
*d = (b << 24) | (g << 16) | (r << 8) | 0xff;
|
||||
uc->ui = (b << 24) | (g << 16) | (r << 8) | 0xff;
|
||||
}
|
||||
return;
|
||||
case PIPE_FORMAT_R5G6B5_UNORM:
|
||||
{
|
||||
ushort *d = (ushort *) dest;
|
||||
*d = ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | (b >> 3);
|
||||
uc->us = ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | (b >> 3);
|
||||
}
|
||||
return;
|
||||
case PIPE_FORMAT_A1R5G5B5_UNORM:
|
||||
{
|
||||
ushort *d = (ushort *) dest;
|
||||
*d = ((a & 0x80) << 8) | ((r & 0xf8) << 7) | ((g & 0xf8) << 2) | (b >> 3);
|
||||
uc->us = ((a & 0x80) << 8) | ((r & 0xf8) << 7) | ((g & 0xf8) << 2) | (b >> 3);
|
||||
}
|
||||
return;
|
||||
case PIPE_FORMAT_A4R4G4B4_UNORM:
|
||||
{
|
||||
ushort *d = (ushort *) dest;
|
||||
*d = ((a & 0xf0) << 8) | ((r & 0xf0) << 4) | ((g & 0xf0) << 0) | (b >> 4);
|
||||
uc->us = ((a & 0xf0) << 8) | ((r & 0xf0) << 4) | ((g & 0xf0) << 0) | (b >> 4);
|
||||
}
|
||||
return;
|
||||
case PIPE_FORMAT_A8_UNORM:
|
||||
{
|
||||
ubyte *d = (ubyte *) dest;
|
||||
*d = a;
|
||||
uc->ub = a;
|
||||
}
|
||||
return;
|
||||
case PIPE_FORMAT_L8_UNORM:
|
||||
case PIPE_FORMAT_I8_UNORM:
|
||||
{
|
||||
ubyte *d = (ubyte *) dest;
|
||||
*d = r;
|
||||
uc->ub = a;
|
||||
}
|
||||
return;
|
||||
case PIPE_FORMAT_R32G32B32A32_FLOAT:
|
||||
{
|
||||
float *d = (float *) dest;
|
||||
d[0] = (float)r / 255.0f;
|
||||
d[1] = (float)g / 255.0f;
|
||||
d[2] = (float)b / 255.0f;
|
||||
d[3] = (float)a / 255.0f;
|
||||
uc->f[0] = (float)r / 255.0f;
|
||||
uc->f[1] = (float)g / 255.0f;
|
||||
uc->f[2] = (float)b / 255.0f;
|
||||
uc->f[3] = (float)a / 255.0f;
|
||||
}
|
||||
return;
|
||||
case PIPE_FORMAT_R32G32B32_FLOAT:
|
||||
{
|
||||
float *d = (float *) dest;
|
||||
d[0] = (float)r / 255.0f;
|
||||
d[1] = (float)g / 255.0f;
|
||||
d[2] = (float)b / 255.0f;
|
||||
uc->f[0] = (float)r / 255.0f;
|
||||
uc->f[1] = (float)g / 255.0f;
|
||||
uc->f[2] = (float)b / 255.0f;
|
||||
}
|
||||
return;
|
||||
|
||||
/* XXX lots more cases to add */
|
||||
default:
|
||||
uc->ui = 0; /* keep compiler happy */
|
||||
debug_print_format("gallium: unhandled format in util_pack_color_ub()", format);
|
||||
assert(0);
|
||||
}
|
||||
@@ -145,13 +141,13 @@ util_pack_color_ub(ubyte r, ubyte g, ubyte b, ubyte a,
|
||||
* Unpack RGBA from a packed pixel, returning values as ubytes in [0,255].
|
||||
*/
|
||||
static INLINE void
|
||||
util_unpack_color_ub(enum pipe_format format, const void *src,
|
||||
util_unpack_color_ub(enum pipe_format format, union util_color *uc,
|
||||
ubyte *r, ubyte *g, ubyte *b, ubyte *a)
|
||||
{
|
||||
switch (format) {
|
||||
case PIPE_FORMAT_R8G8B8A8_UNORM:
|
||||
{
|
||||
uint p = ((const uint *) src)[0];
|
||||
uint p = uc->ui;
|
||||
*r = (ubyte) ((p >> 24) & 0xff);
|
||||
*g = (ubyte) ((p >> 16) & 0xff);
|
||||
*b = (ubyte) ((p >> 8) & 0xff);
|
||||
@@ -160,7 +156,7 @@ util_unpack_color_ub(enum pipe_format format, const void *src,
|
||||
return;
|
||||
case PIPE_FORMAT_R8G8B8X8_UNORM:
|
||||
{
|
||||
uint p = ((const uint *) src)[0];
|
||||
uint p = uc->ui;
|
||||
*r = (ubyte) ((p >> 24) & 0xff);
|
||||
*g = (ubyte) ((p >> 16) & 0xff);
|
||||
*b = (ubyte) ((p >> 8) & 0xff);
|
||||
@@ -169,7 +165,7 @@ util_unpack_color_ub(enum pipe_format format, const void *src,
|
||||
return;
|
||||
case PIPE_FORMAT_A8R8G8B8_UNORM:
|
||||
{
|
||||
uint p = ((const uint *) src)[0];
|
||||
uint p = uc->ui;
|
||||
*r = (ubyte) ((p >> 16) & 0xff);
|
||||
*g = (ubyte) ((p >> 8) & 0xff);
|
||||
*b = (ubyte) ((p >> 0) & 0xff);
|
||||
@@ -178,7 +174,7 @@ util_unpack_color_ub(enum pipe_format format, const void *src,
|
||||
return;
|
||||
case PIPE_FORMAT_X8R8G8B8_UNORM:
|
||||
{
|
||||
uint p = ((const uint *) src)[0];
|
||||
uint p = uc->ui;
|
||||
*r = (ubyte) ((p >> 16) & 0xff);
|
||||
*g = (ubyte) ((p >> 8) & 0xff);
|
||||
*b = (ubyte) ((p >> 0) & 0xff);
|
||||
@@ -187,7 +183,7 @@ util_unpack_color_ub(enum pipe_format format, const void *src,
|
||||
return;
|
||||
case PIPE_FORMAT_B8G8R8A8_UNORM:
|
||||
{
|
||||
uint p = ((const uint *) src)[0];
|
||||
uint p = uc->ui;
|
||||
*r = (ubyte) ((p >> 8) & 0xff);
|
||||
*g = (ubyte) ((p >> 16) & 0xff);
|
||||
*b = (ubyte) ((p >> 24) & 0xff);
|
||||
@@ -196,7 +192,7 @@ util_unpack_color_ub(enum pipe_format format, const void *src,
|
||||
return;
|
||||
case PIPE_FORMAT_B8G8R8X8_UNORM:
|
||||
{
|
||||
uint p = ((const uint *) src)[0];
|
||||
uint p = uc->ui;
|
||||
*r = (ubyte) ((p >> 8) & 0xff);
|
||||
*g = (ubyte) ((p >> 16) & 0xff);
|
||||
*b = (ubyte) ((p >> 24) & 0xff);
|
||||
@@ -205,7 +201,7 @@ util_unpack_color_ub(enum pipe_format format, const void *src,
|
||||
return;
|
||||
case PIPE_FORMAT_R5G6B5_UNORM:
|
||||
{
|
||||
ushort p = ((const ushort *) src)[0];
|
||||
ushort p = uc->us;
|
||||
*r = (ubyte) (((p >> 8) & 0xf8) | ((p >> 13) & 0x7));
|
||||
*g = (ubyte) (((p >> 3) & 0xfc) | ((p >> 9) & 0x3));
|
||||
*b = (ubyte) (((p << 3) & 0xf8) | ((p >> 2) & 0x7));
|
||||
@@ -214,7 +210,7 @@ util_unpack_color_ub(enum pipe_format format, const void *src,
|
||||
return;
|
||||
case PIPE_FORMAT_A1R5G5B5_UNORM:
|
||||
{
|
||||
ushort p = ((const ushort *) src)[0];
|
||||
ushort p = uc->us;
|
||||
*r = (ubyte) (((p >> 7) & 0xf8) | ((p >> 12) & 0x7));
|
||||
*g = (ubyte) (((p >> 2) & 0xf8) | ((p >> 7) & 0x7));
|
||||
*b = (ubyte) (((p << 3) & 0xf8) | ((p >> 2) & 0x7));
|
||||
@@ -223,7 +219,7 @@ util_unpack_color_ub(enum pipe_format format, const void *src,
|
||||
return;
|
||||
case PIPE_FORMAT_A4R4G4B4_UNORM:
|
||||
{
|
||||
ushort p = ((const ushort *) src)[0];
|
||||
ushort p = uc->us;
|
||||
*r = (ubyte) (((p >> 4) & 0xf0) | ((p >> 8) & 0xf));
|
||||
*g = (ubyte) (((p >> 0) & 0xf0) | ((p >> 4) & 0xf));
|
||||
*b = (ubyte) (((p << 4) & 0xf0) | ((p >> 0) & 0xf));
|
||||
@@ -232,27 +228,27 @@ util_unpack_color_ub(enum pipe_format format, const void *src,
|
||||
return;
|
||||
case PIPE_FORMAT_A8_UNORM:
|
||||
{
|
||||
ubyte p = ((const ubyte *) src)[0];
|
||||
ubyte p = uc->ub;
|
||||
*r = *g = *b = (ubyte) 0xff;
|
||||
*a = p;
|
||||
}
|
||||
return;
|
||||
case PIPE_FORMAT_L8_UNORM:
|
||||
{
|
||||
ubyte p = ((const ubyte *) src)[0];
|
||||
ubyte p = uc->ub;
|
||||
*r = *g = *b = p;
|
||||
*a = (ubyte) 0xff;
|
||||
}
|
||||
return;
|
||||
case PIPE_FORMAT_I8_UNORM:
|
||||
{
|
||||
ubyte p = ((const ubyte *) src)[0];
|
||||
ubyte p = uc->ub;
|
||||
*r = *g = *b = *a = p;
|
||||
}
|
||||
return;
|
||||
case PIPE_FORMAT_R32G32B32A32_FLOAT:
|
||||
{
|
||||
const float *p = (const float *) src;
|
||||
const float *p = &uc->f[0];
|
||||
*r = float_to_ubyte(p[0]);
|
||||
*g = float_to_ubyte(p[1]);
|
||||
*b = float_to_ubyte(p[2]);
|
||||
@@ -261,7 +257,7 @@ util_unpack_color_ub(enum pipe_format format, const void *src,
|
||||
return;
|
||||
case PIPE_FORMAT_R32G32B32_FLOAT:
|
||||
{
|
||||
const float *p = (const float *) src;
|
||||
const float *p = &uc->f[0];
|
||||
*r = float_to_ubyte(p[0]);
|
||||
*g = float_to_ubyte(p[1]);
|
||||
*b = float_to_ubyte(p[2]);
|
||||
@@ -271,7 +267,7 @@ util_unpack_color_ub(enum pipe_format format, const void *src,
|
||||
|
||||
case PIPE_FORMAT_R32G32_FLOAT:
|
||||
{
|
||||
const float *p = (const float *) src;
|
||||
const float *p = &uc->f[0];
|
||||
*r = float_to_ubyte(p[0]);
|
||||
*g = float_to_ubyte(p[1]);
|
||||
*b = *a = (ubyte) 0xff;
|
||||
@@ -280,7 +276,7 @@ util_unpack_color_ub(enum pipe_format format, const void *src,
|
||||
|
||||
case PIPE_FORMAT_R32_FLOAT:
|
||||
{
|
||||
const float *p = (const float *) src;
|
||||
const float *p = &uc->f[0];
|
||||
*r = float_to_ubyte(p[0]);
|
||||
*g = *b = *a = (ubyte) 0xff;
|
||||
}
|
||||
@@ -295,12 +291,11 @@ util_unpack_color_ub(enum pipe_format format, const void *src,
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Note rgba outside [0,1] will be clamped for int pixel formats.
|
||||
*/
|
||||
static INLINE void
|
||||
util_pack_color(const float rgba[4], enum pipe_format format, void *dest)
|
||||
util_pack_color(const float rgba[4], enum pipe_format format, union util_color *uc)
|
||||
{
|
||||
ubyte r = 0;
|
||||
ubyte g = 0;
|
||||
@@ -318,90 +313,78 @@ util_pack_color(const float rgba[4], enum pipe_format format, void *dest)
|
||||
switch (format) {
|
||||
case PIPE_FORMAT_R8G8B8A8_UNORM:
|
||||
{
|
||||
uint *d = (uint *) dest;
|
||||
*d = (r << 24) | (g << 16) | (b << 8) | a;
|
||||
uc->ui = (r << 24) | (g << 16) | (b << 8) | a;
|
||||
}
|
||||
return;
|
||||
case PIPE_FORMAT_R8G8B8X8_UNORM:
|
||||
{
|
||||
uint *d = (uint *) dest;
|
||||
*d = (r << 24) | (g << 16) | (b << 8) | 0xff;
|
||||
uc->ui = (r << 24) | (g << 16) | (b << 8) | 0xff;
|
||||
}
|
||||
return;
|
||||
case PIPE_FORMAT_A8R8G8B8_UNORM:
|
||||
{
|
||||
uint *d = (uint *) dest;
|
||||
*d = (a << 24) | (r << 16) | (g << 8) | b;
|
||||
uc->ui = (a << 24) | (r << 16) | (g << 8) | b;
|
||||
}
|
||||
return;
|
||||
case PIPE_FORMAT_X8R8G8B8_UNORM:
|
||||
{
|
||||
uint *d = (uint *) dest;
|
||||
*d = (0xff << 24) | (r << 16) | (g << 8) | b;
|
||||
uc->ui = (0xff << 24) | (r << 16) | (g << 8) | b;
|
||||
}
|
||||
return;
|
||||
case PIPE_FORMAT_B8G8R8A8_UNORM:
|
||||
{
|
||||
uint *d = (uint *) dest;
|
||||
*d = (b << 24) | (g << 16) | (r << 8) | a;
|
||||
uc->ui = (b << 24) | (g << 16) | (r << 8) | a;
|
||||
}
|
||||
return;
|
||||
case PIPE_FORMAT_B8G8R8X8_UNORM:
|
||||
{
|
||||
uint *d = (uint *) dest;
|
||||
*d = (b << 24) | (g << 16) | (r << 8) | 0xff;
|
||||
uc->ui = (b << 24) | (g << 16) | (r << 8) | 0xff;
|
||||
}
|
||||
return;
|
||||
case PIPE_FORMAT_R5G6B5_UNORM:
|
||||
{
|
||||
ushort *d = (ushort *) dest;
|
||||
*d = ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | (b >> 3);
|
||||
uc->us = ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | (b >> 3);
|
||||
}
|
||||
return;
|
||||
case PIPE_FORMAT_A1R5G5B5_UNORM:
|
||||
{
|
||||
ushort *d = (ushort *) dest;
|
||||
*d = ((a & 0x80) << 8) | ((r & 0xf8) << 7) | ((g & 0xf8) << 2) | (b >> 3);
|
||||
uc->us = ((a & 0x80) << 8) | ((r & 0xf8) << 7) | ((g & 0xf8) << 2) | (b >> 3);
|
||||
}
|
||||
return;
|
||||
case PIPE_FORMAT_A4R4G4B4_UNORM:
|
||||
{
|
||||
ushort *d = (ushort *) dest;
|
||||
*d = ((a & 0xf0) << 8) | ((r & 0xf0) << 4) | ((g & 0xf0) << 0) | (b >> 4);
|
||||
uc->ub = ((a & 0xf0) << 8) | ((r & 0xf0) << 4) | ((g & 0xf0) << 0) | (b >> 4);
|
||||
}
|
||||
return;
|
||||
case PIPE_FORMAT_A8_UNORM:
|
||||
{
|
||||
ubyte *d = (ubyte *) dest;
|
||||
*d = a;
|
||||
uc->ub = a;
|
||||
}
|
||||
return;
|
||||
case PIPE_FORMAT_L8_UNORM:
|
||||
case PIPE_FORMAT_I8_UNORM:
|
||||
{
|
||||
ubyte *d = (ubyte *) dest;
|
||||
*d = r;
|
||||
uc->ub = r;
|
||||
}
|
||||
return;
|
||||
case PIPE_FORMAT_R32G32B32A32_FLOAT:
|
||||
{
|
||||
float *d = (float *) dest;
|
||||
d[0] = rgba[0];
|
||||
d[1] = rgba[1];
|
||||
d[2] = rgba[2];
|
||||
d[3] = rgba[3];
|
||||
uc->f[0] = rgba[0];
|
||||
uc->f[1] = rgba[1];
|
||||
uc->f[2] = rgba[2];
|
||||
uc->f[3] = rgba[3];
|
||||
}
|
||||
return;
|
||||
case PIPE_FORMAT_R32G32B32_FLOAT:
|
||||
{
|
||||
float *d = (float *) dest;
|
||||
d[0] = rgba[0];
|
||||
d[1] = rgba[1];
|
||||
d[2] = rgba[2];
|
||||
uc->f[0] = rgba[0];
|
||||
uc->f[1] = rgba[1];
|
||||
uc->f[2] = rgba[2];
|
||||
}
|
||||
return;
|
||||
/* XXX lots more cases to add */
|
||||
default:
|
||||
uc->ui = 0; /* keep compiler happy */
|
||||
debug_print_format("gallium: unhandled format in util_pack_color()", format);
|
||||
assert(0);
|
||||
}
|
||||
|
@@ -59,9 +59,9 @@ cell_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
|
||||
|
||||
if (buffers & PIPE_CLEAR_COLOR) {
|
||||
uint surfIndex = 0;
|
||||
uint clearValue;
|
||||
union util_color uc;
|
||||
|
||||
util_pack_color(rgba, cell->framebuffer.cbufs[0]->format, &clearValue);
|
||||
util_pack_color(rgba, cell->framebuffer.cbufs[0]->format, &uc);
|
||||
|
||||
/* Build a CLEAR command and place it in the current batch buffer */
|
||||
STATIC_ASSERT(sizeof(struct cell_command_clear_surface) % 16 == 0);
|
||||
@@ -70,7 +70,7 @@ cell_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
|
||||
cell_batch_alloc16(cell, sizeof(*clr));
|
||||
clr->opcode[0] = CELL_CMD_CLEAR_SURFACE;
|
||||
clr->surface = surfIndex;
|
||||
clr->value = clearValue;
|
||||
clr->value = uc.ui;
|
||||
}
|
||||
|
||||
if (buffers & PIPE_CLEAR_DEPTHSTENCIL) {
|
||||
|
@@ -742,7 +742,7 @@ identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
|
||||
id_pipe->base.set_polygon_stipple = identity_set_polygon_stipple;
|
||||
id_pipe->base.set_scissor_state = identity_set_scissor_state;
|
||||
id_pipe->base.set_viewport_state = identity_set_viewport_state;
|
||||
id_pipe->base.set_fragment_sampler_textures = identity_set_vertex_sampler_textures;
|
||||
id_pipe->base.set_fragment_sampler_textures = identity_set_fragment_sampler_textures;
|
||||
id_pipe->base.set_vertex_sampler_textures = identity_set_vertex_sampler_textures;
|
||||
id_pipe->base.set_vertex_buffers = identity_set_vertex_buffers;
|
||||
id_pipe->base.set_vertex_elements = identity_set_vertex_elements;
|
||||
|
@@ -50,6 +50,7 @@ llvmpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
|
||||
double depth, unsigned stencil)
|
||||
{
|
||||
struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe);
|
||||
union util_color uc;
|
||||
unsigned cv;
|
||||
uint i;
|
||||
|
||||
@@ -64,8 +65,8 @@ llvmpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
|
||||
for (i = 0; i < llvmpipe->framebuffer.nr_cbufs; i++) {
|
||||
struct pipe_surface *ps = llvmpipe->framebuffer.cbufs[i];
|
||||
|
||||
util_pack_color(rgba, ps->format, &cv);
|
||||
lp_tile_cache_clear(llvmpipe->cbuf_cache[i], rgba, cv);
|
||||
util_pack_color(rgba, ps->format, &uc);
|
||||
lp_tile_cache_clear(llvmpipe->cbuf_cache[i], rgba, uc.ui);
|
||||
}
|
||||
llvmpipe->dirty_render_cache = TRUE;
|
||||
}
|
||||
|
@@ -48,13 +48,14 @@ so_ref(struct nouveau_stateobj *ref, struct nouveau_stateobj **pso)
|
||||
struct nouveau_stateobj *so = *pso;
|
||||
int i;
|
||||
|
||||
if (pipe_reference((struct pipe_reference**)pso, &ref->reference)) {
|
||||
if (pipe_reference(&(*pso)->reference, &ref->reference)) {
|
||||
free(so->push);
|
||||
for (i = 0; i < so->cur_reloc; i++)
|
||||
nouveau_bo_ref(NULL, &so->reloc[i].bo);
|
||||
free(so->reloc);
|
||||
free(so);
|
||||
}
|
||||
*pso = ref;
|
||||
}
|
||||
|
||||
static INLINE void
|
||||
|
@@ -151,9 +151,10 @@ static void r300_set_blend_color(struct pipe_context* pipe,
|
||||
const struct pipe_blend_color* color)
|
||||
{
|
||||
struct r300_context* r300 = r300_context(pipe);
|
||||
union util_color uc;
|
||||
|
||||
util_pack_color(color->color, PIPE_FORMAT_A8R8G8B8_UNORM,
|
||||
&r300->blend_color_state->blend_color);
|
||||
util_pack_color(color->color, PIPE_FORMAT_A8R8G8B8_UNORM, &uc);
|
||||
r300->blend_color_state->blend_color = uc.ui;
|
||||
|
||||
/* XXX if FP16 blending is enabled, we should use the FP16 format */
|
||||
r300->blend_color_state->blend_color_red_alpha =
|
||||
@@ -549,6 +550,7 @@ static void*
|
||||
struct r300_context* r300 = r300_context(pipe);
|
||||
struct r300_sampler_state* sampler = CALLOC_STRUCT(r300_sampler_state);
|
||||
int lod_bias;
|
||||
union util_color uc;
|
||||
|
||||
sampler->filter0 |=
|
||||
(r300_translate_wrap(state->wrap_s) << R300_TX_WRAP_S_SHIFT) |
|
||||
@@ -570,8 +572,8 @@ static void*
|
||||
|
||||
sampler->filter1 |= r300_anisotropy(state->max_anisotropy);
|
||||
|
||||
util_pack_color(state->border_color, PIPE_FORMAT_A8R8G8B8_UNORM,
|
||||
&sampler->border_color);
|
||||
util_pack_color(state->border_color, PIPE_FORMAT_A8R8G8B8_UNORM, &uc);
|
||||
sampler->border_color = uc.ui;
|
||||
|
||||
/* R500-specific fixups and optimizations */
|
||||
if (r300_screen(r300->context.screen)->caps->is_r500) {
|
||||
|
@@ -48,6 +48,7 @@ softpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
|
||||
double depth, unsigned stencil)
|
||||
{
|
||||
struct softpipe_context *softpipe = softpipe_context(pipe);
|
||||
union util_color uc;
|
||||
unsigned cv;
|
||||
uint i;
|
||||
|
||||
@@ -62,12 +63,12 @@ softpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
|
||||
for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) {
|
||||
struct pipe_surface *ps = softpipe->framebuffer.cbufs[i];
|
||||
|
||||
util_pack_color(rgba, ps->format, &cv);
|
||||
sp_tile_cache_clear(softpipe->cbuf_cache[i], rgba, cv);
|
||||
util_pack_color(rgba, ps->format, &uc);
|
||||
sp_tile_cache_clear(softpipe->cbuf_cache[i], rgba, uc.ui);
|
||||
|
||||
#if !TILE_CLEAR_OPTIMIZATION
|
||||
/* non-cached surface */
|
||||
pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, cv);
|
||||
pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, uc.ui);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@@ -46,7 +46,7 @@ try_clear(struct svga_context *svga,
|
||||
boolean restore_viewport = FALSE;
|
||||
SVGA3dClearFlag flags = 0;
|
||||
struct pipe_framebuffer_state *fb = &svga->curr.framebuffer;
|
||||
unsigned color = 0;
|
||||
union util_color uc;
|
||||
|
||||
ret = svga_update_state(svga, SVGA_STATE_HW_CLEAR);
|
||||
if (ret)
|
||||
@@ -54,7 +54,7 @@ try_clear(struct svga_context *svga,
|
||||
|
||||
if ((buffers & PIPE_CLEAR_COLOR) && fb->cbufs[0]) {
|
||||
flags |= SVGA3D_CLEAR_COLOR;
|
||||
util_pack_color(rgba, PIPE_FORMAT_A8R8G8B8_UNORM, &color);
|
||||
util_pack_color(rgba, PIPE_FORMAT_A8R8G8B8_UNORM, &uc);
|
||||
|
||||
rect.w = fb->cbufs[0]->width;
|
||||
rect.h = fb->cbufs[0]->height;
|
||||
@@ -77,7 +77,7 @@ try_clear(struct svga_context *svga,
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = SVGA3D_ClearRect(svga->swc, flags, color, depth, stencil,
|
||||
ret = SVGA3D_ClearRect(svga->swc, flags, uc.ui, depth, stencil,
|
||||
rect.x, rect.y, rect.w, rect.h);
|
||||
if (ret != PIPE_OK)
|
||||
return ret;
|
||||
|
@@ -101,6 +101,7 @@ svga_create_sampler_state(struct pipe_context *pipe,
|
||||
{
|
||||
struct svga_context *svga = svga_context(pipe);
|
||||
struct svga_sampler_state *cso = CALLOC_STRUCT( svga_sampler_state );
|
||||
union util_color uc;
|
||||
|
||||
cso->mipfilter = translate_mip_filter(sampler->min_mip_filter);
|
||||
cso->magfilter = translate_img_filter( sampler->mag_img_filter );
|
||||
@@ -121,8 +122,8 @@ svga_create_sampler_state(struct pipe_context *pipe,
|
||||
ubyte a = float_to_ubyte(sampler->border_color[3]);
|
||||
|
||||
util_pack_color_ub( r, g, b, a,
|
||||
PIPE_FORMAT_B8G8R8A8_UNORM,
|
||||
&cso->bordercolor );
|
||||
PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
|
||||
cso->bordercolor = uc.ui;
|
||||
}
|
||||
|
||||
/* No SVGA3D support for:
|
||||
|
@@ -356,7 +356,8 @@ svga_buffer_upload_flush(struct svga_context *svga,
|
||||
sbuf->hw.boxes = NULL;
|
||||
|
||||
/* Decrement reference count */
|
||||
pipe_buffer_reference((struct pipe_buffer **)&sbuf, NULL);
|
||||
pipe_reference(&(sbuf->base.reference), NULL);
|
||||
sbuf = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -164,8 +164,9 @@ svga_sampler_view_reference(struct svga_sampler_view **ptr, struct svga_sampler_
|
||||
{
|
||||
struct svga_sampler_view *old = *ptr;
|
||||
|
||||
if (pipe_reference((struct pipe_reference **)ptr, &v->reference))
|
||||
if (pipe_reference(&(*ptr)->reference, &v->reference))
|
||||
svga_destroy_sampler_view_priv(old);
|
||||
*ptr = v;
|
||||
}
|
||||
|
||||
extern void
|
||||
|
@@ -59,30 +59,28 @@ pipe_is_referenced(struct pipe_reference *reference)
|
||||
|
||||
|
||||
/**
|
||||
* Set 'ptr' to point to 'reference' and update reference counting.
|
||||
* The old thing pointed to, if any, will be unreferenced first.
|
||||
* 'reference' may be NULL.
|
||||
* Update reference counting.
|
||||
* The old thing pointed to, if any, will be unreferenced.
|
||||
* Both 'ptr' and 'reference' may be NULL.
|
||||
*/
|
||||
static INLINE bool
|
||||
pipe_reference(struct pipe_reference **ptr, struct pipe_reference *reference)
|
||||
pipe_reference(struct pipe_reference *ptr, struct pipe_reference *reference)
|
||||
{
|
||||
bool destroy = FALSE;
|
||||
|
||||
if(*ptr != reference) {
|
||||
if(ptr != reference) {
|
||||
/* bump the reference.count first */
|
||||
if (reference) {
|
||||
assert(pipe_is_referenced(reference));
|
||||
p_atomic_inc(&reference->count);
|
||||
}
|
||||
|
||||
if (*ptr) {
|
||||
assert(pipe_is_referenced(*ptr));
|
||||
if (p_atomic_dec_zero(&(*ptr)->count)) {
|
||||
if (ptr) {
|
||||
assert(pipe_is_referenced(ptr));
|
||||
if (p_atomic_dec_zero(&ptr->count)) {
|
||||
destroy = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
*ptr = reference;
|
||||
}
|
||||
|
||||
return destroy;
|
||||
|
@@ -392,8 +392,9 @@ pipe_buffer_reference(struct pipe_buffer **ptr, struct pipe_buffer *buf)
|
||||
{
|
||||
struct pipe_buffer *old_buf = *ptr;
|
||||
|
||||
if (pipe_reference((struct pipe_reference **)ptr, &buf->reference))
|
||||
if (pipe_reference(&(*ptr)->reference, &buf->reference))
|
||||
old_buf->screen->buffer_destroy(old_buf);
|
||||
*ptr = buf;
|
||||
}
|
||||
|
||||
static INLINE void
|
||||
@@ -401,8 +402,9 @@ pipe_surface_reference(struct pipe_surface **ptr, struct pipe_surface *surf)
|
||||
{
|
||||
struct pipe_surface *old_surf = *ptr;
|
||||
|
||||
if (pipe_reference((struct pipe_reference **)ptr, &surf->reference))
|
||||
if (pipe_reference(&(*ptr)->reference, &surf->reference))
|
||||
old_surf->texture->screen->tex_surface_destroy(old_surf);
|
||||
*ptr = surf;
|
||||
}
|
||||
|
||||
static INLINE void
|
||||
@@ -410,8 +412,9 @@ pipe_texture_reference(struct pipe_texture **ptr, struct pipe_texture *tex)
|
||||
{
|
||||
struct pipe_texture *old_tex = *ptr;
|
||||
|
||||
if (pipe_reference((struct pipe_reference **)ptr, &tex->reference))
|
||||
if (pipe_reference(&(*ptr)->reference, &tex->reference))
|
||||
old_tex->screen->texture_destroy(old_tex);
|
||||
*ptr = tex;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -56,8 +56,9 @@ pipe_video_surface_reference(struct pipe_video_surface **ptr, struct pipe_video_
|
||||
{
|
||||
struct pipe_video_surface *old_surf = *ptr;
|
||||
|
||||
if (pipe_reference((struct pipe_reference **)ptr, &surf->reference))
|
||||
if (pipe_reference(&(*ptr)->reference, &surf->reference))
|
||||
old_surf->screen->video_surface_destroy(old_surf);
|
||||
*ptr = surf;
|
||||
}
|
||||
|
||||
struct pipe_video_rect
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -39,11 +39,12 @@ intel_drm_fence_reference(struct intel_winsys *iws,
|
||||
struct intel_drm_fence *old = (struct intel_drm_fence *)*ptr;
|
||||
struct intel_drm_fence *f = (struct intel_drm_fence *)fence;
|
||||
|
||||
if (pipe_reference((struct pipe_reference**)ptr, &f->reference)) {
|
||||
if (pipe_reference(&(*ptr)->reference, &f->reference)) {
|
||||
if (old->bo)
|
||||
drm_intel_bo_unreference(old->bo);
|
||||
FREE(old);
|
||||
}
|
||||
*ptr = fence;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@@ -47,7 +47,7 @@ vmw_svga_winsys_surface_reference(struct vmw_svga_winsys_surface **pdst,
|
||||
src_ref = src ? &src->refcnt : NULL;
|
||||
dst_ref = dst ? &dst->refcnt : NULL;
|
||||
|
||||
if (pipe_reference(&dst_ref, src_ref)) {
|
||||
if (pipe_reference(dst_ref, src_ref)) {
|
||||
vmw_ioctl_surface_destroy(dst->screen, dst->sid);
|
||||
#ifdef DEBUG
|
||||
/* to detect dangling pointers */
|
||||
|
@@ -460,7 +460,7 @@ _mesa_inv_sqrtf(float n)
|
||||
#if 0 /* not used, see below -BP */
|
||||
float r3, x3, y3;
|
||||
#endif
|
||||
union { float f; unsigned int i; } u;
|
||||
fi_type u;
|
||||
unsigned int magic;
|
||||
|
||||
/*
|
||||
@@ -649,10 +649,10 @@ _mesa_bitcount(unsigned int n)
|
||||
GLhalfARB
|
||||
_mesa_float_to_half(float val)
|
||||
{
|
||||
const int flt = *((int *) (void *) &val);
|
||||
const int flt_m = flt & 0x7fffff;
|
||||
const int flt_e = (flt >> 23) & 0xff;
|
||||
const int flt_s = (flt >> 31) & 0x1;
|
||||
const fi_type fi = {val};
|
||||
const int flt_m = fi.i & 0x7fffff;
|
||||
const int flt_e = (fi.i >> 23) & 0xff;
|
||||
const int flt_s = (fi.i >> 31) & 0x1;
|
||||
int s, e, m = 0;
|
||||
GLhalfARB result;
|
||||
|
||||
@@ -739,7 +739,8 @@ _mesa_half_to_float(GLhalfARB val)
|
||||
const int m = val & 0x3ff;
|
||||
const int e = (val >> 10) & 0x1f;
|
||||
const int s = (val >> 15) & 0x1;
|
||||
int flt_m, flt_e, flt_s, flt;
|
||||
int flt_m, flt_e, flt_s;
|
||||
fi_type fi;
|
||||
float result;
|
||||
|
||||
/* sign bit */
|
||||
@@ -774,8 +775,8 @@ _mesa_half_to_float(GLhalfARB val)
|
||||
flt_m = m << 13;
|
||||
}
|
||||
|
||||
flt = (flt_s << 31) | (flt_e << 23) | flt_m;
|
||||
result = *((float *) (void *) &flt);
|
||||
fi.i = (flt_s << 31) | (flt_e << 23) | flt_m;
|
||||
result = fi.f;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@@ -202,17 +202,12 @@ do { \
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Copy a 4-element float vector (avoid using FPU registers)
|
||||
* XXX Could use two 64-bit moves on 64-bit systems
|
||||
* Copy a 4-element float vector
|
||||
* memcpy seems to be most efficient
|
||||
*/
|
||||
#define COPY_4FV( DST, SRC ) \
|
||||
do { \
|
||||
const GLuint *_s = (const GLuint *) (SRC); \
|
||||
GLuint *_d = (GLuint *) (DST); \
|
||||
_d[0] = _s[0]; \
|
||||
_d[1] = _s[1]; \
|
||||
_d[2] = _s[2]; \
|
||||
_d[3] = _s[3]; \
|
||||
_mesa_memcpy(DST, SRC, sizeof(GLfloat) * 4); \
|
||||
} while (0)
|
||||
|
||||
/** Copy \p SZ elements into a 4-element vector */
|
||||
|
@@ -54,8 +54,18 @@
|
||||
* Set x to positive or negative infinity.
|
||||
*/
|
||||
#if defined(USE_IEEE) || defined(_WIN32)
|
||||
#define SET_POS_INFINITY(x) ( *((GLuint *) (void *)&x) = 0x7F800000 )
|
||||
#define SET_NEG_INFINITY(x) ( *((GLuint *) (void *)&x) = 0xFF800000 )
|
||||
#define SET_POS_INFINITY(x) \
|
||||
do { \
|
||||
fi_type fi; \
|
||||
fi.i = 0x7F800000; \
|
||||
x = fi.f; \
|
||||
} while (0)
|
||||
#define SET_NEG_INFINITY(x) \
|
||||
do { \
|
||||
fi_type fi; \
|
||||
fi.i = 0xFF800000; \
|
||||
x = fi.f; \
|
||||
} while (0)
|
||||
#elif defined(VMS)
|
||||
#define SET_POS_INFINITY(x) x = __MAXFLOAT
|
||||
#define SET_NEG_INFINITY(x) x = -__MAXFLOAT
|
||||
@@ -1635,11 +1645,12 @@ _mesa_execute_program(GLcontext * ctx,
|
||||
case OPCODE_UP2H: /* unpack two 16-bit floats */
|
||||
{
|
||||
GLfloat a[4], result[4];
|
||||
const GLuint *rawBits = (const GLuint *) a;
|
||||
fi_type fi;
|
||||
GLhalfNV hx, hy;
|
||||
fetch_vector1(&inst->SrcReg[0], machine, a);
|
||||
hx = rawBits[0] & 0xffff;
|
||||
hy = rawBits[0] >> 16;
|
||||
fi.f = a[0];
|
||||
hx = fi.i & 0xffff;
|
||||
hy = fi.i >> 16;
|
||||
result[0] = result[2] = _mesa_half_to_float(hx);
|
||||
result[1] = result[3] = _mesa_half_to_float(hy);
|
||||
store_vector4(inst, machine, result);
|
||||
@@ -1648,11 +1659,12 @@ _mesa_execute_program(GLcontext * ctx,
|
||||
case OPCODE_UP2US: /* unpack two GLushorts */
|
||||
{
|
||||
GLfloat a[4], result[4];
|
||||
const GLuint *rawBits = (const GLuint *) a;
|
||||
fi_type fi;
|
||||
GLushort usx, usy;
|
||||
fetch_vector1(&inst->SrcReg[0], machine, a);
|
||||
usx = rawBits[0] & 0xffff;
|
||||
usy = rawBits[0] >> 16;
|
||||
fi.f = a[0];
|
||||
usx = fi.i & 0xffff;
|
||||
usy = fi.i >> 16;
|
||||
result[0] = result[2] = usx * (1.0f / 65535.0f);
|
||||
result[1] = result[3] = usy * (1.0f / 65535.0f);
|
||||
store_vector4(inst, machine, result);
|
||||
@@ -1661,24 +1673,26 @@ _mesa_execute_program(GLcontext * ctx,
|
||||
case OPCODE_UP4B: /* unpack four GLbytes */
|
||||
{
|
||||
GLfloat a[4], result[4];
|
||||
const GLuint *rawBits = (const GLuint *) a;
|
||||
fi_type fi;
|
||||
fetch_vector1(&inst->SrcReg[0], machine, a);
|
||||
result[0] = (((rawBits[0] >> 0) & 0xff) - 128) / 127.0F;
|
||||
result[1] = (((rawBits[0] >> 8) & 0xff) - 128) / 127.0F;
|
||||
result[2] = (((rawBits[0] >> 16) & 0xff) - 128) / 127.0F;
|
||||
result[3] = (((rawBits[0] >> 24) & 0xff) - 128) / 127.0F;
|
||||
fi.f = a[0];
|
||||
result[0] = (((fi.i >> 0) & 0xff) - 128) / 127.0F;
|
||||
result[1] = (((fi.i >> 8) & 0xff) - 128) / 127.0F;
|
||||
result[2] = (((fi.i >> 16) & 0xff) - 128) / 127.0F;
|
||||
result[3] = (((fi.i >> 24) & 0xff) - 128) / 127.0F;
|
||||
store_vector4(inst, machine, result);
|
||||
}
|
||||
break;
|
||||
case OPCODE_UP4UB: /* unpack four GLubytes */
|
||||
{
|
||||
GLfloat a[4], result[4];
|
||||
const GLuint *rawBits = (const GLuint *) a;
|
||||
fi_type fi;
|
||||
fetch_vector1(&inst->SrcReg[0], machine, a);
|
||||
result[0] = ((rawBits[0] >> 0) & 0xff) / 255.0F;
|
||||
result[1] = ((rawBits[0] >> 8) & 0xff) / 255.0F;
|
||||
result[2] = ((rawBits[0] >> 16) & 0xff) / 255.0F;
|
||||
result[3] = ((rawBits[0] >> 24) & 0xff) / 255.0F;
|
||||
fi.f = a[0];
|
||||
result[0] = ((fi.i >> 0) & 0xff) / 255.0F;
|
||||
result[1] = ((fi.i >> 8) & 0xff) / 255.0F;
|
||||
result[2] = ((fi.i >> 16) & 0xff) / 255.0F;
|
||||
result[3] = ((fi.i >> 24) & 0xff) / 255.0F;
|
||||
store_vector4(inst, machine, result);
|
||||
}
|
||||
break;
|
||||
|
@@ -162,12 +162,14 @@ load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt)
|
||||
*/
|
||||
for (i = 0; i < texSize; i++) {
|
||||
for (j = 0; j < texSize; j++) {
|
||||
union util_color uc;
|
||||
int k = (i * texSize + j);
|
||||
ubyte r = ctx->PixelMaps.RtoR.Map8[j * rSize / texSize];
|
||||
ubyte g = ctx->PixelMaps.GtoG.Map8[i * gSize / texSize];
|
||||
ubyte b = ctx->PixelMaps.BtoB.Map8[j * bSize / texSize];
|
||||
ubyte a = ctx->PixelMaps.AtoA.Map8[i * aSize / texSize];
|
||||
util_pack_color_ub(r, g, b, a, pt->format, dest + k);
|
||||
util_pack_color_ub(r, g, b, a, pt->format, &uc);
|
||||
*(dest + k) = uc.ui;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user