Commit fe4eb992 authored by Jordi Mallach's avatar Jordi Mallach 🐗

New upstream version 0.182

parent b100aa9b

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

......@@ -44,7 +44,8 @@ int win_mutex::do_init()
# if defined(UNDER_CE)
::InitializeCriticalSection(&crit_section_);
# elif defined(ASIO_WINDOWS_APP)
::InitializeCriticalSectionEx(&crit_section_, 0x80000000, 0);
if (!::InitializeCriticalSectionEx(&crit_section_, 0xFFFFFF, 0))
return ::GetLastError();
# else
if (!::InitializeCriticalSectionAndSpinCount(&crit_section_, 0x80000000))
return ::GetLastError();
......@@ -56,7 +57,8 @@ int win_mutex::do_init()
# if defined(UNDER_CE)
::InitializeCriticalSection(&crit_section_);
# elif defined(ASIO_WINDOWS_APP)
::InitializeCriticalSectionEx(&crit_section_, 0x80000000, 0);
if (!::InitializeCriticalSectionEx(&crit_section_, 0xFFFFFF, 0))
return ::GetLastError();
# else
if (!::InitializeCriticalSectionAndSpinCount(&crit_section_, 0x80000000))
return ::GetLastError();
......
......@@ -205,7 +205,7 @@ void ProcessAverages( v4i* a )
#ifdef __SSE4_1__
for( int i=0; i<2; i++ )
{
__m128i d = _mm_loadu_si128((__m128i*)a[i*2].data());
__m128i d = _mm_loadu_si128((__m128i*)a[i*2]);
__m128i t = _mm_add_epi16(_mm_mullo_epi16(d, _mm_set1_epi16(31)), _mm_set1_epi16(128));
......@@ -222,19 +222,19 @@ void ProcessAverages( v4i* a )
__m128i a0 = _mm_or_si128(_mm_slli_epi16(c, 3), _mm_srli_epi16(c, 2));
_mm_storeu_si128((__m128i*)a[4+i*2].data(), a0);
_mm_storeu_si128((__m128i*)a[4+i*2], a0);
}
for( int i=0; i<2; i++ )
{
__m128i d = _mm_loadu_si128((__m128i*)a[i*2].data());
__m128i d = _mm_loadu_si128((__m128i*)a[i*2]);
__m128i t0 = _mm_add_epi16(_mm_mullo_epi16(d, _mm_set1_epi16(15)), _mm_set1_epi16(128));
__m128i t1 = _mm_srli_epi16(_mm_add_epi16(t0, _mm_srli_epi16(t0, 8)), 8);
__m128i t2 = _mm_or_si128(t1, _mm_slli_epi16(t1, 4));
_mm_storeu_si128((__m128i*)a[i*2].data(), t2);
_mm_storeu_si128((__m128i*)a[i*2], t2);
}
#else
for( int i=0; i<2; i++ )
......
GLSL optimizer Change Log
=========================
2016 10
-------
* Metal/GLES: Fixed bad optimization (all code removed) when framebuffer fetch extension is used, but
fragment shader does not actually read the incoming color value.
* Fixed translation of texelSize().
* Fixed translation of texelFetch().
2016 09
-------
......
......@@ -76,6 +76,12 @@ Notes
1.20. Higher GLSL versions might work, but aren't tested now.
* GLSL ES versions 1.00 and 3.00 are supported.
Status and Future
-----------------
**Note**: As of mid-2016, the project is unlikely to have any significant developments. At Unity we are largely moving to a different
shader compilation pipeline, with glsl-optimizer mostly not used. So from my side there won't be significant work done on it :(
Dev Notes
---------
......
......@@ -3830,21 +3830,6 @@ builtin_builder::_all(const glsl_type *type)
UNOP(not, ir_unop_logic_not, always_available)
static bool
has_lod(const glsl_type *sampler_type)
{
assert(sampler_type->is_sampler());
switch (sampler_type->sampler_dimensionality) {
case GLSL_SAMPLER_DIM_RECT:
case GLSL_SAMPLER_DIM_BUF:
case GLSL_SAMPLER_DIM_MS:
return false;
default:
return true;
}
}
ir_function_signature *
builtin_builder::_textureSize(builtin_available_predicate avail,
const glsl_type *return_type,
......@@ -3857,7 +3842,7 @@ builtin_builder::_textureSize(builtin_available_predicate avail,
ir_texture *tex = new(mem_ctx) ir_texture(ir_txs);
tex->set_sampler(new(mem_ctx) ir_dereference_variable(s), return_type);
if (has_lod(sampler_type)) {
if (ir_texture::has_lod(sampler_type)) {
ir_variable *lod = in_var(glsl_type::int_type, "lod");
sig->parameters.push_tail(lod);
tex->lod_info.lod = var_ref(lod);
......@@ -4017,7 +4002,7 @@ builtin_builder::_texelFetch(builtin_available_predicate avail,
sig->parameters.push_tail(sample);
tex->lod_info.sample_index = var_ref(sample);
tex->op = ir_txf_ms;
} else if (has_lod(sampler_type)) {
} else if (ir_texture::has_lod(sampler_type)) {
ir_variable *lod = in_var(glsl_type::int_type, "lod");
sig->parameters.push_tail(lod);
tex->lod_info.lod = var_ref(lod);
......
......@@ -48,7 +48,7 @@ initialize_mesa_context(struct gl_context *ctx, glslopt_target api)
{
default:
case kGlslTargetOpenGL:
ctx->Const.GLSLVersion = 140;
ctx->Const.GLSLVersion = 150;
break;
case kGlslTargetOpenGLES20:
ctx->Extensions.OES_standard_derivatives = true;
......
......@@ -1410,6 +1410,22 @@ ir_texture::set_sampler(ir_dereference *sampler, const glsl_type *type)
}
bool
ir_texture::has_lod(const glsl_type *sampler_type)
{
assert(sampler_type->is_sampler());
switch (sampler_type->sampler_dimensionality) {
case GLSL_SAMPLER_DIM_RECT:
case GLSL_SAMPLER_DIM_BUF:
case GLSL_SAMPLER_DIM_MS:
return false;
default:
return true;
}
}
void
ir_swizzle::init_mask(const unsigned *comp, unsigned count)
{
......
......@@ -1922,6 +1922,8 @@ public:
/** Set the sampler and type. */
void set_sampler(ir_dereference *sampler, const glsl_type *type);
static bool has_lod(const glsl_type *sampler_type);
/**
* Do a reverse-lookup to translate a string into an ir_texture_opcode.
*/
......
......@@ -826,6 +826,20 @@ void ir_print_glsl_visitor::visit(ir_texture *ir)
const bool is_shadow = ir->sampler->type->sampler_shadow;
const bool is_array = ir->sampler->type->sampler_array;
const bool is_msaa = ir->op == ir_txf_ms;
if (ir->op == ir_txs)
{
buffer.asprintf_append("textureSize (");
ir->sampler->accept(this);
if (ir_texture::has_lod(ir->sampler->type))
{
buffer.asprintf_append(", ");
ir->lod_info.lod->accept(this);
}
buffer.asprintf_append(")");
return;
}
const glsl_type* uv_type = ir->coordinate->type;
const int uv_dim = uv_type->vector_elements;
int sampler_uv_dim = tex_sampler_dim_size[sampler_dim];
......@@ -835,7 +849,7 @@ void ir_print_glsl_visitor::visit(ir_texture *ir)
sampler_uv_dim += 1;
if (is_msaa)
sampler_uv_dim += 1;
const bool is_proj = (uv_dim > sampler_uv_dim);
const bool is_proj = ((ir->op == ir_tex || ir->op == ir_txb || ir->op == ir_txl || ir->op == ir_txd) && uv_dim > sampler_uv_dim);
const bool is_lod = (ir->op == ir_txl);
#if 0 // BK - disable LOD workarounds.
......@@ -869,27 +883,23 @@ void ir_print_glsl_visitor::visit(ir_texture *ir)
}
#endif // 0
// texture function name
//ACS: shadow lookups and lookups with dimensionality included in the name were deprecated in 130
if(state->language_version<130)
{
buffer.asprintf_append ("%s", is_shadow ? "shadow" : "texture");
buffer.asprintf_append ("%s", tex_sampler_dim_name[sampler_dim]);
}
else
{
if (ir->op == ir_txf