revert __APPLE__ macro replacement
This commit is contained in:
+1
-1
@@ -17150,7 +17150,7 @@ class basic_json
|
||||
result["platform"] = "win32";
|
||||
#elif defined __linux__
|
||||
result["platform"] = "linux";
|
||||
#elif defined SDL_PLATFORM_APPLE
|
||||
#elif defined __APPLE__
|
||||
result["platform"] = "apple";
|
||||
#elif defined __unix__
|
||||
result["platform"] = "unix";
|
||||
|
||||
+2
-2
@@ -1424,7 +1424,7 @@ class TinyGLTF {
|
||||
bool preserve_image_channels_ = false; /// Default false(expand channels to
|
||||
/// RGBA) for backward compatibility.
|
||||
|
||||
// Warning & error messages
|
||||
// Warning & error messages
|
||||
std::string warn_;
|
||||
std::string err_;
|
||||
|
||||
@@ -1701,7 +1701,7 @@ void JsonParse(JsonDocument &doc, const char *str, size_t length,
|
||||
}
|
||||
} // namespace
|
||||
|
||||
#ifdef SDL_PLATFORM_APPLE
|
||||
#ifdef __APPLE__
|
||||
#include "TargetConditionals.h"
|
||||
#endif
|
||||
|
||||
|
||||
+1
-1
@@ -465,7 +465,7 @@
|
||||
#define ufbxi_read_u8(ptr) (*(const uint8_t*)(ptr))
|
||||
|
||||
// Detect support for `__attribute__((aligned(1)))`
|
||||
#if !defined(UFBX_STANDARD_C) && (defined(__clang__) && defined(SDL_PLATFORM_APPLE))
|
||||
#if !defined(UFBX_STANDARD_C) && (defined(__clang__) && defined(__APPLE__))
|
||||
// Apple overrides Clang versioning, 5.0 here maps to 3.3
|
||||
#if __clang_major__ >= 5
|
||||
#define UFBXI_HAS_ATTRIBUTE_ALIGNED 1
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
#define JPH_PLATFORM_LINUX
|
||||
#elif defined(__FreeBSD__)
|
||||
#define JPH_PLATFORM_FREEBSD
|
||||
#elif defined(SDL_PLATFORM_APPLE)
|
||||
#elif defined(__APPLE__)
|
||||
#include <TargetConditionals.h>
|
||||
#if defined(TARGET_OS_IPHONE) && !TARGET_OS_IPHONE
|
||||
#define JPH_PLATFORM_MACOS
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
// C4514/4820: Off by default noise
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#ifndef SDL_PLATFORM_APPLE
|
||||
#ifndef __APPLE__
|
||||
# include <malloc.h>
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#if defined(_WIN32)
|
||||
# define BUILD_PLATFORM_WIN 1
|
||||
#elif defined(SDL_PLATFORM_APPLE)
|
||||
#elif defined(__APPLE__)
|
||||
# include "TargetConditionals.h"
|
||||
# if defined(TARGET_OS_IPHONE)
|
||||
# define BUILD_PLATFORM_IOS 1
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace basisu
|
||||
|
||||
// This is a Public Domain 8x8 font from here:
|
||||
// https://github.com/dhepper/font8x8/blob/master/font8x8_basic.h
|
||||
const uint8_t g_debug_font8x8_basic[127 - 32 + 1][8] =
|
||||
const uint8_t g_debug_font8x8_basic[127 - 32 + 1][8] =
|
||||
{
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0020 ( )
|
||||
{ 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00}, // U+0021 (!)
|
||||
@@ -203,7 +203,7 @@ namespace basisu
|
||||
{
|
||||
char buf[8192];
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _WIN32
|
||||
vsprintf_s(buf, sizeof(buf), pFmt, args);
|
||||
#else
|
||||
vsnprintf(buf, sizeof(buf), pFmt, args);
|
||||
@@ -229,7 +229,7 @@ namespace basisu
|
||||
{
|
||||
QueryPerformanceFrequency(reinterpret_cast<LARGE_INTEGER*>(pTicks));
|
||||
}
|
||||
#elif defined(SDL_PLATFORM_APPLE) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__EMSCRIPTEN__)
|
||||
#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__EMSCRIPTEN__)
|
||||
#include <sys/time.h>
|
||||
inline void query_counter(timer_ticks* pTicks)
|
||||
{
|
||||
@@ -256,7 +256,7 @@ namespace basisu
|
||||
#else
|
||||
#error TODO
|
||||
#endif
|
||||
|
||||
|
||||
interval_timer::interval_timer() : m_start_time(0), m_stop_time(0), m_started(false), m_stopped(false)
|
||||
{
|
||||
if (!g_timer_freq)
|
||||
@@ -290,7 +290,7 @@ namespace basisu
|
||||
timer_ticks delta = stop_time - m_start_time;
|
||||
return delta * g_timer_freq;
|
||||
}
|
||||
|
||||
|
||||
void interval_timer::init()
|
||||
{
|
||||
if (!g_timer_freq)
|
||||
@@ -316,21 +316,21 @@ namespace basisu
|
||||
init();
|
||||
return ticks * g_timer_freq;
|
||||
}
|
||||
|
||||
|
||||
const uint32_t MAX_32BIT_ALLOC_SIZE = 250000000;
|
||||
|
||||
|
||||
bool load_tga(const char* pFilename, image& img)
|
||||
{
|
||||
int w = 0, h = 0, n_chans = 0;
|
||||
uint8_t* pImage_data = read_tga(pFilename, w, h, n_chans);
|
||||
|
||||
|
||||
if ((!pImage_data) || (!w) || (!h) || ((n_chans != 3) && (n_chans != 4)))
|
||||
{
|
||||
error_printf("Failed loading .TGA image \"%s\"!\n", pFilename);
|
||||
|
||||
if (pImage_data)
|
||||
free(pImage_data);
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -346,7 +346,7 @@ namespace basisu
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
img.resize(w, h);
|
||||
|
||||
const uint8_t *pSrc = pImage_data;
|
||||
@@ -375,7 +375,7 @@ namespace basisu
|
||||
{
|
||||
interval_timer tm;
|
||||
tm.start();
|
||||
|
||||
|
||||
if (!buf_size)
|
||||
return false;
|
||||
|
||||
@@ -393,7 +393,7 @@ namespace basisu
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool load_png(const char* pFilename, image& img)
|
||||
{
|
||||
uint8_vec buffer;
|
||||
@@ -412,9 +412,9 @@ namespace basisu
|
||||
uint8_t *pImage_data = jpgd::decompress_jpeg_image_from_file(pFilename, &width, &height, &actual_comps, 4, jpgd::jpeg_decoder::cFlagLinearChromaFiltering);
|
||||
if (!pImage_data)
|
||||
return false;
|
||||
|
||||
|
||||
img.init(pImage_data, width, height, 4);
|
||||
|
||||
|
||||
free(pImage_data);
|
||||
|
||||
return true;
|
||||
@@ -438,12 +438,12 @@ namespace basisu
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool save_png(const char* pFilename, const image &img, uint32_t image_save_flags, uint32_t grayscale_comp)
|
||||
{
|
||||
if (!img.get_total_pixels())
|
||||
return false;
|
||||
|
||||
|
||||
void* pPNG_data = nullptr;
|
||||
size_t PNG_data_size = 0;
|
||||
|
||||
@@ -461,7 +461,7 @@ namespace basisu
|
||||
else
|
||||
{
|
||||
bool has_alpha = false;
|
||||
|
||||
|
||||
if ((image_save_flags & cImageSaveIgnoreAlpha) == 0)
|
||||
has_alpha = img.has_alpha();
|
||||
|
||||
@@ -478,7 +478,7 @@ namespace basisu
|
||||
pDst[0] = pSrc->r;
|
||||
pDst[1] = pSrc->g;
|
||||
pDst[2] = pSrc->b;
|
||||
|
||||
|
||||
pSrc++;
|
||||
pDst += 3;
|
||||
}
|
||||
@@ -502,10 +502,10 @@ namespace basisu
|
||||
}
|
||||
|
||||
free(pPNG_data);
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
bool read_file_to_vec(const char* pFilename, uint8_vec& data)
|
||||
{
|
||||
FILE* pFile = nullptr;
|
||||
@@ -516,7 +516,7 @@ namespace basisu
|
||||
#endif
|
||||
if (!pFile)
|
||||
return false;
|
||||
|
||||
|
||||
fseek(pFile, 0, SEEK_END);
|
||||
#ifdef _WIN32
|
||||
int64_t filesize = _ftelli64(pFile);
|
||||
@@ -601,17 +601,17 @@ namespace basisu
|
||||
}
|
||||
|
||||
bool image_resample(const image &src, image &dst, bool srgb,
|
||||
const char *pFilter, float filter_scale,
|
||||
const char *pFilter, float filter_scale,
|
||||
bool wrapping,
|
||||
uint32_t first_comp, uint32_t num_comps)
|
||||
{
|
||||
assert((first_comp + num_comps) <= 4);
|
||||
|
||||
const int cMaxComps = 4;
|
||||
|
||||
|
||||
const uint32_t src_w = src.get_width(), src_h = src.get_height();
|
||||
const uint32_t dst_w = dst.get_width(), dst_h = dst.get_height();
|
||||
|
||||
|
||||
if (maximum(src_w, src_h) > BASISU_RESAMPLER_MAX_DIMENSION)
|
||||
{
|
||||
printf("Image is too large!\n");
|
||||
@@ -620,10 +620,10 @@ namespace basisu
|
||||
|
||||
if (!src_w || !src_h || !dst_w || !dst_h)
|
||||
return false;
|
||||
|
||||
|
||||
if ((num_comps < 1) || (num_comps > cMaxComps))
|
||||
return false;
|
||||
|
||||
|
||||
if ((minimum(dst_w, dst_h) < 1) || (maximum(dst_w, dst_h) > BASISU_RESAMPLER_MAX_DIMENSION))
|
||||
{
|
||||
printf("Image is too large!\n");
|
||||
@@ -654,7 +654,7 @@ namespace basisu
|
||||
|
||||
std::vector<float> samples[cMaxComps];
|
||||
Resampler *resamplers[cMaxComps];
|
||||
|
||||
|
||||
resamplers[0] = new Resampler(src_w, src_h, dst_w, dst_h,
|
||||
wrapping ? Resampler::BOUNDARY_WRAP : Resampler::BOUNDARY_CLAMP, 0.0f, 1.0f,
|
||||
pFilter, nullptr, nullptr, filter_scale, filter_scale, 0, 0);
|
||||
@@ -714,7 +714,7 @@ namespace basisu
|
||||
break;
|
||||
|
||||
const bool linear_flag = !srgb || (comp_index == 3);
|
||||
|
||||
|
||||
color_rgba *pDst = &dst(0, dst_y);
|
||||
|
||||
for (uint32_t x = 0; x < dst_w; x++)
|
||||
@@ -758,9 +758,9 @@ namespace basisu
|
||||
A[0].m_key = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
A[0].m_key += A[1].m_key;
|
||||
|
||||
|
||||
int s = 2, r = 0, next;
|
||||
for (next = 1; next < (num_syms - 1); ++next)
|
||||
{
|
||||
@@ -852,7 +852,7 @@ namespace basisu
|
||||
for (i = 0; i < num_syms; i++)
|
||||
{
|
||||
uint32_t freq = pSyms0[i].m_key;
|
||||
|
||||
|
||||
// We scale all input frequencies to 16-bits.
|
||||
assert(freq <= UINT16_MAX);
|
||||
|
||||
@@ -1043,7 +1043,7 @@ namespace basisu
|
||||
|
||||
uint32_t total_used = tab.get_total_used_codes();
|
||||
put_bits(total_used, cHuffmanMaxSymsLog2);
|
||||
|
||||
|
||||
if (!total_used)
|
||||
return 0;
|
||||
|
||||
@@ -1107,7 +1107,7 @@ namespace basisu
|
||||
const uint32_t l = syms[i] & 63, e = syms[i] >> 6;
|
||||
|
||||
put_code(l, ct);
|
||||
|
||||
|
||||
if (l == cHuffmanSmallZeroRunCode)
|
||||
put_bits(e, cHuffmanSmallZeroRunExtraBits);
|
||||
else if (l == cHuffmanBigZeroRunCode)
|
||||
@@ -1134,7 +1134,7 @@ namespace basisu
|
||||
|
||||
huffman_encoding_table etab;
|
||||
etab.init(h, 16);
|
||||
|
||||
|
||||
{
|
||||
bitwise_coder c;
|
||||
c.init(1024);
|
||||
@@ -1269,9 +1269,9 @@ namespace basisu
|
||||
|
||||
// We now have chosen an entry to place in the picked list, now determine which side it goes on.
|
||||
const uint32_t entry_to_move = m_entries_to_do[best_entry];
|
||||
|
||||
|
||||
float side = pick_side(num_syms, entry_to_move, pDist_func, pCtx, dist_func_weight);
|
||||
|
||||
|
||||
// Put entry_to_move either on the "left" or "right" side of the picked entries
|
||||
if (side <= 0)
|
||||
m_entries_picked.push_back(entry_to_move);
|
||||
@@ -1451,7 +1451,7 @@ namespace basisu
|
||||
|
||||
uint32_t hash_hsieh(const uint8_t *pBuf, size_t len)
|
||||
{
|
||||
if (!pBuf || !len)
|
||||
if (!pBuf || !len)
|
||||
return 0;
|
||||
|
||||
uint32_t h = static_cast<uint32_t>(len);
|
||||
@@ -1464,23 +1464,23 @@ namespace basisu
|
||||
const uint16_t *pWords = reinterpret_cast<const uint16_t *>(pBuf);
|
||||
|
||||
h += pWords[0];
|
||||
|
||||
|
||||
const uint32_t t = (pWords[1] << 11) ^ h;
|
||||
h = (h << 16) ^ t;
|
||||
|
||||
|
||||
pBuf += sizeof(uint32_t);
|
||||
|
||||
|
||||
h += h >> 11;
|
||||
}
|
||||
|
||||
switch (bytes_left)
|
||||
{
|
||||
case 1:
|
||||
case 1:
|
||||
h += *reinterpret_cast<const signed char*>(pBuf);
|
||||
h ^= h << 10;
|
||||
h += h >> 1;
|
||||
break;
|
||||
case 2:
|
||||
case 2:
|
||||
h += *reinterpret_cast<const uint16_t *>(pBuf);
|
||||
h ^= h << 11;
|
||||
h += h >> 17;
|
||||
@@ -1494,7 +1494,7 @@ namespace basisu
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
h ^= h << 3;
|
||||
h += h >> 5;
|
||||
h ^= h << 4;
|
||||
@@ -1505,7 +1505,7 @@ namespace basisu
|
||||
return h;
|
||||
}
|
||||
|
||||
job_pool::job_pool(uint32_t num_threads) :
|
||||
job_pool::job_pool(uint32_t num_threads) :
|
||||
m_num_active_jobs(0),
|
||||
m_kill_flag(false)
|
||||
{
|
||||
@@ -1525,17 +1525,17 @@ namespace basisu
|
||||
job_pool::~job_pool()
|
||||
{
|
||||
debug_printf("job_pool::~job_pool\n");
|
||||
|
||||
|
||||
// Notify all workers that they need to die right now.
|
||||
m_kill_flag = true;
|
||||
|
||||
|
||||
m_has_work.notify_all();
|
||||
|
||||
// Wait for all workers to die.
|
||||
for (uint32_t i = 0; i < m_threads.size(); i++)
|
||||
m_threads[i].join();
|
||||
}
|
||||
|
||||
|
||||
void job_pool::add_job(const std::function<void()>& job)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
@@ -1555,7 +1555,7 @@ namespace basisu
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
|
||||
m_queue.emplace_back(std::move(job));
|
||||
|
||||
|
||||
const size_t queue_size = m_queue.size();
|
||||
|
||||
lock.unlock();
|
||||
@@ -1591,7 +1591,7 @@ namespace basisu
|
||||
{
|
||||
BASISU_NOTE_UNUSED(index);
|
||||
//debug_printf("job_pool::job_thread: starting %u\n", index);
|
||||
|
||||
|
||||
while (true)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
@@ -1617,9 +1617,9 @@ namespace basisu
|
||||
|
||||
--m_num_active_jobs;
|
||||
|
||||
// Now check if there are no more jobs remaining.
|
||||
// Now check if there are no more jobs remaining.
|
||||
const bool all_done = m_queue.empty() && !m_num_active_jobs;
|
||||
|
||||
|
||||
lock.unlock();
|
||||
|
||||
if (all_done)
|
||||
@@ -1678,7 +1678,7 @@ namespace basisu
|
||||
// Simple validation
|
||||
if ((hdr.m_cmap != 0) && (hdr.m_cmap != 1))
|
||||
return nullptr;
|
||||
|
||||
|
||||
if (hdr.m_cmap)
|
||||
{
|
||||
if ((hdr.m_cmap_bpp == 0) || (hdr.m_cmap_bpp > 32))
|
||||
@@ -1837,13 +1837,13 @@ namespace basisu
|
||||
bytes_remaining += bytes_to_skip;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
width = hdr.m_width;
|
||||
height = hdr.m_height;
|
||||
|
||||
const uint32_t source_pitch = width * tga_bytes_per_pixel;
|
||||
const uint32_t dest_pitch = width * n_chans;
|
||||
|
||||
|
||||
uint8_t *pImage = (uint8_t *)malloc(dest_pitch * height);
|
||||
if (!pImage)
|
||||
return nullptr;
|
||||
@@ -1865,7 +1865,7 @@ namespace basisu
|
||||
int pixels_remaining = width;
|
||||
uint8_t *pDst = &input_line_buf[0];
|
||||
|
||||
do
|
||||
do
|
||||
{
|
||||
if (!run_remaining)
|
||||
{
|
||||
@@ -2050,7 +2050,7 @@ namespace basisu
|
||||
|
||||
if (!filedata.size() || (filedata.size() > UINT32_MAX))
|
||||
return nullptr;
|
||||
|
||||
|
||||
return read_tga(&filedata[0], (uint32_t)filedata.size(), width, height, n_chans);
|
||||
}
|
||||
|
||||
@@ -2060,7 +2060,7 @@ namespace basisu
|
||||
|
||||
va_list args;
|
||||
va_start(args, pFmt);
|
||||
#ifdef _WIN32
|
||||
#ifdef _WIN32
|
||||
vsprintf_s(buf, sizeof(buf), pFmt, args);
|
||||
#else
|
||||
vsnprintf(buf, sizeof(buf), pFmt, args);
|
||||
@@ -2085,7 +2085,7 @@ namespace basisu
|
||||
for (uint32_t x = 0; x < 8; x++)
|
||||
{
|
||||
const uint32_t q = row_bits & (1 << x);
|
||||
|
||||
|
||||
const color_rgba* pColor = q ? &fg : pBG;
|
||||
if (!pColor)
|
||||
continue;
|
||||
@@ -2105,5 +2105,5 @@ namespace basisu
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace basisu
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
// We only use OpenCL v1.2 or less.
|
||||
#define CL_TARGET_OPENCL_VERSION 120
|
||||
|
||||
#ifdef SDL_PLATFORM_APPLE
|
||||
#ifdef __APPLE__
|
||||
#include <OpenCL/opencl.h>
|
||||
#else
|
||||
#include <CL/cl.h>
|
||||
@@ -54,10 +54,10 @@ namespace basisu
|
||||
class ocl
|
||||
{
|
||||
public:
|
||||
ocl()
|
||||
ocl()
|
||||
{
|
||||
memset(&m_dev_fp_config, 0, sizeof(m_dev_fp_config));
|
||||
|
||||
|
||||
m_ocl_mutex.lock();
|
||||
m_ocl_mutex.unlock();
|
||||
}
|
||||
@@ -161,12 +161,12 @@ namespace basisu
|
||||
deinit();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
printf("OpenCL init time: %3.3f secs\n", tm.get_elapsed_secs());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool deinit()
|
||||
{
|
||||
if (m_program)
|
||||
@@ -364,7 +364,7 @@ namespace basisu
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
bool destroy_buffer(cl_mem buf)
|
||||
{
|
||||
if (buf)
|
||||
@@ -678,7 +678,7 @@ namespace basisu
|
||||
cl_command_queue m_command_queue = nullptr;
|
||||
cl_program m_program = nullptr;
|
||||
cl_device_fp_config m_dev_fp_config;
|
||||
|
||||
|
||||
bool m_use_mutex = false;
|
||||
std::mutex m_ocl_mutex;
|
||||
|
||||
@@ -704,7 +704,7 @@ namespace basisu
|
||||
private:
|
||||
ocl* m_p;
|
||||
};
|
||||
|
||||
|
||||
cl_image_format get_image_format(uint32_t bytes_per_pixel, bool normalized)
|
||||
{
|
||||
cl_image_format fmt;
|
||||
@@ -721,10 +721,10 @@ namespace basisu
|
||||
return fmt;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Library blobal state
|
||||
ocl g_ocl;
|
||||
|
||||
|
||||
bool opencl_init(bool force_serialization)
|
||||
{
|
||||
if (g_ocl.is_initialized())
|
||||
@@ -753,11 +753,11 @@ namespace basisu
|
||||
g_ocl.deinit();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
pKernel_src = (char*)kernel_src.data();
|
||||
kernel_src_size = kernel_src.size();
|
||||
#endif
|
||||
|
||||
|
||||
if (!kernel_src_size)
|
||||
{
|
||||
ocl_error_printf("opencl_init: Invalid OpenCL kernel source file \"%s\"\n", BASISU_OCL_KERNELS_FILENAME);
|
||||
@@ -771,7 +771,7 @@ namespace basisu
|
||||
g_ocl.deinit();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
printf("OpenCL support initialized successfully\n");
|
||||
|
||||
return true;
|
||||
@@ -816,10 +816,10 @@ namespace basisu
|
||||
opencl_context* pContext = static_cast<opencl_context * >(calloc(sizeof(opencl_context), 1));
|
||||
if (!pContext)
|
||||
return nullptr;
|
||||
|
||||
|
||||
// To avoid driver bugs in some drivers - serialize this. Likely not necessary, we don't know.
|
||||
// https://community.intel.com/t5/OpenCL-for-CPU/Bug-report-clCreateKernelsInProgram-is-not-thread-safe/td-p/1159771
|
||||
|
||||
|
||||
pContext->m_command_queue = g_ocl.create_command_queue();
|
||||
if (!pContext->m_command_queue)
|
||||
{
|
||||
@@ -890,7 +890,7 @@ namespace basisu
|
||||
g_ocl.destroy_kernel(pContext->m_ocl_refine_endpoint_clusterization_kernel);
|
||||
|
||||
g_ocl.destroy_command_queue(pContext->m_command_queue);
|
||||
|
||||
|
||||
memset(pContext, 0, sizeof(opencl_context));
|
||||
|
||||
free(pContext);
|
||||
@@ -938,7 +938,7 @@ namespace basisu
|
||||
assert(pContext->m_ocl_pixel_blocks);
|
||||
if (!pContext->m_ocl_pixel_blocks)
|
||||
return false;
|
||||
|
||||
|
||||
cl_encode_etc1s_param_struct ps;
|
||||
ps.m_total_blocks = pContext->m_ocl_total_pixel_blocks;
|
||||
ps.m_perceptual = perceptual;
|
||||
@@ -948,7 +948,7 @@ namespace basisu
|
||||
|
||||
cl_mem vars = g_ocl.alloc_and_init_read_buffer(pContext->m_command_queue , &ps, sizeof(ps));
|
||||
cl_mem block_buf = g_ocl.alloc_write_buffer(sizeof(etc_block) * pContext->m_ocl_total_pixel_blocks);
|
||||
|
||||
|
||||
if (!vars || !block_buf)
|
||||
goto exit;
|
||||
|
||||
@@ -986,7 +986,7 @@ exit:
|
||||
|
||||
interval_timer tm;
|
||||
tm.start();
|
||||
|
||||
|
||||
cl_encode_etc1s_param_struct ps;
|
||||
ps.m_total_blocks = total_clusters;
|
||||
ps.m_perceptual = perceptual;
|
||||
@@ -1003,7 +1003,7 @@ exit:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cl_mem vars = g_ocl.alloc_and_init_read_buffer(pContext->m_command_queue , &ps, sizeof(ps));
|
||||
cl_mem input_clusters = g_ocl.alloc_and_init_read_buffer(pContext->m_command_queue, pClusters, (size_t)(sizeof(cl_pixel_cluster) * total_clusters));
|
||||
cl_mem input_pixels = g_ocl.alloc_and_init_read_buffer(pContext->m_command_queue, pPixels, (size_t)(sizeof(color_rgba) * total_pixels));
|
||||
@@ -1062,7 +1062,7 @@ exit:
|
||||
assert(pContext->m_ocl_pixel_blocks);
|
||||
if (!pContext->m_ocl_pixel_blocks)
|
||||
return false;
|
||||
|
||||
|
||||
cl_rec_param_struct ps;
|
||||
ps.m_total_blocks = pContext->m_ocl_total_pixel_blocks;
|
||||
ps.m_perceptual = perceptual;
|
||||
@@ -1073,7 +1073,7 @@ exit:
|
||||
cl_mem cluster_info = g_ocl.alloc_and_init_read_buffer(pContext->m_command_queue, pCluster_info, sizeof(cl_endpoint_cluster_struct) * total_clusters);
|
||||
cl_mem sorted_block_indices = g_ocl.alloc_and_init_read_buffer(pContext->m_command_queue, pSorted_block_indices, sizeof(uint32_t) * pContext->m_ocl_total_pixel_blocks);
|
||||
cl_mem output_buf = g_ocl.alloc_write_buffer(sizeof(uint32_t) * pContext->m_ocl_total_pixel_blocks);
|
||||
|
||||
|
||||
if (!pixel_block_info || !cluster_info || !sorted_block_indices || !output_buf)
|
||||
goto exit;
|
||||
|
||||
@@ -1087,7 +1087,7 @@ exit:
|
||||
goto exit;
|
||||
|
||||
debug_printf("opencl_refine_endpoint_clusterization: Elapsed time: %3.3f secs\n", tm.get_elapsed_secs());
|
||||
|
||||
|
||||
status = true;
|
||||
|
||||
exit:
|
||||
@@ -1121,7 +1121,7 @@ exit:
|
||||
fosc_param_struct ps;
|
||||
ps.m_total_blocks = pContext->m_ocl_total_pixel_blocks;
|
||||
ps.m_perceptual = perceptual;
|
||||
|
||||
|
||||
bool status = false;
|
||||
|
||||
cl_mem input_block_info = g_ocl.alloc_and_init_read_buffer(pContext->m_command_queue, pInput_block_info, sizeof(fosc_block_struct) * pContext->m_ocl_total_pixel_blocks);
|
||||
@@ -1192,9 +1192,9 @@ exit:
|
||||
goto exit;
|
||||
|
||||
debug_printf("opencl_determine_selectors: Elapsed time: %3.3f secs\n", tm.get_elapsed_secs());
|
||||
|
||||
|
||||
status = true;
|
||||
|
||||
|
||||
exit:
|
||||
g_ocl.destroy_buffer(input_etc_color5_intens);
|
||||
g_ocl.destroy_buffer(output_blocks);
|
||||
@@ -1202,7 +1202,7 @@ exit:
|
||||
return status;
|
||||
}
|
||||
|
||||
#else
|
||||
#else
|
||||
namespace basisu
|
||||
{
|
||||
// No OpenCL support - all dummy functions that return false;
|
||||
@@ -1269,7 +1269,7 @@ namespace basisu
|
||||
BASISU_NOTE_UNUSED(pPixel_weights);
|
||||
BASISU_NOTE_UNUSED(perceptual);
|
||||
BASISU_NOTE_UNUSED(total_perms);
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -6341,7 +6341,7 @@ ZSTDLIB_API size_t ZSTD_insertBlock (ZSTD_DCtx* dctx, const void* blockStart,
|
||||
*
|
||||
* You can contact the author at :
|
||||
* - xxHash source repository : https://github.com/Cyan4973/xxHash
|
||||
*
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
||||
* in the COPYING file in the root directory of this source tree).
|
||||
@@ -6618,7 +6618,7 @@ XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src
|
||||
* You can contact the author at :
|
||||
* - xxHash homepage: http://www.xxhash.com
|
||||
* - xxHash source repository : https://github.com/Cyan4973/xxHash
|
||||
*
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
||||
* in the COPYING file in the root directory of this source tree).
|
||||
@@ -7776,7 +7776,7 @@ typedef struct {
|
||||
|
||||
/* longLengthPos and longLengthID to allow us to represent either a single litLength or matchLength
|
||||
* in the seqStore that has a value larger than U16 (if it exists). To do so, we increment
|
||||
* the existing value of the litLength or matchLength by 0x10000.
|
||||
* the existing value of the litLength or matchLength by 0x10000.
|
||||
*/
|
||||
U32 longLengthID; /* 0 == no longLength; 1 == Represent the long literal; 2 == Represent the long match; */
|
||||
U32 longLengthPos; /* Index of the sequence to apply long length modification to */
|
||||
@@ -10349,7 +10349,7 @@ extern "C" {
|
||||
|
||||
/* weak symbol support */
|
||||
#if !defined(ZSTD_HAVE_WEAK_SYMBOLS) && defined(__GNUC__) && \
|
||||
!defined(SDL_PLATFORM_APPLE) && !defined(_WIN32) && !defined(__MINGW32__) && \
|
||||
!defined(__APPLE__) && !defined(_WIN32) && !defined(__MINGW32__) && \
|
||||
!defined(__CYGWIN__)
|
||||
# define ZSTD_HAVE_WEAK_SYMBOLS 1
|
||||
#else
|
||||
@@ -22539,7 +22539,7 @@ void ZSTD_ldm_fillHashTable(
|
||||
while (ip < iend) {
|
||||
size_t hashed;
|
||||
unsigned n;
|
||||
|
||||
|
||||
numSplits = 0;
|
||||
hashed = ZSTD_ldm_gear_feed(&hashState, ip, iend - ip, splits, &numSplits);
|
||||
|
||||
@@ -23865,7 +23865,7 @@ static void ZSTD_optLdm_processMatchCandidate(ZSTD_optLdm_t* optLdm, ZSTD_match_
|
||||
*/
|
||||
U32 posOvershoot = currPosInBlock - optLdm->endPosInBlock;
|
||||
ZSTD_optLdm_skipRawSeqStoreBytes(&optLdm->seqStore, posOvershoot);
|
||||
}
|
||||
}
|
||||
ZSTD_opt_getNextMatchAndUpdateSeqStore(optLdm, currPosInBlock, remainingBytes);
|
||||
}
|
||||
ZSTD_optLdm_maybeAddMatch(matches, nbMatches, optLdm, currPosInBlock);
|
||||
@@ -27361,7 +27361,7 @@ size_t HUF_decompress1X1 (void* dst, size_t dstSize, const void* cSrc, size_t cS
|
||||
HUF_CREATE_STATIC_DTABLEX1(DTable, HUF_TABLELOG_MAX);
|
||||
return HUF_decompress1X1_DCtx (DTable, dst, dstSize, cSrc, cSrcSize);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef HUF_FORCE_DECOMPRESS_X1
|
||||
size_t HUF_readDTableX2(HUF_DTable* DTable, const void* src, size_t srcSize)
|
||||
|
||||
@@ -6060,7 +6060,7 @@ ZSTDLIB_API size_t ZSTD_insertBlock (ZSTD_DCtx* dctx, const void* blockStart,
|
||||
*
|
||||
* You can contact the author at :
|
||||
* - xxHash source repository : https://github.com/Cyan4973/xxHash
|
||||
*
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
||||
* in the COPYING file in the root directory of this source tree).
|
||||
@@ -6337,7 +6337,7 @@ XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src
|
||||
* You can contact the author at :
|
||||
* - xxHash homepage: http://www.xxhash.com
|
||||
* - xxHash source repository : https://github.com/Cyan4973/xxHash
|
||||
*
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
||||
* in the COPYING file in the root directory of this source tree).
|
||||
@@ -7495,7 +7495,7 @@ typedef struct {
|
||||
|
||||
/* longLengthPos and longLengthID to allow us to represent either a single litLength or matchLength
|
||||
* in the seqStore that has a value larger than U16 (if it exists). To do so, we increment
|
||||
* the existing value of the litLength or matchLength by 0x10000.
|
||||
* the existing value of the litLength or matchLength by 0x10000.
|
||||
*/
|
||||
U32 longLengthID; /* 0 == no longLength; 1 == Represent the long literal; 2 == Represent the long match; */
|
||||
U32 longLengthPos; /* Index of the sequence to apply long length modification to */
|
||||
@@ -8901,7 +8901,7 @@ size_t HUF_decompress1X1 (void* dst, size_t dstSize, const void* cSrc, size_t cS
|
||||
HUF_CREATE_STATIC_DTABLEX1(DTable, HUF_TABLELOG_MAX);
|
||||
return HUF_decompress1X1_DCtx (DTable, dst, dstSize, cSrc, cSrcSize);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef HUF_FORCE_DECOMPRESS_X1
|
||||
size_t HUF_readDTableX2(HUF_DTable* DTable, const void* src, size_t srcSize)
|
||||
@@ -9309,7 +9309,7 @@ extern "C" {
|
||||
|
||||
/* weak symbol support */
|
||||
#if !defined(ZSTD_HAVE_WEAK_SYMBOLS) && defined(__GNUC__) && \
|
||||
!defined(SDL_PLATFORM_APPLE) && !defined(_WIN32) && !defined(__MINGW32__) && \
|
||||
!defined(__APPLE__) && !defined(_WIN32) && !defined(__MINGW32__) && \
|
||||
!defined(__CYGWIN__)
|
||||
# define ZSTD_HAVE_WEAK_SYMBOLS 1
|
||||
#else
|
||||
|
||||
@@ -449,7 +449,7 @@ inline settings::settings(bool resync)
|
||||
|
||||
#if _WIN32
|
||||
flags(flag::is_vista) = internal::is_vista();
|
||||
#elif !SDL_PLATFORM_APPLE
|
||||
#elif !__APPLE__
|
||||
flags(flag::has_zenity) = check_program("zenity");
|
||||
flags(flag::has_matedialog) = check_program("matedialog");
|
||||
flags(flag::has_qarma) = check_program("qarma");
|
||||
@@ -473,7 +473,7 @@ inline bool settings::available()
|
||||
{
|
||||
#if _WIN32
|
||||
return true;
|
||||
#elif SDL_PLATFORM_APPLE
|
||||
#elif __APPLE__
|
||||
return true;
|
||||
#else
|
||||
settings tmp;
|
||||
@@ -514,7 +514,7 @@ inline bool settings::check_program(std::string const &program)
|
||||
|
||||
inline bool settings::is_osascript() const
|
||||
{
|
||||
#if SDL_PLATFORM_APPLE
|
||||
#if __APPLE__
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
@@ -811,7 +811,7 @@ inline internal::dialog::dialog()
|
||||
|
||||
inline std::vector<std::string> internal::dialog::desktop_helper() const
|
||||
{
|
||||
#if SDL_PLATFORM_APPLE
|
||||
#if __APPLE__
|
||||
return { "osascript" };
|
||||
#else
|
||||
return { flags(flag::has_zenity) ? "zenity"
|
||||
|
||||
@@ -143,7 +143,7 @@ using std::memset;
|
||||
# define PUGI_IMPL_SNPRINTF(buf, ...) snprintf(buf, sizeof(buf), __VA_ARGS__)
|
||||
#elif defined(PUGI_IMPL_MSVC_CRT_VERSION) && PUGI_IMPL_MSVC_CRT_VERSION >= 1400
|
||||
# define PUGI_IMPL_SNPRINTF(buf, ...) _snprintf_s(buf, _countof(buf), _TRUNCATE, __VA_ARGS__)
|
||||
#elif defined(SDL_PLATFORM_APPLE) && __clang_major__ >= 14 // Xcode 14 marks sprintf as deprecated while still using C++98 by default
|
||||
#elif defined(__APPLE__) && __clang_major__ >= 14 // Xcode 14 marks sprintf as deprecated while still using C++98 by default
|
||||
# define PUGI_IMPL_SNPRINTF(buf, fmt, arg1, arg2) snprintf(buf, sizeof(buf), fmt, arg1, arg2)
|
||||
#else
|
||||
# define PUGI_IMPL_SNPRINTF sprintf
|
||||
|
||||
@@ -1443,17 +1443,17 @@ typedef struct VmaAllocationInfo
|
||||
typedef struct VmaAllocationInfo2
|
||||
{
|
||||
/** \brief Basic parameters of the allocation.
|
||||
|
||||
|
||||
If you need only these, you can use function vmaGetAllocationInfo() and structure #VmaAllocationInfo instead.
|
||||
*/
|
||||
VmaAllocationInfo allocationInfo;
|
||||
/** \brief Size of the `VkDeviceMemory` block that the allocation belongs to.
|
||||
|
||||
|
||||
In case of an allocation with dedicated memory, it will be equal to `allocationInfo.size`.
|
||||
*/
|
||||
VkDeviceSize blockSize;
|
||||
/** \brief `VK_TRUE` if the allocation has dedicated memory, `VK_FALSE` if it was placed as part of a larger memory block.
|
||||
|
||||
|
||||
When `VK_TRUE`, it also means `VkMemoryDedicatedAllocateInfo` was used when creating the allocation
|
||||
(if VK_KHR_dedicated_allocation extension or Vulkan version >= 1.1 is enabled).
|
||||
*/
|
||||
@@ -2509,7 +2509,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateAliasingBuffer(
|
||||
\param allocator
|
||||
\param allocation Allocation that provides memory to be used for binding new buffer to it.
|
||||
\param allocationLocalOffset Additional offset to be added while binding, relative to the beginning of the allocation. Normally it should be 0.
|
||||
\param pBufferCreateInfo
|
||||
\param pBufferCreateInfo
|
||||
\param[out] pBuffer Buffer that was created.
|
||||
|
||||
This function automatically:
|
||||
@@ -2908,10 +2908,10 @@ static void* vma_aligned_alloc(size_t alignment, size_t size)
|
||||
|
||||
return memalign(alignment, size);
|
||||
}
|
||||
#elif defined(SDL_PLATFORM_APPLE) || defined(__ANDROID__) || (defined(__linux__) && defined(__GLIBCXX__) && !defined(_GLIBCXX_HAVE_ALIGNED_ALLOC))
|
||||
#elif defined(__APPLE__) || defined(__ANDROID__) || (defined(__linux__) && defined(__GLIBCXX__) && !defined(_GLIBCXX_HAVE_ALIGNED_ALLOC))
|
||||
#include <cstdlib>
|
||||
|
||||
#if defined(SDL_PLATFORM_APPLE)
|
||||
#if defined(__APPLE__)
|
||||
#include <AvailabilityMacros.h>
|
||||
#endif
|
||||
|
||||
@@ -2919,7 +2919,7 @@ static void* vma_aligned_alloc(size_t alignment, size_t size)
|
||||
{
|
||||
// Unfortunately, aligned_alloc causes VMA to crash due to it returning null pointers. (At least under 11.4)
|
||||
// Therefore, for now disable this specific exception until a proper solution is found.
|
||||
//#if defined(SDL_PLATFORM_APPLE) && (defined(MAC_OS_X_VERSION_10_16) || defined(__IPHONE_14_0))
|
||||
//#if defined(__APPLE__) && (defined(MAC_OS_X_VERSION_10_16) || defined(__IPHONE_14_0))
|
||||
//#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_16 || __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0
|
||||
// // For C++14, usr/include/malloc/_malloc.h declares aligned_alloc()) only
|
||||
// // with the MacOSX11.0 SDK in Xcode 12 (which is what adds
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
# include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#ifdef SDL_PLATFORM_APPLE
|
||||
#ifdef __APPLE__
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
@@ -77,7 +77,7 @@ VkResult volkInitialize(void)
|
||||
|
||||
// note: function pointer is cast through void function pointer to silence cast-function-type warning on gcc8
|
||||
vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)(void(*)(void))GetProcAddress(module, "vkGetInstanceProcAddr");
|
||||
#elif defined(SDL_PLATFORM_APPLE)
|
||||
#elif defined(__APPLE__)
|
||||
void* module = dlopen("libvulkan.dylib", RTLD_NOW | RTLD_LOCAL);
|
||||
if (!module)
|
||||
module = dlopen("libvulkan.1.dylib", RTLD_NOW | RTLD_LOCAL);
|
||||
|
||||
@@ -54,19 +54,19 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(A_GPU)
|
||||
#if defined(A_GPU)
|
||||
#ifndef ASPM_GPU
|
||||
#define ASPM_GPU
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(A_GLS)
|
||||
#if defined(A_GLS)
|
||||
#ifndef ASPM_GLS
|
||||
#define ASPM_GLS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(A_HLSL)
|
||||
#if defined(A_HLSL)
|
||||
#ifndef ASPM_HLSL
|
||||
#define ASPM_HLSL
|
||||
#endif
|
||||
@@ -105,7 +105,7 @@
|
||||
#define INC_cmp_math_func "cmp_math_func.h"
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) || defined(__unix__) || defined(SDL_PLATFORM_APPLE)
|
||||
#if defined(__linux__) || defined(__unix__) || defined(__APPLE__)
|
||||
#ifndef _LINUX
|
||||
#define _LINUX
|
||||
#endif
|
||||
@@ -159,7 +159,7 @@
|
||||
// RGBA to channels [0,1,2,3] else BGRA maps to [0,1,2,3]
|
||||
// BC4 alpha always maps as AAAA to channels [0,1,2,3]
|
||||
// BC5 decoded (Red&Green) maps R,G,B=0,A=255 to [0,1,2,3] else maps [B=0,G,R,A=255] to [0,1,2,3]
|
||||
#define CMP_SET_BC13_DECODER_RGBA
|
||||
#define CMP_SET_BC13_DECODER_RGBA
|
||||
#define CMP_FLOAT_MAX 3.402823466e+38F // max value used to detect an Error in processing
|
||||
#define CMP_FLOAT_MAX_EXP 38
|
||||
#define USE_PROCESS_SEPERATE_ALPHA // Enable this to use higher quality code using CompressDualIndexBlock
|
||||
@@ -174,12 +174,12 @@
|
||||
//#define USE_BLOCK_LINEAR // Source Data is organized in linear form for each block : Experimental Code not fully developed
|
||||
//#define USE_DOUBLE // Default is to use float, enable to use double data types only for float definitions
|
||||
|
||||
#ifdef ASPM
|
||||
#ifdef ASPM
|
||||
#define CMP_UNIFORM uniform
|
||||
#define CMP_VARYING varying
|
||||
#else
|
||||
#define CMP_UNIFORM
|
||||
#define CMP_VARYING
|
||||
#define CMP_VARYING
|
||||
#endif
|
||||
//---------------------------------------------
|
||||
// Predefinitions for GPU and CPU compiled code
|
||||
@@ -750,7 +750,7 @@ struct texture_surface
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
// TODO
|
||||
// ====
|
||||
// - Replace transcendentals with manual versions.
|
||||
// - Replace transcendentals with manual versions.
|
||||
//==============================================================================================================================
|
||||
#ifdef A_GCC
|
||||
A_STATIC AD1 AAbsD1(AD1 a){return __builtin_fabs(a);}
|
||||
@@ -811,7 +811,7 @@ struct texture_surface
|
||||
A_STATIC AL1 AMaxL1(AL1 a,AL1 b){return a>b?a:b;}
|
||||
A_STATIC AU1 AMaxU1(AU1 a,AU1 b){return a>b?a:b;}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
// These follow the convention that A integer types don't have signage, until they are operated on.
|
||||
// These follow the convention that A integer types don't have signage, until they are operated on.
|
||||
A_STATIC AL1 AMaxSL1(AL1 a,AL1 b){return (ASL1_(a)>ASL1_(b))?a:b;}
|
||||
A_STATIC AU1 AMaxSU1(AU1 a,AU1 b){return (ASU1_(a)>ASU1_(b))?a:b;}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -1049,7 +1049,7 @@ struct texture_surface
|
||||
#ifndef A_SKIP_EXT
|
||||
#ifdef A_HALF
|
||||
#extension GL_EXT_shader_16bit_storage:require
|
||||
#extension GL_EXT_shader_explicit_arithmetic_types:require
|
||||
#extension GL_EXT_shader_explicit_arithmetic_types:require
|
||||
#endif
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
#ifdef A_LONG
|
||||
@@ -1504,7 +1504,7 @@ struct texture_surface
|
||||
#define AU4_AF4(x) asuint(AF4(x))
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
AU1 AU1_AH2_AF2_x(AF2 a){return f32tof16(a.x)|(f32tof16(a.y)<<16);}
|
||||
#define AU1_AH2_AF2(a) AU1_AH2_AF2_x(AF2(a))
|
||||
#define AU1_AH2_AF2(a) AU1_AH2_AF2_x(AF2(a))
|
||||
#define AU1_AB4Unorm_AF4(x) D3DCOLORtoUBYTE4(AF4(x))
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
AF2 AF2_AH2_AU1_x(AU1 x){return AF2(f16tof32(x&0xFFFF),f16tof32(x>>16));}
|
||||
@@ -1874,7 +1874,7 @@ struct texture_surface
|
||||
// IDEAS
|
||||
// =====
|
||||
// - Polaris hardware has 16-bit support, but non-double rate.
|
||||
// Could be possible still get part double rate for some of this logic,
|
||||
// Could be possible still get part double rate for some of this logic,
|
||||
// by clearing out the lower half's sign when necessary and using 32-bit ops...
|
||||
//==============================================================================================================================
|
||||
#ifdef A_HALF
|
||||
@@ -1932,14 +1932,14 @@ struct texture_surface
|
||||
// Valid input range is {-1 to 1} representing {0 to 2 pi}.
|
||||
// Output range is {-1/4 to -1/4} representing {-1 to 1}.
|
||||
AF1 APSinF1(AF1 x){return x*abs(x)-x;} // MAD.
|
||||
AF1 APCosF1(AF1 x){x=AFractF1(x*AF1_(0.5)+AF1_(0.75));x=x*AF1_(2.0)-AF1_(1.0);return APSinF1(x);} // 3x MAD, FRACT
|
||||
AF1 APCosF1(AF1 x){x=AFractF1(x*AF1_(0.5)+AF1_(0.75));x=x*AF1_(2.0)-AF1_(1.0);return APSinF1(x);} // 3x MAD, FRACT
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
#ifdef A_HALF
|
||||
// For a packed {sin,cos} pair,
|
||||
// - Native takes 16 clocks and 4 issue slots (no packed transcendentals).
|
||||
// - Parabolic takes 8 clocks and 8 issue slots (only fract is non-packed).
|
||||
AH2 APSinH2(AH2 x){return x*abs(x)-x;} // AND,FMA
|
||||
AH2 APCosH2(AH2 x){x=AFractH2(x*AH2_(0.5)+AH2_(0.75));x=x*AH2_(2.0)-AH2_(1.0);return APSinH2(x);} // 3x FMA, 2xFRACT, AND
|
||||
AH2 APCosH2(AH2 x){x=AFractH2(x*AH2_(0.5)+AH2_(0.75));x=x*AH2_(2.0)-AH2_(1.0);return APSinH2(x);} // 3x FMA, 2xFRACT, AND
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -1981,7 +1981,7 @@ struct texture_surface
|
||||
AF1 ATo709F1(AF1 c){return max(min(c*AF1_(4.5),AF1_(0.018)),AF1_(1.099)*pow(c,AF1_(0.45))-AF1_(0.099));}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
// Note 'rcpX' is '1/x', where the 'x' is what would be used in AFromGamma().
|
||||
AF1 AToGammaF1(AF1 c,AF1 rcpX){return pow(c,rcpX);}
|
||||
AF1 AToGammaF1(AF1 c,AF1 rcpX){return pow(c,rcpX);}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
AF1 AToPqF1(AF1 x){AF1 p=pow(x,AF1_(0.159302));
|
||||
return pow((AF1_(0.835938)+AF1_(18.8516)*p)/(AF1_(1.0)+AF1_(18.6875)*p),AF1_(78.8438));}
|
||||
@@ -1993,7 +1993,7 @@ struct texture_surface
|
||||
AF1 AFrom709F1(AF1 c){return max(min(c*AF1_(1.0/4.5),AF1_(0.081)),
|
||||
pow((c+AF1_(0.099))*(AF1_(1.0)/(AF1_(1.099))),AF1_(1.0/0.45)));}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
AF1 AFromGammaF1(AF1 c,AF1 x){return pow(c,x);}
|
||||
AF1 AFromGammaF1(AF1 c,AF1 x){return pow(c,x);}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
AF1 AFromPqF1(AF1 x){AF1 p=pow(x,AF1_(0.0126833));
|
||||
return pow(ASatF1(p-AF1_(0.835938))/(AF1_(18.8516)-AF1_(18.6875)*p),AF1_(6.27739));}
|
||||
@@ -2006,7 +2006,7 @@ struct texture_surface
|
||||
#ifdef A_HALF
|
||||
AH2 ATo709H2(AH2 c){return max(min(c*AH2_(4.5),AH2_(0.018)),AH2_(1.099)*pow(c,AH2_(0.45))-AH2_(0.099));}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
AH2 AToGammaH2(AH2 c,AH1 rcpX){return pow(c,AH2_(rcpX));}
|
||||
AH2 AToGammaH2(AH2 c,AH1 rcpX){return pow(c,AH2_(rcpX));}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
AH2 AToSrgbH2(AH2 c){return max(min(c*AH2_(12.92),AH2_(0.0031308)),AH2_(1.055)*pow(c,AH2_(0.41666))-AH2_(0.055));}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -2045,14 +2045,14 @@ struct texture_surface
|
||||
// Details,
|
||||
// LANE TO 8x8 MAPPING
|
||||
// ===================
|
||||
// 00 01 08 09 10 11 18 19
|
||||
// 00 01 08 09 10 11 18 19
|
||||
// 02 03 0a 0b 12 13 1a 1b
|
||||
// 04 05 0c 0d 14 15 1c 1d
|
||||
// 06 07 0e 0f 16 17 1e 1f
|
||||
// 20 21 28 29 30 31 38 39
|
||||
// 06 07 0e 0f 16 17 1e 1f
|
||||
// 20 21 28 29 30 31 38 39
|
||||
// 22 23 2a 2b 32 33 3a 3b
|
||||
// 24 25 2c 2d 34 35 3c 3d
|
||||
// 26 27 2e 2f 36 37 3e 3f
|
||||
// 26 27 2e 2f 36 37 3e 3f
|
||||
AU2 ARmpRed8x8(AU1 a){return AU2(ABfiM(ABfe(a,2u,3u),a,1u),ABfiM(ABfe(a,3u,3u),ABfe(a,1u,2u),2u));}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user