forked from KolibriOS/kolibrios
sdk: build osmesa.dll
git-svn-id: svn://kolibrios.org@5063 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
40038c1e69
commit
bdd53026f1
@ -28,21 +28,15 @@
|
|||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* OS independent time-manipulation functions.
|
* OS independent time-manipulation functions.
|
||||||
*
|
*
|
||||||
* @author Jose Fonseca <jfonseca@vmware.com>
|
* @author Jose Fonseca <jfonseca@vmware.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "pipe/p_config.h"
|
#include "pipe/p_config.h"
|
||||||
|
|
||||||
#if defined(PIPE_OS_UNIX)
|
|
||||||
# include <time.h> /* timeval */
|
# include <time.h> /* timeval */
|
||||||
# include <sys/time.h> /* timeval */
|
# include <sys/time.h> /* timeval */
|
||||||
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
|
|
||||||
# include <windows.h>
|
|
||||||
#else
|
|
||||||
# error Unsupported OS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "os_time.h"
|
#include "os_time.h"
|
||||||
|
|
||||||
@ -50,32 +44,8 @@
|
|||||||
int64_t
|
int64_t
|
||||||
os_time_get_nano(void)
|
os_time_get_nano(void)
|
||||||
{
|
{
|
||||||
#if defined(PIPE_OS_LINUX)
|
|
||||||
|
|
||||||
struct timespec tv;
|
|
||||||
clock_gettime(CLOCK_MONOTONIC, &tv);
|
|
||||||
return tv.tv_nsec + tv.tv_sec*INT64_C(1000000000);
|
|
||||||
|
|
||||||
#elif defined(PIPE_OS_UNIX)
|
|
||||||
|
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
gettimeofday(&tv, NULL);
|
gettimeofday(&tv, NULL);
|
||||||
return tv.tv_usec*INT64_C(1000) + tv.tv_sec*INT64_C(1000000000);
|
|
||||||
|
|
||||||
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
|
|
||||||
|
|
||||||
static LARGE_INTEGER frequency;
|
|
||||||
LARGE_INTEGER counter;
|
|
||||||
if(!frequency.QuadPart)
|
|
||||||
QueryPerformanceFrequency(&frequency);
|
|
||||||
QueryPerformanceCounter(&counter);
|
|
||||||
return counter.QuadPart*INT64_C(1000000000)/frequency.QuadPart;
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#error Unsupported OS
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
*
|
*
|
||||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||||
* Copyright (c) 2008 VMware, Inc.
|
* Copyright (c) 2008 VMware, Inc.
|
||||||
* All Rights Reserved.
|
* All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the
|
* copy of this software and associated documentation files (the
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* "Software"), to deal in the Software without restriction, including
|
||||||
@ -11,11 +11,11 @@
|
|||||||
* distribute, sub license, and/or sell copies of the Software, and to
|
* distribute, sub license, and/or sell copies of the Software, and to
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
* permit persons to whom the Software is furnished to do so, subject to
|
||||||
* the following conditions:
|
* the following conditions:
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice (including the
|
* The above copyright notice and this permission notice (including the
|
||||||
* next paragraph) shall be included in all copies or substantial portions
|
* next paragraph) shall be included in all copies or substantial portions
|
||||||
* of the Software.
|
* of the Software.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||||
@ -23,22 +23,22 @@
|
|||||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*
|
*
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "pipe/p_config.h"
|
#include "pipe/p_config.h"
|
||||||
|
|
||||||
#include "pipe/p_compiler.h"
|
#include "pipe/p_compiler.h"
|
||||||
#include "util/u_debug.h"
|
#include "util/u_debug.h"
|
||||||
#include "pipe/p_format.h"
|
#include "pipe/p_format.h"
|
||||||
#include "pipe/p_state.h"
|
#include "pipe/p_state.h"
|
||||||
#include "util/u_inlines.h"
|
#include "util/u_inlines.h"
|
||||||
#include "util/u_format.h"
|
#include "util/u_format.h"
|
||||||
#include "util/u_memory.h"
|
#include "util/u_memory.h"
|
||||||
#include "util/u_string.h"
|
#include "util/u_string.h"
|
||||||
#include "util/u_math.h"
|
#include "util/u_math.h"
|
||||||
#include "util/u_tile.h"
|
#include "util/u_tile.h"
|
||||||
#include "util/u_prim.h"
|
#include "util/u_prim.h"
|
||||||
#include "util/u_surface.h"
|
#include "util/u_surface.h"
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ debug_get_option(const char *name, const char *dfault)
|
|||||||
|
|
||||||
if (debug_get_option_should_print())
|
if (debug_get_option_should_print())
|
||||||
debug_printf("%s: %s = %s\n", __FUNCTION__, name, result ? result : "(null)");
|
debug_printf("%s: %s = %s\n", __FUNCTION__, name, result ? result : "(null)");
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ debug_get_bool_option(const char *name, boolean dfault)
|
|||||||
{
|
{
|
||||||
const char *str = os_get_option(name);
|
const char *str = os_get_option(name);
|
||||||
boolean result;
|
boolean result;
|
||||||
|
|
||||||
if(str == NULL)
|
if(str == NULL)
|
||||||
result = dfault;
|
result = dfault;
|
||||||
else if(!util_strcmp(str, "n"))
|
else if(!util_strcmp(str, "n"))
|
||||||
@ -142,7 +142,7 @@ debug_get_bool_option(const char *name, boolean dfault)
|
|||||||
|
|
||||||
if (debug_get_option_should_print())
|
if (debug_get_option_should_print())
|
||||||
debug_printf("%s: %s = %s\n", __FUNCTION__, name, result ? "TRUE" : "FALSE");
|
debug_printf("%s: %s = %s\n", __FUNCTION__, name, result ? "TRUE" : "FALSE");
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ debug_get_num_option(const char *name, long dfault)
|
|||||||
{
|
{
|
||||||
long result;
|
long result;
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
str = os_get_option(name);
|
str = os_get_option(name);
|
||||||
if(!str)
|
if(!str)
|
||||||
result = dfault;
|
result = dfault;
|
||||||
@ -163,7 +163,7 @@ debug_get_num_option(const char *name, long dfault)
|
|||||||
if(c == '-') {
|
if(c == '-') {
|
||||||
sign = -1;
|
sign = -1;
|
||||||
c = *str++;
|
c = *str++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sign = 1;
|
sign = 1;
|
||||||
}
|
}
|
||||||
@ -225,7 +225,7 @@ static boolean str_has_option(const char *str, const char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned long
|
unsigned long
|
||||||
debug_get_flags_option(const char *name,
|
debug_get_flags_option(const char *name,
|
||||||
const struct debug_named_value *flags,
|
const struct debug_named_value *flags,
|
||||||
unsigned long dfault)
|
unsigned long dfault)
|
||||||
{
|
{
|
||||||
@ -233,7 +233,7 @@ debug_get_flags_option(const char *name,
|
|||||||
const char *str;
|
const char *str;
|
||||||
const struct debug_named_value *orig = flags;
|
const struct debug_named_value *orig = flags;
|
||||||
unsigned namealign = 0;
|
unsigned namealign = 0;
|
||||||
|
|
||||||
str = os_get_option(name);
|
str = os_get_option(name);
|
||||||
if(!str)
|
if(!str)
|
||||||
result = dfault;
|
result = dfault;
|
||||||
@ -268,10 +268,10 @@ debug_get_flags_option(const char *name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void _debug_assert_fail(const char *expr,
|
void _debug_assert_fail(const char *expr,
|
||||||
const char *file,
|
const char *file,
|
||||||
unsigned line,
|
unsigned line,
|
||||||
const char *function)
|
const char *function)
|
||||||
{
|
{
|
||||||
_debug_printf("%s:%u:%s: Assertion `%s' failed.\n", file, line, function, expr);
|
_debug_printf("%s:%u:%s: Assertion `%s' failed.\n", file, line, function, expr);
|
||||||
if (debug_get_bool_option("GALLIUM_ABORT_ON_ASSERT", TRUE))
|
if (debug_get_bool_option("GALLIUM_ABORT_ON_ASSERT", TRUE))
|
||||||
@ -282,11 +282,11 @@ void _debug_assert_fail(const char *expr,
|
|||||||
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
debug_dump_enum(const struct debug_named_value *names,
|
debug_dump_enum(const struct debug_named_value *names,
|
||||||
unsigned long value)
|
unsigned long value)
|
||||||
{
|
{
|
||||||
static char rest[64];
|
static char rest[64];
|
||||||
|
|
||||||
while(names->name) {
|
while(names->name) {
|
||||||
if(names->value == value)
|
if(names->value == value)
|
||||||
return names->name;
|
return names->name;
|
||||||
@ -299,12 +299,12 @@ debug_dump_enum(const struct debug_named_value *names,
|
|||||||
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
debug_dump_enum_noprefix(const struct debug_named_value *names,
|
debug_dump_enum_noprefix(const struct debug_named_value *names,
|
||||||
const char *prefix,
|
const char *prefix,
|
||||||
unsigned long value)
|
unsigned long value)
|
||||||
{
|
{
|
||||||
static char rest[64];
|
static char rest[64];
|
||||||
|
|
||||||
while(names->name) {
|
while(names->name) {
|
||||||
if(names->value == value) {
|
if(names->value == value) {
|
||||||
const char *name = names->name;
|
const char *name = names->name;
|
||||||
@ -317,7 +317,7 @@ debug_dump_enum_noprefix(const struct debug_named_value *names,
|
|||||||
++names;
|
++names;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
util_snprintf(rest, sizeof(rest), "0x%08lx", value);
|
util_snprintf(rest, sizeof(rest), "0x%08lx", value);
|
||||||
return rest;
|
return rest;
|
||||||
@ -325,7 +325,7 @@ debug_dump_enum_noprefix(const struct debug_named_value *names,
|
|||||||
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
debug_dump_flags(const struct debug_named_value *names,
|
debug_dump_flags(const struct debug_named_value *names,
|
||||||
unsigned long value)
|
unsigned long value)
|
||||||
{
|
{
|
||||||
static char output[4096];
|
static char output[4096];
|
||||||
@ -346,21 +346,21 @@ debug_dump_flags(const struct debug_named_value *names,
|
|||||||
}
|
}
|
||||||
++names;
|
++names;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
if (!first)
|
if (!first)
|
||||||
util_strncat(output, "|", sizeof(output));
|
util_strncat(output, "|", sizeof(output));
|
||||||
else
|
else
|
||||||
first = 0;
|
first = 0;
|
||||||
|
|
||||||
util_snprintf(rest, sizeof(rest), "0x%08lx", value);
|
util_snprintf(rest, sizeof(rest), "0x%08lx", value);
|
||||||
util_strncat(output, rest, sizeof(output) - 1);
|
util_strncat(output, rest, sizeof(output) - 1);
|
||||||
output[sizeof(output) - 1] = '\0';
|
output[sizeof(output) - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if(first)
|
if(first)
|
||||||
return "0";
|
return "0";
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,7 +451,7 @@ void debug_dump_image(const char *prefix,
|
|||||||
enum pipe_format format, unsigned cpp,
|
enum pipe_format format, unsigned cpp,
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
unsigned stride,
|
unsigned stride,
|
||||||
const void *data)
|
const void *data)
|
||||||
{
|
{
|
||||||
/* write a ppm file */
|
/* write a ppm file */
|
||||||
char filename[256];
|
char filename[256];
|
||||||
|
@ -111,7 +111,10 @@ util_format_s3tc_init(void)
|
|||||||
util_dl_proc fetch_2d_texel_rgba_dxt3;
|
util_dl_proc fetch_2d_texel_rgba_dxt3;
|
||||||
util_dl_proc fetch_2d_texel_rgba_dxt5;
|
util_dl_proc fetch_2d_texel_rgba_dxt5;
|
||||||
util_dl_proc tx_compress_dxtn;
|
util_dl_proc tx_compress_dxtn;
|
||||||
|
char *force_s3tc_enable;
|
||||||
|
|
||||||
|
return;
|
||||||
|
#if 0
|
||||||
if (!first_time)
|
if (!first_time)
|
||||||
return;
|
return;
|
||||||
first_time = FALSE;
|
first_time = FALSE;
|
||||||
@ -119,10 +122,17 @@ util_format_s3tc_init(void)
|
|||||||
if (util_format_s3tc_enabled)
|
if (util_format_s3tc_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
library = util_dl_open(DXTN_LIBNAME);
|
// library = util_dl_open(DXTN_LIBNAME);
|
||||||
if (!library) {
|
if (!library) {
|
||||||
debug_printf("couldn't open " DXTN_LIBNAME ", software DXTn "
|
if ((force_s3tc_enable = getenv("force_s3tc_enable")) &&
|
||||||
"compression/decompression unavailable\n");
|
!strcmp(force_s3tc_enable, "true")) {
|
||||||
|
debug_printf("couldn't open " DXTN_LIBNAME ", enabling DXTn due to "
|
||||||
|
"force_s3tc_enable=true environment variable\n");
|
||||||
|
util_format_s3tc_enabled = TRUE;
|
||||||
|
} else {
|
||||||
|
debug_printf("couldn't open " DXTN_LIBNAME ", software DXTn "
|
||||||
|
"compression/decompression unavailable\n");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,6 +165,7 @@ util_format_s3tc_init(void)
|
|||||||
util_format_dxt5_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt5;
|
util_format_dxt5_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt5;
|
||||||
util_format_dxtn_pack = (util_format_dxtn_pack_t)tx_compress_dxtn;
|
util_format_dxtn_pack = (util_format_dxtn_pack_t)tx_compress_dxtn;
|
||||||
util_format_s3tc_enabled = TRUE;
|
util_format_s3tc_enabled = TRUE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -240,7 +251,7 @@ util_format_dxtn_rgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
|
|||||||
const uint8_t *src_row, unsigned src_stride,
|
const uint8_t *src_row, unsigned src_stride,
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
util_format_dxtn_fetch_t fetch,
|
util_format_dxtn_fetch_t fetch,
|
||||||
unsigned block_size, boolean srgb)
|
unsigned block_size)
|
||||||
{
|
{
|
||||||
const unsigned bw = 4, bh = 4, comps = 4;
|
const unsigned bw = 4, bh = 4, comps = 4;
|
||||||
unsigned x, y, i, j;
|
unsigned x, y, i, j;
|
||||||
@ -251,11 +262,6 @@ util_format_dxtn_rgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
|
|||||||
for(i = 0; i < bw; ++i) {
|
for(i = 0; i < bw; ++i) {
|
||||||
uint8_t *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*comps;
|
uint8_t *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*comps;
|
||||||
fetch(0, src, i, j, dst);
|
fetch(0, src, i, j, dst);
|
||||||
if (srgb) {
|
|
||||||
dst[0] = util_format_srgb_to_linear_8unorm(dst[0]);
|
|
||||||
dst[1] = util_format_srgb_to_linear_8unorm(dst[1]);
|
|
||||||
dst[2] = util_format_srgb_to_linear_8unorm(dst[2]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
src += block_size;
|
src += block_size;
|
||||||
@ -272,8 +278,7 @@ util_format_dxt1_rgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
|
|||||||
util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
|
util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
|
||||||
src_row, src_stride,
|
src_row, src_stride,
|
||||||
width, height,
|
width, height,
|
||||||
util_format_dxt1_rgb_fetch,
|
util_format_dxt1_rgb_fetch, 8);
|
||||||
8, FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -284,8 +289,7 @@ util_format_dxt1_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
|
|||||||
util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
|
util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
|
||||||
src_row, src_stride,
|
src_row, src_stride,
|
||||||
width, height,
|
width, height,
|
||||||
util_format_dxt1_rgba_fetch,
|
util_format_dxt1_rgba_fetch, 8);
|
||||||
8, FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -296,8 +300,7 @@ util_format_dxt3_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
|
|||||||
util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
|
util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
|
||||||
src_row, src_stride,
|
src_row, src_stride,
|
||||||
width, height,
|
width, height,
|
||||||
util_format_dxt3_rgba_fetch,
|
util_format_dxt3_rgba_fetch, 16);
|
||||||
16, FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -308,8 +311,7 @@ util_format_dxt5_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
|
|||||||
util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
|
util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
|
||||||
src_row, src_stride,
|
src_row, src_stride,
|
||||||
width, height,
|
width, height,
|
||||||
util_format_dxt5_rgba_fetch,
|
util_format_dxt5_rgba_fetch, 16);
|
||||||
16, FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE void
|
static INLINE void
|
||||||
@ -317,7 +319,7 @@ util_format_dxtn_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride,
|
|||||||
const uint8_t *src_row, unsigned src_stride,
|
const uint8_t *src_row, unsigned src_stride,
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
util_format_dxtn_fetch_t fetch,
|
util_format_dxtn_fetch_t fetch,
|
||||||
unsigned block_size, boolean srgb)
|
unsigned block_size)
|
||||||
{
|
{
|
||||||
unsigned x, y, i, j;
|
unsigned x, y, i, j;
|
||||||
for(y = 0; y < height; y += 4) {
|
for(y = 0; y < height; y += 4) {
|
||||||
@ -328,16 +330,9 @@ util_format_dxtn_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride,
|
|||||||
float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
|
float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
|
||||||
uint8_t tmp[4];
|
uint8_t tmp[4];
|
||||||
fetch(0, src, i, j, tmp);
|
fetch(0, src, i, j, tmp);
|
||||||
if (srgb) {
|
dst[0] = ubyte_to_float(tmp[0]);
|
||||||
dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
|
dst[1] = ubyte_to_float(tmp[1]);
|
||||||
dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
|
dst[2] = ubyte_to_float(tmp[2]);
|
||||||
dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
dst[0] = ubyte_to_float(tmp[0]);
|
|
||||||
dst[1] = ubyte_to_float(tmp[1]);
|
|
||||||
dst[2] = ubyte_to_float(tmp[2]);
|
|
||||||
}
|
|
||||||
dst[3] = ubyte_to_float(tmp[3]);
|
dst[3] = ubyte_to_float(tmp[3]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -355,8 +350,7 @@ util_format_dxt1_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride,
|
|||||||
util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
|
util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
|
||||||
src_row, src_stride,
|
src_row, src_stride,
|
||||||
width, height,
|
width, height,
|
||||||
util_format_dxt1_rgb_fetch,
|
util_format_dxt1_rgb_fetch, 8);
|
||||||
8, FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -367,8 +361,7 @@ util_format_dxt1_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
|
|||||||
util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
|
util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
|
||||||
src_row, src_stride,
|
src_row, src_stride,
|
||||||
width, height,
|
width, height,
|
||||||
util_format_dxt1_rgba_fetch,
|
util_format_dxt1_rgba_fetch, 8);
|
||||||
8, FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -379,8 +372,7 @@ util_format_dxt3_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
|
|||||||
util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
|
util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
|
||||||
src_row, src_stride,
|
src_row, src_stride,
|
||||||
width, height,
|
width, height,
|
||||||
util_format_dxt3_rgba_fetch,
|
util_format_dxt3_rgba_fetch, 16);
|
||||||
16, FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -391,8 +383,7 @@ util_format_dxt5_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
|
|||||||
util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
|
util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
|
||||||
src_row, src_stride,
|
src_row, src_stride,
|
||||||
width, height,
|
width, height,
|
||||||
util_format_dxt5_rgba_fetch,
|
util_format_dxt5_rgba_fetch, 16);
|
||||||
16, FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -400,52 +391,29 @@ util_format_dxt5_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
|
|||||||
* Block compression.
|
* Block compression.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static INLINE void
|
|
||||||
util_format_dxtn_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
|
|
||||||
const uint8_t *src, unsigned src_stride,
|
|
||||||
unsigned width, unsigned height,
|
|
||||||
enum util_format_dxtn format,
|
|
||||||
unsigned block_size, boolean srgb)
|
|
||||||
{
|
|
||||||
const unsigned bw = 4, bh = 4, comps = 4;
|
|
||||||
unsigned x, y, i, j, k;
|
|
||||||
for(y = 0; y < height; y += bh) {
|
|
||||||
uint8_t *dst = dst_row;
|
|
||||||
for(x = 0; x < width; x += bw) {
|
|
||||||
uint8_t tmp[4][4][4]; /* [bh][bw][comps] */
|
|
||||||
for(j = 0; j < bh; ++j) {
|
|
||||||
for(i = 0; i < bw; ++i) {
|
|
||||||
uint8_t src_tmp;
|
|
||||||
for(k = 0; k < 3; ++k) {
|
|
||||||
src_tmp = src[(y + j)*src_stride/sizeof(*src) + (x+i)*comps + k];
|
|
||||||
if (srgb) {
|
|
||||||
tmp[j][i][k] = util_format_linear_to_srgb_8unorm(src_tmp);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
tmp[j][i][k] = src_tmp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* for sake of simplicity there's an unneeded 4th component for dxt1_rgb */
|
|
||||||
tmp[j][i][3] = src[(y + j)*src_stride/sizeof(*src) + (x+i)*comps + 3];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* even for dxt1_rgb have 4 src comps */
|
|
||||||
util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], format, dst, 0);
|
|
||||||
dst += block_size;
|
|
||||||
}
|
|
||||||
dst_row += dst_stride / sizeof(*dst_row);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
util_format_dxt1_rgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
|
util_format_dxt1_rgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
|
||||||
const uint8_t *src, unsigned src_stride,
|
const uint8_t *src, unsigned src_stride,
|
||||||
unsigned width, unsigned height)
|
unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
|
const unsigned bw = 4, bh = 4, bytes_per_block = 8;
|
||||||
width, height, UTIL_FORMAT_DXT1_RGB,
|
unsigned x, y, i, j, k;
|
||||||
8, FALSE);
|
for(y = 0; y < height; y += bh) {
|
||||||
|
uint8_t *dst = dst_row;
|
||||||
|
for(x = 0; x < width; x += bw) {
|
||||||
|
uint8_t tmp[4][4][3]; /* [bh][bw][comps] */
|
||||||
|
for(j = 0; j < bh; ++j) {
|
||||||
|
for(i = 0; i < bw; ++i) {
|
||||||
|
for(k = 0; k < 3; ++k) {
|
||||||
|
tmp[j][i][k] = src[(y + j)*src_stride/sizeof(*src) + (x + i)*4 + k];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
util_format_dxtn_pack(3, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT1_RGB, dst, 0);
|
||||||
|
dst += bytes_per_block;
|
||||||
|
}
|
||||||
|
dst_row += dst_stride / sizeof(*dst_row);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -453,9 +421,24 @@ util_format_dxt1_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
|
|||||||
const uint8_t *src, unsigned src_stride,
|
const uint8_t *src, unsigned src_stride,
|
||||||
unsigned width, unsigned height)
|
unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
|
const unsigned bw = 4, bh = 4, comps = 4, bytes_per_block = 8;
|
||||||
width, height, UTIL_FORMAT_DXT1_RGBA,
|
unsigned x, y, i, j, k;
|
||||||
8, FALSE);
|
for(y = 0; y < height; y += bh) {
|
||||||
|
uint8_t *dst = dst_row;
|
||||||
|
for(x = 0; x < width; x += bw) {
|
||||||
|
uint8_t tmp[4][4][4]; /* [bh][bw][comps] */
|
||||||
|
for(j = 0; j < bh; ++j) {
|
||||||
|
for(i = 0; i < bw; ++i) {
|
||||||
|
for(k = 0; k < comps; ++k) {
|
||||||
|
tmp[j][i][k] = src[(y + j)*src_stride/sizeof(*src) + (x + i)*comps + k];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT1_RGBA, dst, 0);
|
||||||
|
dst += bytes_per_block;
|
||||||
|
}
|
||||||
|
dst_row += dst_stride / sizeof(*dst_row);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -463,9 +446,24 @@ util_format_dxt3_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
|
|||||||
const uint8_t *src, unsigned src_stride,
|
const uint8_t *src, unsigned src_stride,
|
||||||
unsigned width, unsigned height)
|
unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
|
const unsigned bw = 4, bh = 4, comps = 4, bytes_per_block = 16;
|
||||||
width, height, UTIL_FORMAT_DXT3_RGBA,
|
unsigned x, y, i, j, k;
|
||||||
16, FALSE);
|
for(y = 0; y < height; y += bh) {
|
||||||
|
uint8_t *dst = dst_row;
|
||||||
|
for(x = 0; x < width; x += bw) {
|
||||||
|
uint8_t tmp[4][4][4]; /* [bh][bw][comps] */
|
||||||
|
for(j = 0; j < bh; ++j) {
|
||||||
|
for(i = 0; i < bw; ++i) {
|
||||||
|
for(k = 0; k < comps; ++k) {
|
||||||
|
tmp[j][i][k] = src[(y + j)*src_stride/sizeof(*src) + (x + i)*comps + k];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT3_RGBA, dst, 0);
|
||||||
|
dst += bytes_per_block;
|
||||||
|
}
|
||||||
|
dst_row += dst_stride / sizeof(*dst_row);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -473,44 +471,24 @@ util_format_dxt5_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
|
|||||||
const uint8_t *src, unsigned src_stride,
|
const uint8_t *src, unsigned src_stride,
|
||||||
unsigned width, unsigned height)
|
unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
|
const unsigned bw = 4, bh = 4, comps = 4, bytes_per_block = 16;
|
||||||
width, height, UTIL_FORMAT_DXT5_RGBA,
|
|
||||||
16, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
static INLINE void
|
|
||||||
util_format_dxtn_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
|
|
||||||
const float *src, unsigned src_stride,
|
|
||||||
unsigned width, unsigned height,
|
|
||||||
enum util_format_dxtn format,
|
|
||||||
unsigned block_size, boolean srgb)
|
|
||||||
{
|
|
||||||
unsigned x, y, i, j, k;
|
unsigned x, y, i, j, k;
|
||||||
for(y = 0; y < height; y += 4) {
|
|
||||||
|
for(y = 0; y < height; y += bh) {
|
||||||
uint8_t *dst = dst_row;
|
uint8_t *dst = dst_row;
|
||||||
for(x = 0; x < width; x += 4) {
|
for(x = 0; x < width; x += bw) {
|
||||||
uint8_t tmp[4][4][4];
|
uint8_t tmp[4][4][4]; /* [bh][bw][comps] */
|
||||||
for(j = 0; j < 4; ++j) {
|
for(j = 0; j < bh; ++j) {
|
||||||
for(i = 0; i < 4; ++i) {
|
for(i = 0; i < bw; ++i) {
|
||||||
float src_tmp;
|
for(k = 0; k < comps; ++k) {
|
||||||
for(k = 0; k < 3; ++k) {
|
tmp[j][i][k] = src[(y + j)*src_stride/sizeof(*src) + (x + i)*comps + k];
|
||||||
src_tmp = src[(y + j)*src_stride/sizeof(*src) + (x+i)*4 + k];
|
|
||||||
if (srgb) {
|
|
||||||
tmp[j][i][k] = util_format_linear_float_to_srgb_8unorm(src_tmp);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
tmp[j][i][k] = float_to_ubyte(src_tmp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* for sake of simplicity there's an unneeded 4th component for dxt1_rgb */
|
|
||||||
src_tmp = src[(y + j)*src_stride/sizeof(*src) + (x+i)*4 + 3];
|
|
||||||
tmp[j][i][3] = float_to_ubyte(src_tmp);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], format, dst, 0);
|
util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT5_RGBA, dst, 0);
|
||||||
dst += block_size;
|
dst += bytes_per_block;
|
||||||
}
|
}
|
||||||
dst_row += 4*dst_stride/sizeof(*dst_row);
|
dst_row += dst_stride / sizeof(*dst_row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -519,9 +497,23 @@ util_format_dxt1_rgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
|
|||||||
const float *src, unsigned src_stride,
|
const float *src, unsigned src_stride,
|
||||||
unsigned width, unsigned height)
|
unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,
|
unsigned x, y, i, j, k;
|
||||||
width, height, UTIL_FORMAT_DXT1_RGB,
|
for(y = 0; y < height; y += 4) {
|
||||||
8, FALSE);
|
uint8_t *dst = dst_row;
|
||||||
|
for(x = 0; x < width; x += 4) {
|
||||||
|
uint8_t tmp[4][4][3];
|
||||||
|
for(j = 0; j < 4; ++j) {
|
||||||
|
for(i = 0; i < 4; ++i) {
|
||||||
|
for(k = 0; k < 3; ++k) {
|
||||||
|
tmp[j][i][k] = float_to_ubyte(src[(y + j)*src_stride/sizeof(*src) + (x+i)*4 + k]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
util_format_dxtn_pack(3, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT1_RGB, dst, 0);
|
||||||
|
dst += 8;
|
||||||
|
}
|
||||||
|
dst_row += 4*dst_stride/sizeof(*dst_row);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -529,9 +521,23 @@ util_format_dxt1_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
|
|||||||
const float *src, unsigned src_stride,
|
const float *src, unsigned src_stride,
|
||||||
unsigned width, unsigned height)
|
unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,
|
unsigned x, y, i, j, k;
|
||||||
width, height, UTIL_FORMAT_DXT1_RGBA,
|
for(y = 0; y < height; y += 4) {
|
||||||
8, FALSE);
|
uint8_t *dst = dst_row;
|
||||||
|
for(x = 0; x < width; x += 4) {
|
||||||
|
uint8_t tmp[4][4][4];
|
||||||
|
for(j = 0; j < 4; ++j) {
|
||||||
|
for(i = 0; i < 4; ++i) {
|
||||||
|
for(k = 0; k < 4; ++k) {
|
||||||
|
tmp[j][i][k] = float_to_ubyte(src[(y + j)*src_stride/sizeof(*src) + (x+i)*4 + k]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT1_RGBA, dst, 0);
|
||||||
|
dst += 8;
|
||||||
|
}
|
||||||
|
dst_row += 4*dst_stride/sizeof(*dst_row);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -539,9 +545,23 @@ util_format_dxt3_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
|
|||||||
const float *src, unsigned src_stride,
|
const float *src, unsigned src_stride,
|
||||||
unsigned width, unsigned height)
|
unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,
|
unsigned x, y, i, j, k;
|
||||||
width, height, UTIL_FORMAT_DXT3_RGBA,
|
for(y = 0; y < height; y += 4) {
|
||||||
16, FALSE);
|
uint8_t *dst = dst_row;
|
||||||
|
for(x = 0; x < width; x += 4) {
|
||||||
|
uint8_t tmp[4][4][4];
|
||||||
|
for(j = 0; j < 4; ++j) {
|
||||||
|
for(i = 0; i < 4; ++i) {
|
||||||
|
for(k = 0; k < 4; ++k) {
|
||||||
|
tmp[j][i][k] = float_to_ubyte(src[(y + j)*src_stride/sizeof(*src) + (x+i)*4 + k]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT3_RGBA, dst, 0);
|
||||||
|
dst += 16;
|
||||||
|
}
|
||||||
|
dst_row += 4*dst_stride/sizeof(*dst_row);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -549,245 +569,173 @@ util_format_dxt5_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
|
|||||||
const float *src, unsigned src_stride,
|
const float *src, unsigned src_stride,
|
||||||
unsigned width, unsigned height)
|
unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,
|
unsigned x, y, i, j, k;
|
||||||
width, height, UTIL_FORMAT_DXT5_RGBA,
|
for(y = 0; y < height; y += 4) {
|
||||||
16, FALSE);
|
uint8_t *dst = dst_row;
|
||||||
|
for(x = 0; x < width; x += 4) {
|
||||||
|
uint8_t tmp[4][4][4];
|
||||||
|
for(j = 0; j < 4; ++j) {
|
||||||
|
for(i = 0; i < 4; ++i) {
|
||||||
|
for(k = 0; k < 4; ++k) {
|
||||||
|
tmp[j][i][k] = float_to_ubyte(src[(y + j)*src_stride/sizeof(*src) + (x+i)*4 + k]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT5_RGBA, dst, 0);
|
||||||
|
dst += 16;
|
||||||
|
}
|
||||||
|
dst_row += 4*dst_stride/sizeof(*dst_row);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SRGB variants.
|
* SRGB variants.
|
||||||
|
*
|
||||||
|
* FIXME: shunts to RGB for now
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
|
||||||
util_format_dxt1_srgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
|
|
||||||
{
|
|
||||||
uint8_t tmp[4];
|
|
||||||
util_format_dxt1_rgb_fetch(0, src, i, j, tmp);
|
|
||||||
dst[0] = util_format_srgb_to_linear_8unorm(tmp[0]);
|
|
||||||
dst[1] = util_format_srgb_to_linear_8unorm(tmp[1]);
|
|
||||||
dst[2] = util_format_srgb_to_linear_8unorm(tmp[2]);
|
|
||||||
dst[3] = 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
util_format_dxt1_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
|
|
||||||
{
|
|
||||||
uint8_t tmp[4];
|
|
||||||
util_format_dxt1_rgba_fetch(0, src, i, j, tmp);
|
|
||||||
dst[0] = util_format_srgb_to_linear_8unorm(tmp[0]);
|
|
||||||
dst[1] = util_format_srgb_to_linear_8unorm(tmp[1]);
|
|
||||||
dst[2] = util_format_srgb_to_linear_8unorm(tmp[2]);
|
|
||||||
dst[3] = tmp[3];
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
util_format_dxt3_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
|
|
||||||
{
|
|
||||||
uint8_t tmp[4];
|
|
||||||
util_format_dxt3_rgba_fetch(0, src, i, j, tmp);
|
|
||||||
dst[0] = util_format_srgb_to_linear_8unorm(tmp[0]);
|
|
||||||
dst[1] = util_format_srgb_to_linear_8unorm(tmp[1]);
|
|
||||||
dst[2] = util_format_srgb_to_linear_8unorm(tmp[2]);
|
|
||||||
dst[3] = tmp[3];
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
util_format_dxt5_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
|
|
||||||
{
|
|
||||||
uint8_t tmp[4];
|
|
||||||
util_format_dxt5_rgba_fetch(0, src, i, j, tmp);
|
|
||||||
dst[0] = util_format_srgb_to_linear_8unorm(tmp[0]);
|
|
||||||
dst[1] = util_format_srgb_to_linear_8unorm(tmp[1]);
|
|
||||||
dst[2] = util_format_srgb_to_linear_8unorm(tmp[2]);
|
|
||||||
dst[3] = tmp[3];
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
util_format_dxt1_srgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
|
|
||||||
{
|
|
||||||
uint8_t tmp[4];
|
|
||||||
util_format_dxt1_rgb_fetch(0, src, i, j, tmp);
|
|
||||||
dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
|
|
||||||
dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
|
|
||||||
dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
|
|
||||||
dst[3] = 1.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
util_format_dxt1_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
|
|
||||||
{
|
|
||||||
uint8_t tmp[4];
|
|
||||||
util_format_dxt1_rgba_fetch(0, src, i, j, tmp);
|
|
||||||
dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
|
|
||||||
dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
|
|
||||||
dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
|
|
||||||
dst[3] = ubyte_to_float(tmp[3]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
util_format_dxt3_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
|
|
||||||
{
|
|
||||||
uint8_t tmp[4];
|
|
||||||
util_format_dxt3_rgba_fetch(0, src, i, j, tmp);
|
|
||||||
dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
|
|
||||||
dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
|
|
||||||
dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
|
|
||||||
dst[3] = ubyte_to_float(tmp[3]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
util_format_dxt5_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
|
|
||||||
{
|
|
||||||
uint8_t tmp[4];
|
|
||||||
util_format_dxt5_rgba_fetch(0, src, i, j, tmp);
|
|
||||||
dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
|
|
||||||
dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
|
|
||||||
dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
|
|
||||||
dst[3] = ubyte_to_float(tmp[3]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
util_format_dxt1_srgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
|
util_format_dxt1_srgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
|
util_format_dxt1_rgb_unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
|
||||||
src_row, src_stride,
|
|
||||||
width, height,
|
|
||||||
util_format_dxt1_rgb_fetch,
|
|
||||||
8, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
util_format_dxt1_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
|
|
||||||
{
|
|
||||||
util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
|
|
||||||
src_row, src_stride,
|
|
||||||
width, height,
|
|
||||||
util_format_dxt1_rgba_fetch,
|
|
||||||
8, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
util_format_dxt3_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
|
|
||||||
{
|
|
||||||
util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
|
|
||||||
src_row, src_stride,
|
|
||||||
width, height,
|
|
||||||
util_format_dxt3_rgba_fetch,
|
|
||||||
16, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
util_format_dxt5_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
|
|
||||||
{
|
|
||||||
util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
|
|
||||||
src_row, src_stride,
|
|
||||||
width, height,
|
|
||||||
util_format_dxt5_rgba_fetch,
|
|
||||||
16, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
util_format_dxt1_srgb_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
|
|
||||||
{
|
|
||||||
util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
|
|
||||||
src_row, src_stride,
|
|
||||||
width, height,
|
|
||||||
util_format_dxt1_rgb_fetch,
|
|
||||||
8, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
util_format_dxt1_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
|
|
||||||
{
|
|
||||||
util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
|
|
||||||
src_row, src_stride,
|
|
||||||
width, height,
|
|
||||||
util_format_dxt1_rgba_fetch,
|
|
||||||
8, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
util_format_dxt3_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
|
|
||||||
{
|
|
||||||
util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
|
|
||||||
src_row, src_stride,
|
|
||||||
width, height,
|
|
||||||
util_format_dxt3_rgba_fetch,
|
|
||||||
16, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
util_format_dxt5_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
|
|
||||||
{
|
|
||||||
util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
|
|
||||||
src_row, src_stride,
|
|
||||||
width, height,
|
|
||||||
util_format_dxt5_rgba_fetch,
|
|
||||||
16, TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
util_format_dxt1_srgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
|
util_format_dxt1_srgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,
|
util_format_dxt1_rgb_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
|
||||||
width, height, UTIL_FORMAT_DXT1_RGB,
|
}
|
||||||
8, TRUE);
|
|
||||||
|
void
|
||||||
|
util_format_dxt1_srgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
|
||||||
|
{
|
||||||
|
util_format_dxt1_rgb_fetch_rgba_8unorm(dst, src, i, j);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
util_format_dxt1_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
|
||||||
|
{
|
||||||
|
util_format_dxt1_rgba_unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
util_format_dxt1_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
|
util_format_dxt1_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,
|
util_format_dxt1_rgba_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
|
||||||
width, height, UTIL_FORMAT_DXT1_RGBA,
|
}
|
||||||
8, TRUE);
|
|
||||||
|
void
|
||||||
|
util_format_dxt1_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
|
||||||
|
{
|
||||||
|
util_format_dxt1_rgba_fetch_rgba_8unorm(dst, src, i, j);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
util_format_dxt3_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
|
||||||
|
{
|
||||||
|
util_format_dxt3_rgba_unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
util_format_dxt3_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
|
util_format_dxt3_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,
|
util_format_dxt3_rgba_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
|
||||||
width, height, UTIL_FORMAT_DXT3_RGBA,
|
}
|
||||||
16, TRUE);
|
|
||||||
|
void
|
||||||
|
util_format_dxt3_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
|
||||||
|
{
|
||||||
|
util_format_dxt3_rgba_fetch_rgba_8unorm(dst, src, i, j);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
util_format_dxt5_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
|
||||||
|
{
|
||||||
|
util_format_dxt5_rgba_unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
util_format_dxt5_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
|
util_format_dxt5_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,
|
util_format_dxt5_rgba_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
|
||||||
width, height, UTIL_FORMAT_DXT5_RGBA,
|
}
|
||||||
16, TRUE);
|
|
||||||
|
void
|
||||||
|
util_format_dxt5_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
|
||||||
|
{
|
||||||
|
util_format_dxt5_rgba_fetch_rgba_8unorm(dst, src, i, j);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
util_format_dxt1_srgb_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
|
||||||
|
{
|
||||||
|
util_format_dxt1_rgb_unpack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
util_format_dxt1_srgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
|
util_format_dxt1_srgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src_row, src_stride,
|
util_format_dxt1_rgb_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
|
||||||
width, height, UTIL_FORMAT_DXT1_RGB,
|
}
|
||||||
8, TRUE);
|
|
||||||
|
void
|
||||||
|
util_format_dxt1_srgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
|
||||||
|
{
|
||||||
|
util_format_dxt1_rgb_fetch_rgba_float(dst, src, i, j);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
util_format_dxt1_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
|
||||||
|
{
|
||||||
|
util_format_dxt1_rgba_unpack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
util_format_dxt1_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
|
util_format_dxt1_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src_row, src_stride,
|
util_format_dxt1_rgba_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
|
||||||
width, height, UTIL_FORMAT_DXT1_RGBA,
|
}
|
||||||
8, TRUE);
|
|
||||||
|
void
|
||||||
|
util_format_dxt1_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
|
||||||
|
{
|
||||||
|
util_format_dxt1_rgba_fetch_rgba_float(dst, src, i, j);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
util_format_dxt3_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
|
||||||
|
{
|
||||||
|
util_format_dxt3_rgba_unpack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
util_format_dxt3_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
|
util_format_dxt3_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src_row, src_stride,
|
util_format_dxt3_rgba_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
|
||||||
width, height, UTIL_FORMAT_DXT3_RGBA,
|
}
|
||||||
16, TRUE);
|
|
||||||
|
void
|
||||||
|
util_format_dxt3_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
|
||||||
|
{
|
||||||
|
util_format_dxt3_rgba_fetch_rgba_float(dst, src, i, j);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
util_format_dxt5_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
|
||||||
|
{
|
||||||
|
util_format_dxt5_rgba_unpack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
util_format_dxt5_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
|
util_format_dxt5_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src_row, src_stride,
|
util_format_dxt5_rgba_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
|
||||||
width, height, UTIL_FORMAT_DXT5_RGBA,
|
}
|
||||||
16, TRUE);
|
|
||||||
|
void
|
||||||
|
util_format_dxt5_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
|
||||||
|
{
|
||||||
|
util_format_dxt5_rgba_fetch_rgba_float(dst, src, i, j);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,148 @@
|
|||||||
|
/* This file is autogenerated by u_format_srgb.py. Do not edit directly. */
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright 2010 VMware, Inc.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sub license, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
* the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice (including the
|
||||||
|
* next paragraph) shall be included in all copies or substantial portions
|
||||||
|
* of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
|
||||||
|
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* SRGB translation.
|
||||||
|
*
|
||||||
|
* @author Brian Paul <brianp@vmware.com>
|
||||||
|
* @author Michal Krol <michal@vmware.com>
|
||||||
|
* @author Jose Fonseca <jfonseca@vmware.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "u_format_srgb.h"
|
||||||
|
|
||||||
|
const float
|
||||||
|
util_format_srgb_8unorm_to_linear_float_table[256] = {
|
||||||
|
0.0000000e+00, 3.0352698e-04, 6.0705397e-04, 9.1058095e-04,
|
||||||
|
1.2141079e-03, 1.5176349e-03, 1.8211619e-03, 2.1246889e-03,
|
||||||
|
2.4282159e-03, 2.7317429e-03, 3.0352698e-03, 3.3465358e-03,
|
||||||
|
3.6765073e-03, 4.0247170e-03, 4.3914420e-03, 4.7769535e-03,
|
||||||
|
5.1815167e-03, 5.6053916e-03, 6.0488330e-03, 6.5120908e-03,
|
||||||
|
6.9954102e-03, 7.4990320e-03, 8.0231930e-03, 8.5681256e-03,
|
||||||
|
9.1340587e-03, 9.7212173e-03, 1.0329823e-02, 1.0960094e-02,
|
||||||
|
1.1612245e-02, 1.2286488e-02, 1.2983032e-02, 1.3702083e-02,
|
||||||
|
1.4443844e-02, 1.5208514e-02, 1.5996293e-02, 1.6807376e-02,
|
||||||
|
1.7641954e-02, 1.8500220e-02, 1.9382361e-02, 2.0288563e-02,
|
||||||
|
2.1219010e-02, 2.2173885e-02, 2.3153366e-02, 2.4157632e-02,
|
||||||
|
2.5186860e-02, 2.6241222e-02, 2.7320892e-02, 2.8426040e-02,
|
||||||
|
2.9556834e-02, 3.0713444e-02, 3.1896033e-02, 3.3104767e-02,
|
||||||
|
3.4339807e-02, 3.5601315e-02, 3.6889450e-02, 3.8204372e-02,
|
||||||
|
3.9546235e-02, 4.0915197e-02, 4.2311411e-02, 4.3735029e-02,
|
||||||
|
4.5186204e-02, 4.6665086e-02, 4.8171824e-02, 4.9706566e-02,
|
||||||
|
5.1269458e-02, 5.2860647e-02, 5.4480276e-02, 5.6128490e-02,
|
||||||
|
5.7805430e-02, 5.9511238e-02, 6.1246054e-02, 6.3010018e-02,
|
||||||
|
6.4803267e-02, 6.6625939e-02, 6.8478170e-02, 7.0360096e-02,
|
||||||
|
7.2271851e-02, 7.4213568e-02, 7.6185381e-02, 7.8187422e-02,
|
||||||
|
8.0219820e-02, 8.2282707e-02, 8.4376212e-02, 8.6500462e-02,
|
||||||
|
8.8655586e-02, 9.0841711e-02, 9.3058963e-02, 9.5307467e-02,
|
||||||
|
9.7587347e-02, 9.9898728e-02, 1.0224173e-01, 1.0461648e-01,
|
||||||
|
1.0702310e-01, 1.0946171e-01, 1.1193243e-01, 1.1443537e-01,
|
||||||
|
1.1697067e-01, 1.1953843e-01, 1.2213877e-01, 1.2477182e-01,
|
||||||
|
1.2743768e-01, 1.3013648e-01, 1.3286832e-01, 1.3563333e-01,
|
||||||
|
1.3843162e-01, 1.4126329e-01, 1.4412847e-01, 1.4702727e-01,
|
||||||
|
1.4995979e-01, 1.5292615e-01, 1.5592646e-01, 1.5896084e-01,
|
||||||
|
1.6202938e-01, 1.6513219e-01, 1.6826940e-01, 1.7144110e-01,
|
||||||
|
1.7464740e-01, 1.7788842e-01, 1.8116424e-01, 1.8447499e-01,
|
||||||
|
1.8782077e-01, 1.9120168e-01, 1.9461783e-01, 1.9806932e-01,
|
||||||
|
2.0155625e-01, 2.0507874e-01, 2.0863687e-01, 2.1223076e-01,
|
||||||
|
2.1586050e-01, 2.1952620e-01, 2.2322796e-01, 2.2696587e-01,
|
||||||
|
2.3074005e-01, 2.3455058e-01, 2.3839757e-01, 2.4228112e-01,
|
||||||
|
2.4620133e-01, 2.5015828e-01, 2.5415209e-01, 2.5818285e-01,
|
||||||
|
2.6225066e-01, 2.6635560e-01, 2.7049779e-01, 2.7467731e-01,
|
||||||
|
2.7889426e-01, 2.8314874e-01, 2.8744084e-01, 2.9177065e-01,
|
||||||
|
2.9613827e-01, 3.0054379e-01, 3.0498731e-01, 3.0946892e-01,
|
||||||
|
3.1398871e-01, 3.1854678e-01, 3.2314321e-01, 3.2777810e-01,
|
||||||
|
3.3245154e-01, 3.3716362e-01, 3.4191442e-01, 3.4670406e-01,
|
||||||
|
3.5153260e-01, 3.5640014e-01, 3.6130678e-01, 3.6625260e-01,
|
||||||
|
3.7123768e-01, 3.7626212e-01, 3.8132601e-01, 3.8642943e-01,
|
||||||
|
3.9157248e-01, 3.9675523e-01, 4.0197778e-01, 4.0724021e-01,
|
||||||
|
4.1254261e-01, 4.1788507e-01, 4.2326767e-01, 4.2869050e-01,
|
||||||
|
4.3415364e-01, 4.3965717e-01, 4.4520119e-01, 4.5078578e-01,
|
||||||
|
4.5641102e-01, 4.6207700e-01, 4.6778380e-01, 4.7353150e-01,
|
||||||
|
4.7932018e-01, 4.8514994e-01, 4.9102085e-01, 4.9693300e-01,
|
||||||
|
5.0288646e-01, 5.0888132e-01, 5.1491767e-01, 5.2099557e-01,
|
||||||
|
5.2711513e-01, 5.3327640e-01, 5.3947949e-01, 5.4572446e-01,
|
||||||
|
5.5201140e-01, 5.5834039e-01, 5.6471151e-01, 5.7112483e-01,
|
||||||
|
5.7758044e-01, 5.8407842e-01, 5.9061884e-01, 5.9720179e-01,
|
||||||
|
6.0382734e-01, 6.1049557e-01, 6.1720656e-01, 6.2396039e-01,
|
||||||
|
6.3075714e-01, 6.3759687e-01, 6.4447968e-01, 6.5140564e-01,
|
||||||
|
6.5837482e-01, 6.6538730e-01, 6.7244316e-01, 6.7954247e-01,
|
||||||
|
6.8668531e-01, 6.9387176e-01, 7.0110189e-01, 7.0837578e-01,
|
||||||
|
7.1569350e-01, 7.2305513e-01, 7.3046074e-01, 7.3791041e-01,
|
||||||
|
7.4540421e-01, 7.5294222e-01, 7.6052450e-01, 7.6815115e-01,
|
||||||
|
7.7582222e-01, 7.8353779e-01, 7.9129794e-01, 7.9910274e-01,
|
||||||
|
8.0695226e-01, 8.1484657e-01, 8.2278575e-01, 8.3076988e-01,
|
||||||
|
8.3879901e-01, 8.4687323e-01, 8.5499261e-01, 8.6315721e-01,
|
||||||
|
8.7136712e-01, 8.7962240e-01, 8.8792312e-01, 8.9626935e-01,
|
||||||
|
9.0466117e-01, 9.1309865e-01, 9.2158186e-01, 9.3011086e-01,
|
||||||
|
9.3868573e-01, 9.4730654e-01, 9.5597335e-01, 9.6468625e-01,
|
||||||
|
9.7344529e-01, 9.8225055e-01, 9.9110210e-01, 1.0000000e+00,
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t
|
||||||
|
util_format_srgb_to_linear_8unorm_table[256] = {
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
|
1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3,
|
||||||
|
4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7,
|
||||||
|
8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13,
|
||||||
|
13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 17, 18, 18, 19, 19, 20,
|
||||||
|
20, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 27, 27, 28, 29, 29,
|
||||||
|
30, 30, 31, 32, 32, 33, 34, 35, 35, 36, 37, 37, 38, 39, 40, 41,
|
||||||
|
41, 42, 43, 44, 45, 45, 46, 47, 48, 49, 50, 51, 51, 52, 53, 54,
|
||||||
|
55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
|
||||||
|
71, 72, 73, 74, 76, 77, 78, 79, 80, 81, 82, 84, 85, 86, 87, 88,
|
||||||
|
90, 91, 92, 93, 95, 96, 97, 99, 100, 101, 103, 104, 105, 107, 108, 109,
|
||||||
|
111, 112, 114, 115, 116, 118, 119, 121, 122, 124, 125, 127, 128, 130, 131, 133,
|
||||||
|
134, 136, 138, 139, 141, 142, 144, 146, 147, 149, 151, 152, 154, 156, 157, 159,
|
||||||
|
161, 163, 164, 166, 168, 170, 171, 173, 175, 177, 179, 181, 183, 184, 186, 188,
|
||||||
|
190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220,
|
||||||
|
222, 224, 226, 229, 231, 233, 235, 237, 239, 242, 244, 246, 248, 250, 253, 255,
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t
|
||||||
|
util_format_linear_to_srgb_8unorm_table[256] = {
|
||||||
|
0, 13, 22, 28, 34, 38, 42, 46, 50, 53, 56, 59, 61, 64, 66, 69,
|
||||||
|
71, 73, 75, 77, 79, 81, 83, 85, 86, 88, 90, 92, 93, 95, 96, 98,
|
||||||
|
99, 101, 102, 104, 105, 106, 108, 109, 110, 112, 113, 114, 115, 117, 118, 119,
|
||||||
|
120, 121, 122, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
|
||||||
|
137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 148, 149, 150, 151,
|
||||||
|
152, 153, 154, 155, 155, 156, 157, 158, 159, 159, 160, 161, 162, 163, 163, 164,
|
||||||
|
165, 166, 167, 167, 168, 169, 170, 170, 171, 172, 173, 173, 174, 175, 175, 176,
|
||||||
|
177, 178, 178, 179, 180, 180, 181, 182, 182, 183, 184, 185, 185, 186, 187, 187,
|
||||||
|
188, 189, 189, 190, 190, 191, 192, 192, 193, 194, 194, 195, 196, 196, 197, 197,
|
||||||
|
198, 199, 199, 200, 200, 201, 202, 202, 203, 203, 204, 205, 205, 206, 206, 207,
|
||||||
|
208, 208, 209, 209, 210, 210, 211, 212, 212, 213, 213, 214, 214, 215, 215, 216,
|
||||||
|
216, 217, 218, 218, 219, 219, 220, 220, 221, 221, 222, 222, 223, 223, 224, 224,
|
||||||
|
225, 226, 226, 227, 227, 228, 228, 229, 229, 230, 230, 231, 231, 232, 232, 233,
|
||||||
|
233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 238, 238, 239, 239, 240, 240,
|
||||||
|
241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, 246, 247, 247, 248,
|
||||||
|
248, 249, 249, 250, 250, 251, 251, 251, 252, 252, 253, 253, 254, 254, 255, 255,
|
||||||
|
};
|
||||||
|
|
28411
contrib/sdk/sources/Mesa/src/gallium/auxiliary/util/u_format_table.c
Normal file
28411
contrib/sdk/sources/Mesa/src/gallium/auxiliary/util/u_format_table.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,8 +1,8 @@
|
|||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
*
|
*
|
||||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||||
* All Rights Reserved.
|
* All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the
|
* copy of this software and associated documentation files (the
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* "Software"), to deal in the Software without restriction, including
|
||||||
@ -10,11 +10,11 @@
|
|||||||
* distribute, sub license, and/or sell copies of the Software, and to
|
* distribute, sub license, and/or sell copies of the Software, and to
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
* permit persons to whom the Software is furnished to do so, subject to
|
||||||
* the following conditions:
|
* the following conditions:
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice (including the
|
* The above copyright notice and this permission notice (including the
|
||||||
* next paragraph) shall be included in all copies or substantial portions
|
* next paragraph) shall be included in all copies or substantial portions
|
||||||
* of the Software.
|
* of the Software.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||||
@ -22,7 +22,7 @@
|
|||||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*
|
*
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
@ -60,46 +60,46 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
|
|
||||||
#if _MSC_VER < 1400 && !defined(__cplusplus)
|
#if _MSC_VER < 1400 && !defined(__cplusplus)
|
||||||
|
|
||||||
static INLINE float cosf( float f )
|
static INLINE float cosf( float f )
|
||||||
{
|
{
|
||||||
return (float) cos( (double) f );
|
return (float) cos( (double) f );
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE float sinf( float f )
|
static INLINE float sinf( float f )
|
||||||
{
|
{
|
||||||
return (float) sin( (double) f );
|
return (float) sin( (double) f );
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE float ceilf( float f )
|
static INLINE float ceilf( float f )
|
||||||
{
|
{
|
||||||
return (float) ceil( (double) f );
|
return (float) ceil( (double) f );
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE float floorf( float f )
|
static INLINE float floorf( float f )
|
||||||
{
|
{
|
||||||
return (float) floor( (double) f );
|
return (float) floor( (double) f );
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE float powf( float f, float g )
|
static INLINE float powf( float f, float g )
|
||||||
{
|
{
|
||||||
return (float) pow( (double) f, (double) g );
|
return (float) pow( (double) f, (double) g );
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE float sqrtf( float f )
|
static INLINE float sqrtf( float f )
|
||||||
{
|
{
|
||||||
return (float) sqrt( (double) f );
|
return (float) sqrt( (double) f );
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE float fabsf( float f )
|
static INLINE float fabsf( float f )
|
||||||
{
|
{
|
||||||
return (float) fabs( (double) f );
|
return (float) fabs( (double) f );
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE float logf( float f )
|
static INLINE float logf( float f )
|
||||||
{
|
{
|
||||||
return (float) log( (double) f );
|
return (float) log( (double) f );
|
||||||
}
|
}
|
||||||
@ -300,7 +300,7 @@ util_ifloor(float f)
|
|||||||
static INLINE int
|
static INLINE int
|
||||||
util_iround(float f)
|
util_iround(float f)
|
||||||
{
|
{
|
||||||
#if defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86)
|
#if defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86)
|
||||||
int r;
|
int r;
|
||||||
__asm__ ("fistpl %0" : "=m" (r) : "t" (f) : "st");
|
__asm__ ("fistpl %0" : "=m" (r) : "t" (f) : "st");
|
||||||
return r;
|
return r;
|
||||||
@ -442,37 +442,7 @@ util_half_inf_sign(int16_t x)
|
|||||||
#ifndef FFS_DEFINED
|
#ifndef FFS_DEFINED
|
||||||
#define FFS_DEFINED 1
|
#define FFS_DEFINED 1
|
||||||
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER >= 1300 && (_M_IX86 || _M_AMD64 || _M_IA64)
|
|
||||||
unsigned char _BitScanForward(unsigned long* Index, unsigned long Mask);
|
|
||||||
#pragma intrinsic(_BitScanForward)
|
|
||||||
static INLINE
|
|
||||||
unsigned long ffs( unsigned long u )
|
|
||||||
{
|
|
||||||
unsigned long i;
|
|
||||||
if (_BitScanForward(&i, u))
|
|
||||||
return i + 1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#elif defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)
|
|
||||||
static INLINE
|
|
||||||
unsigned ffs( unsigned u )
|
|
||||||
{
|
|
||||||
unsigned i;
|
|
||||||
|
|
||||||
if (u == 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
__asm bsf eax, [u]
|
|
||||||
__asm inc eax
|
|
||||||
__asm mov [i], eax
|
|
||||||
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
#elif defined(__MINGW32__) || defined(PIPE_OS_ANDROID)
|
|
||||||
#define ffs __builtin_ffs
|
#define ffs __builtin_ffs
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* FFS_DEFINED */
|
#endif /* FFS_DEFINED */
|
||||||
|
|
||||||
@ -501,7 +471,7 @@ static INLINE unsigned util_last_bit(unsigned u)
|
|||||||
* int i = u_bit_scan(&mymask);
|
* int i = u_bit_scan(&mymask);
|
||||||
* ... process element i
|
* ... process element i
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static INLINE int u_bit_scan(unsigned *mask)
|
static INLINE int u_bit_scan(unsigned *mask)
|
||||||
{
|
{
|
||||||
|
@ -41,8 +41,8 @@ void
|
|||||||
ilo_cp_dump(struct ilo_cp *cp)
|
ilo_cp_dump(struct ilo_cp *cp)
|
||||||
{
|
{
|
||||||
ilo_printf("dumping %d bytes\n", cp->used * 4);
|
ilo_printf("dumping %d bytes\n", cp->used * 4);
|
||||||
if (cp->used)
|
// if (cp->used)
|
||||||
intel_winsys_decode_commands(cp->winsys, cp->bo, cp->used * 4);
|
// intel_winsys_decode_commands(cp->winsys, cp->bo, cp->used * 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -151,7 +151,7 @@ get_st_manager(void)
|
|||||||
stmgr->screen = osmesa_create_screen();
|
stmgr->screen = osmesa_create_screen();
|
||||||
stmgr->get_param = osmesa_st_get_param;
|
stmgr->get_param = osmesa_st_get_param;
|
||||||
stmgr->get_egl_image = NULL;
|
stmgr->get_egl_image = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return stmgr;
|
return stmgr;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
struct pipe_screen *
|
struct pipe_screen *
|
||||||
osmesa_create_screen(void);
|
osmesa_create_screen(void);
|
||||||
|
|
||||||
|
|
||||||
struct pipe_screen *
|
struct pipe_screen *
|
||||||
osmesa_create_screen(void)
|
osmesa_create_screen(void)
|
||||||
|
@ -64,7 +64,8 @@ get_param(struct intel_winsys *winsys, int param, int *value)
|
|||||||
gp.param = param;
|
gp.param = param;
|
||||||
gp.value = value;
|
gp.value = value;
|
||||||
|
|
||||||
err = drmCommandWriteRead(winsys->fd, DRM_I915_GETPARAM, &gp, sizeof(gp));
|
err = drmIoctl(winsys->fd, DRM_I915_GETPARAM, &gp);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
*value = 0;
|
*value = 0;
|
||||||
return false;
|
return false;
|
||||||
@ -151,8 +152,8 @@ intel_winsys_create_for_fd(int fd)
|
|||||||
void
|
void
|
||||||
intel_winsys_destroy(struct intel_winsys *winsys)
|
intel_winsys_destroy(struct intel_winsys *winsys)
|
||||||
{
|
{
|
||||||
if (winsys->decode)
|
// if (winsys->decode)
|
||||||
drm_intel_decode_context_free(winsys->decode);
|
// drm_intel_decode_context_free(winsys->decode);
|
||||||
|
|
||||||
drm_intel_bufmgr_destroy(winsys->bufmgr);
|
drm_intel_bufmgr_destroy(winsys->bufmgr);
|
||||||
FREE(winsys);
|
FREE(winsys);
|
||||||
@ -341,6 +342,7 @@ intel_winsys_check_aperture_space(struct intel_winsys *winsys,
|
|||||||
count);
|
count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
void
|
void
|
||||||
intel_winsys_decode_commands(struct intel_winsys *winsys,
|
intel_winsys_decode_commands(struct intel_winsys *winsys,
|
||||||
struct intel_bo *bo, int used)
|
struct intel_bo *bo, int used)
|
||||||
@ -372,6 +374,7 @@ intel_winsys_decode_commands(struct intel_winsys *winsys,
|
|||||||
|
|
||||||
intel_bo_unmap(bo);
|
intel_bo_unmap(bo);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
intel_bo_reference(struct intel_bo *bo)
|
intel_bo_reference(struct intel_bo *bo)
|
||||||
|
@ -26,9 +26,6 @@ MESA_DEFS+= -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDI
|
|||||||
MAIN_SRC = \
|
MAIN_SRC = \
|
||||||
drivers/common/driverfuncs.c \
|
drivers/common/driverfuncs.c \
|
||||||
drivers/common/meta.c \
|
drivers/common/meta.c \
|
||||||
drivers/dri/common/dri_util.c \
|
|
||||||
drivers/dri/common/utils.c \
|
|
||||||
drivers/dri/common/xmlconfig.c \
|
|
||||||
main/accum.c \
|
main/accum.c \
|
||||||
main/api_arrayelt.c \
|
main/api_arrayelt.c \
|
||||||
main/api_exec.c \
|
main/api_exec.c \
|
||||||
@ -244,7 +241,13 @@ MAIN_SRC = \
|
|||||||
x86/x86_xform4.S \
|
x86/x86_xform4.S \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
OSMESA_SRC = \
|
||||||
|
drivers/osmesa/osmesa.c
|
||||||
|
|
||||||
I965_SRC = \
|
I965_SRC = \
|
||||||
|
drivers/dri/common/dri_util.c \
|
||||||
|
drivers/dri/common/utils.c \
|
||||||
|
drivers/dri/common/xmlconfig.c \
|
||||||
drivers/dri/i965/intel_batchbuffer.c \
|
drivers/dri/i965/intel_batchbuffer.c \
|
||||||
drivers/dri/i965/intel_blit.c \
|
drivers/dri/i965/intel_blit.c \
|
||||||
drivers/dri/i965/intel_buffer_objects.c \
|
drivers/dri/i965/intel_buffer_objects.c \
|
||||||
@ -369,17 +372,23 @@ I965_SRC = \
|
|||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
MESA_OBJS = $(patsubst %.c, %.o, $(patsubst %.S, %.o, $(patsubst %.cpp, %.o, $(MAIN_SRC))))
|
MESA_OBJS = $(patsubst %.c, %.o, $(patsubst %.S, %.o, $(patsubst %.cpp, %.o, $(MAIN_SRC))))
|
||||||
|
OSMESA_OBJS = $(patsubst %.c, %.o, $(patsubst %.cpp, %.o, $(OSMESA_SRC)))
|
||||||
I965_OBJS = $(patsubst %.c, %.o, $(patsubst %.cpp, %.o, $(I965_SRC)))
|
I965_OBJS = $(patsubst %.c, %.o, $(patsubst %.cpp, %.o, $(I965_SRC)))
|
||||||
|
|
||||||
# targets
|
# targets
|
||||||
|
|
||||||
all: i965_dri.drv
|
all: osmesa.dll i965_dri.drv
|
||||||
|
|
||||||
i965_dri.drv: $(I965_OBJS) $(MESA_OBJS) dri.def Makefile
|
i965_dri.drv: $(I965_OBJS) $(MESA_OBJS) dri.def Makefile
|
||||||
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $(I965_OBJS) $(MESA_OBJS) dri.def $(LIBS)
|
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $(I965_OBJS) $(MESA_OBJS) dri.def $(LIBS)
|
||||||
# $(STRIP) $@
|
# $(STRIP) $@
|
||||||
mv -f $@ $(SDK_DIR)/bin
|
mv -f $@ $(SDK_DIR)/bin
|
||||||
|
|
||||||
|
osmesa.dll: $(MESA_OBJS) $(OSMESA_OBJS) osmesa.def Makefile
|
||||||
|
$(LD) $(LDFLAGS) $(LIBPATH) --out-implib libosmesa.dll.a -o $@ $(MESA_OBJS) $(OSMESA_OBJS) osmesa.def $(LIBS)
|
||||||
|
mv -f libosmesa.dll.a $(SDK_DIR)/lib
|
||||||
|
mv -f $@ $(SDK_DIR)/bin
|
||||||
|
|
||||||
%.o : %.c Makefile
|
%.o : %.c Makefile
|
||||||
$(CC) $(CFLAGS) -std=c99 $(MESA_DEFS) $(INC_MESA) $(INC_I965) -o $@ $<
|
$(CC) $(CFLAGS) -std=c99 $(MESA_DEFS) $(INC_MESA) $(INC_I965) -o $@ $<
|
||||||
|
|
||||||
|
16
contrib/sdk/sources/Mesa/src/mesa/osmesa.def
Normal file
16
contrib/sdk/sources/Mesa/src/mesa/osmesa.def
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
;DESCRIPTION 'Mesa OSMesa lib for Win32'
|
||||||
|
VERSION 4.1
|
||||||
|
|
||||||
|
EXPORTS
|
||||||
|
DllStartup
|
||||||
|
OSMesaColorClamp
|
||||||
|
OSMesaCreateContext
|
||||||
|
OSMesaCreateContextExt
|
||||||
|
OSMesaDestroyContext
|
||||||
|
OSMesaMakeCurrent
|
||||||
|
OSMesaGetCurrentContext
|
||||||
|
OSMesaPixelStore
|
||||||
|
OSMesaGetIntegerv
|
||||||
|
OSMesaGetDepthBuffer
|
||||||
|
OSMesaGetColorBuffer
|
||||||
|
OSMesaGetProcAddress
|
@ -1,8 +1,8 @@
|
|||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
*
|
*
|
||||||
* Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
|
* Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||||
* All Rights Reserved.
|
* All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the
|
* copy of this software and associated documentation files (the
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* "Software"), to deal in the Software without restriction, including
|
||||||
@ -10,11 +10,11 @@
|
|||||||
* distribute, sub license, and/or sell copies of the Software, and to
|
* distribute, sub license, and/or sell copies of the Software, and to
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
* permit persons to whom the Software is furnished to do so, subject to
|
||||||
* the following conditions:
|
* the following conditions:
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice (including the
|
* The above copyright notice and this permission notice (including the
|
||||||
* next paragraph) shall be included in all copies or substantial portions
|
* next paragraph) shall be included in all copies or substantial portions
|
||||||
* of the Software.
|
* of the Software.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||||
@ -22,7 +22,7 @@
|
|||||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*
|
*
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "main/imports.h"
|
#include "main/imports.h"
|
||||||
@ -108,7 +108,7 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
|
|||||||
struct pipe_screen *screen = pipe->screen;
|
struct pipe_screen *screen = pipe->screen;
|
||||||
uint i;
|
uint i;
|
||||||
struct st_context *st = ST_CALLOC_STRUCT( st_context );
|
struct st_context *st = ST_CALLOC_STRUCT( st_context );
|
||||||
|
|
||||||
st->options = *options;
|
st->options = *options;
|
||||||
|
|
||||||
ctx->st = st;
|
ctx->st = st;
|
||||||
@ -118,7 +118,7 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
|
|||||||
|
|
||||||
/* XXX: this is one-off, per-screen init: */
|
/* XXX: this is one-off, per-screen init: */
|
||||||
st_debug_init();
|
st_debug_init();
|
||||||
|
|
||||||
/* state tracker needs the VBO module */
|
/* state tracker needs the VBO module */
|
||||||
_vbo_CreateContext(ctx);
|
_vbo_CreateContext(ctx);
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ static void st_destroy_context_priv( struct st_context *st )
|
|||||||
free( st );
|
free( st );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void st_destroy_context( struct st_context *st )
|
void st_destroy_context( struct st_context *st )
|
||||||
{
|
{
|
||||||
struct pipe_context *pipe = st->pipe;
|
struct pipe_context *pipe = st->pipe;
|
||||||
|
@ -547,7 +547,7 @@ st_context_teximage(struct st_context_iface *stctxi,
|
|||||||
|
|
||||||
_mesa_dirty_texobj(ctx, texObj, GL_TRUE);
|
_mesa_dirty_texobj(ctx, texObj, GL_TRUE);
|
||||||
_mesa_unlock_texture(ctx, texObj);
|
_mesa_unlock_texture(ctx, texObj);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -629,8 +629,9 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
|
|||||||
if (attribs->flags & ST_CONTEXT_FLAG_DEBUG)
|
if (attribs->flags & ST_CONTEXT_FLAG_DEBUG)
|
||||||
st->ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_DEBUG_BIT;
|
st->ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_DEBUG_BIT;
|
||||||
if (attribs->flags & ST_CONTEXT_FLAG_FORWARD_COMPATIBLE)
|
if (attribs->flags & ST_CONTEXT_FLAG_FORWARD_COMPATIBLE)
|
||||||
st->ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT;
|
st->ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT;
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* need to perform version check */
|
/* need to perform version check */
|
||||||
if (attribs->major > 1 || attribs->minor > 0) {
|
if (attribs->major > 1 || attribs->minor > 0) {
|
||||||
/* Is the actual version less than the requested version?
|
/* Is the actual version less than the requested version?
|
||||||
@ -641,6 +642,7 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
st->invalidate_on_gl_viewport =
|
st->invalidate_on_gl_viewport =
|
||||||
smapi->get_param(smapi, ST_MANAGER_BROKEN_INVALIDATE);
|
smapi->get_param(smapi, ST_MANAGER_BROKEN_INVALIDATE);
|
||||||
|
@ -254,13 +254,7 @@
|
|||||||
#endif /* GNU_ASSEMBLER */
|
#endif /* GNU_ASSEMBLER */
|
||||||
#endif /* ACK_ASSEMBLER */
|
#endif /* ACK_ASSEMBLER */
|
||||||
|
|
||||||
|
#define GLNAME(a) CONCAT(_,a)
|
||||||
#if defined(__QNX__) || defined(Lynx) || (defined(SYSV) || defined(SVR4)) && !defined(ACK_ASSEMBLER) || defined(__ELF__) || defined(__GNU__) || defined(__GNUC__) && !defined(__DJGPP__) && !defined(__MINGW32__)
|
|
||||||
#define GLNAME(a) a
|
|
||||||
#else
|
|
||||||
#define GLNAME(a) CONCAT(_,a)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************/
|
/****************************************/
|
||||||
/* */
|
/* */
|
||||||
@ -983,14 +977,7 @@ SECTION _DATA public align=16 class=DATA use32 flat
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Lynx) || (defined(SYSV) || defined(SVR4)) \
|
|
||||||
|| (defined(__linux__) || defined(__OS2ELF__)) && defined(__ELF__) \
|
|
||||||
|| (defined(__FreeBSD__) && __FreeBSD__ >= 3) \
|
|
||||||
|| (defined(__NetBSD__) && defined(__ELF__))
|
|
||||||
#define GLNAME(a) a
|
|
||||||
#else
|
|
||||||
#define GLNAME(a) CONCAT(_, a)
|
#define GLNAME(a) CONCAT(_, a)
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Addressing Modes
|
* Addressing Modes
|
||||||
@ -1734,16 +1721,8 @@ SECTION _DATA public align=16 class=DATA use32 flat
|
|||||||
/* Hidden symbol visibility support.
|
/* Hidden symbol visibility support.
|
||||||
* If we build with gcc's -fvisibility=hidden flag, we'll need to change
|
* If we build with gcc's -fvisibility=hidden flag, we'll need to change
|
||||||
* the symbol visibility mode to 'default'.
|
* the symbol visibility mode to 'default'.
|
||||||
#if defined(GNU_ASSEMBLER) && !defined(__DJGPP__) && !defined(__MINGW32__) && !defined(__APPLE__)
|
|
||||||
# define HIDDEN(x) .hidden x
|
|
||||||
#elif defined(__GNUC__) && !defined(__DJGPP__) && !defined(__MINGW32__) && !defined(__APPLE__)
|
|
||||||
# pragma GCC visibility push(default)
|
|
||||||
# define HIDDEN(x) .hidden x
|
|
||||||
#else
|
|
||||||
# define HIDDEN(x)
|
|
||||||
#endif
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
# define HIDDEN(x)
|
#define HIDDEN(x)
|
||||||
|
|
||||||
#endif /* __ASSYNTAX_H__ */
|
#endif /* __ASSYNTAX_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user