mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-24 08:38:32 -05:00
Upgraded glsl-optimizer.
This commit is contained in:
parent
383b6a14ee
commit
d91bd8651b
70 changed files with 181 additions and 99 deletions
9
3rdparty/glsl-optimizer/Changelog.md
vendored
9
3rdparty/glsl-optimizer/Changelog.md
vendored
|
@ -1,6 +1,14 @@
|
|||
GLSL optimizer Change Log
|
||||
=========================
|
||||
|
||||
2016 03
|
||||
-------
|
||||
|
||||
Fixed:
|
||||
|
||||
* Fixed translation performance regression in loop analysis (regressed in 2015 06 fixes).
|
||||
|
||||
|
||||
2015 08
|
||||
-------
|
||||
|
||||
|
@ -35,6 +43,7 @@ Fixes:
|
|||
-------
|
||||
|
||||
Goodies:
|
||||
|
||||
* GLES2: support EXT_draw_instanced / gl_InstanceIDEXT.
|
||||
* Support gl_VertexID in GLSL < 1.30 when EXT_gpu_shader4 is used.
|
||||
|
||||
|
|
|
@ -440,8 +440,12 @@ static bool propagate_precision(exec_list* list, bool assign_high_to_undefined)
|
|||
static void do_optimization_passes(exec_list* ir, bool linked, _mesa_glsl_parse_state* state, void* mem_ctx)
|
||||
{
|
||||
bool progress;
|
||||
// FIXME: Shouldn't need to bound the number of passes
|
||||
int passes = 0,
|
||||
kMaximumPasses = 1000;
|
||||
do {
|
||||
progress = false;
|
||||
++passes;
|
||||
bool progress2;
|
||||
debug_print_ir ("Initial", ir, state, mem_ctx);
|
||||
if (linked) {
|
||||
|
@ -497,7 +501,7 @@ static void do_optimization_passes(exec_list* ir, bool linked, _mesa_glsl_parse_
|
|||
}
|
||||
delete ls;
|
||||
}
|
||||
} while (progress);
|
||||
} while (progress && passes < kMaximumPasses);
|
||||
|
||||
if (!state->metal_target)
|
||||
{
|
||||
|
|
|
@ -1020,17 +1020,7 @@ void ir_print_metal_visitor::visit(ir_expression *ir)
|
|||
const bool halfCast = (arg_prec == glsl_precision_medium || arg_prec == glsl_precision_low);
|
||||
buffer.asprintf_append (halfCast ? "((half)1.0/(" : "(1.0/(");
|
||||
} else {
|
||||
switch(ir->operation) {
|
||||
case ir_unop_dFdy:
|
||||
case ir_unop_dFdy_coarse:
|
||||
case ir_unop_dFdy_fine:
|
||||
buffer.asprintf_append ("%s(-", operator_glsl_strs[ir->operation]);
|
||||
break;
|
||||
|
||||
default:
|
||||
buffer.asprintf_append ("%s(", operator_glsl_strs[ir->operation]);
|
||||
break;
|
||||
}
|
||||
buffer.asprintf_append ("%s(", operator_glsl_strs[ir->operation]);
|
||||
}
|
||||
if (ir->operands[0])
|
||||
ir->operands[0]->accept(this);
|
||||
|
|
6
3rdparty/glsl-optimizer/src/glsl/list.h
vendored
6
3rdparty/glsl-optimizer/src/glsl/list.h
vendored
|
@ -163,8 +163,10 @@ exec_node_get_prev(struct exec_node *n)
|
|||
static inline void
|
||||
exec_node_remove(struct exec_node *n)
|
||||
{
|
||||
n->next->prev = n->prev;
|
||||
n->prev->next = n->next;
|
||||
if (n->next)
|
||||
n->next->prev = n->prev;
|
||||
if (n->prev)
|
||||
n->prev->next = n->next;
|
||||
n->next = NULL;
|
||||
n->prev = NULL;
|
||||
}
|
||||
|
|
175
3rdparty/glsl-optimizer/src/glsl/loop_analysis.cpp
vendored
175
3rdparty/glsl-optimizer/src/glsl/loop_analysis.cpp
vendored
|
@ -25,11 +25,10 @@
|
|||
#include "loop_analysis.h"
|
||||
#include "ir_hierarchical_visitor.h"
|
||||
#include "ir_variable_refcount.h"
|
||||
#include "util/hash_table.h"
|
||||
|
||||
static bool is_loop_terminator(ir_if *ir);
|
||||
|
||||
static bool used_outside_loops(exec_node *head, ir_variable *var, bool first_assignment);
|
||||
|
||||
static bool all_expression_operands_are_loop_constant(ir_rvalue *,
|
||||
hash_table *);
|
||||
|
||||
|
@ -84,6 +83,8 @@ loop_state::loop_state()
|
|||
hash_table_pointer_compare);
|
||||
this->ht_non_inductors = hash_table_ctor(0, hash_table_pointer_hash,
|
||||
hash_table_pointer_compare);
|
||||
this->ht_variables = hash_table_ctor(0, hash_table_pointer_hash,
|
||||
hash_table_pointer_compare);
|
||||
this->mem_ctx = ralloc_context(NULL);
|
||||
this->loop_found = false;
|
||||
}
|
||||
|
@ -94,6 +95,7 @@ loop_state::~loop_state()
|
|||
hash_table_dtor(this->ht);
|
||||
hash_table_dtor(this->ht_inductors);
|
||||
hash_table_dtor(this->ht_non_inductors);
|
||||
hash_table_dtor(this->ht_variables);
|
||||
ralloc_free(this->mem_ctx);
|
||||
}
|
||||
|
||||
|
@ -122,10 +124,36 @@ loop_state::get_for_inductor(const ir_variable *ir)
|
|||
return (loop_variable_state *) hash_table_find(this->ht_inductors, ir);
|
||||
}
|
||||
|
||||
static void *unreferenced_variable = (void *)1;
|
||||
static void *assigned_variable = (void *)2;
|
||||
|
||||
void
|
||||
loop_state::insert_non_inductor(ir_variable *var)
|
||||
loop_state::insert_variable(ir_variable *var)
|
||||
{
|
||||
// key doesn't matter, just needs to be non-NULL
|
||||
// data starts as 1. If an assignment is seen, it's replaced with 2.
|
||||
// this way we can mark a variable as a non-inductor if it's referenced
|
||||
// other than the first assignment
|
||||
hash_table_insert(this->ht_variables, unreferenced_variable, var);
|
||||
}
|
||||
|
||||
void
|
||||
loop_state::reference_variable(ir_variable *var, bool assignment)
|
||||
{
|
||||
void *ref = hash_table_find(this->ht_variables, var);
|
||||
|
||||
// variable declaration was not seen or already discarded, just ignore
|
||||
if (ref == NULL)
|
||||
return;
|
||||
|
||||
if (ref == unreferenced_variable && assignment)
|
||||
{
|
||||
hash_table_replace(this->ht_variables, assigned_variable, var);
|
||||
return;
|
||||
}
|
||||
|
||||
// variable is referenced and not just in an initial assignment,
|
||||
// so it cannot be an inductor
|
||||
hash_table_remove(this->ht_variables, var);
|
||||
hash_table_insert(this->ht_non_inductors, this, var);
|
||||
}
|
||||
|
||||
|
@ -266,10 +294,14 @@ public:
|
|||
virtual ir_visitor_status visit_enter(ir_if *);
|
||||
virtual ir_visitor_status visit_leave(ir_if *);
|
||||
|
||||
void visit_general(ir_instruction *);
|
||||
|
||||
loop_state *loops;
|
||||
|
||||
int if_statement_depth;
|
||||
|
||||
bool first_pass;
|
||||
|
||||
ir_assignment *current_assignment;
|
||||
|
||||
exec_list state;
|
||||
|
@ -277,10 +309,17 @@ public:
|
|||
|
||||
} /* anonymous namespace */
|
||||
|
||||
void loop_enter_callback(class ir_instruction *ir, void *data)
|
||||
{
|
||||
((loop_analysis *)data)->visit_general(ir);
|
||||
}
|
||||
|
||||
loop_analysis::loop_analysis(loop_state *loops)
|
||||
: loops(loops), if_statement_depth(0), current_assignment(NULL)
|
||||
: loops(loops), if_statement_depth(0), current_assignment(NULL), first_pass(false)
|
||||
{
|
||||
/* empty */
|
||||
data_enter = this;
|
||||
callback_enter = &loop_enter_callback;
|
||||
}
|
||||
|
||||
|
||||
|
@ -308,16 +347,11 @@ loop_analysis::visit(ir_variable *var)
|
|||
if (!this->state.is_empty())
|
||||
return visit_continue;
|
||||
|
||||
// Check if this variable is used outside a loop anywhere. If it is, it can't be a
|
||||
// variable that's private to the loop, so can't be an inductor.
|
||||
// This doesn't reject all possible non-inductors, notably anything declared in an
|
||||
// outer loop that isn't an inductor in an inner loop, but it can eliminate some
|
||||
// problem cases
|
||||
if (used_outside_loops(var->next, var, false))
|
||||
{
|
||||
// add to list of "non inductors"
|
||||
loops->insert_non_inductor(var);
|
||||
}
|
||||
// In the first pass over the instructions we look at variables declared and
|
||||
// examine their references to determine if they can be an inductor or not
|
||||
// for the second pass
|
||||
if (this->first_pass)
|
||||
loops->insert_variable(var);
|
||||
|
||||
return visit_continue;
|
||||
}
|
||||
|
@ -339,10 +373,15 @@ loop_analysis::visit_enter(ir_call *)
|
|||
ir_visitor_status
|
||||
loop_analysis::visit(ir_dereference_variable *ir)
|
||||
{
|
||||
/* If we're not somewhere inside a loop, there's nothing to do.
|
||||
/* If we're not somewhere inside a loop, just check for
|
||||
* non-inductors
|
||||
*/
|
||||
if (this->state.is_empty())
|
||||
if (this->state.is_empty() || this->first_pass)
|
||||
{
|
||||
if (this->state.is_empty() && this->first_pass)
|
||||
loops->reference_variable(ir->variable_referenced(), this->in_assignee);
|
||||
return visit_continue;
|
||||
}
|
||||
|
||||
bool nested = false;
|
||||
|
||||
|
@ -382,8 +421,11 @@ loop_analysis::visit_leave(ir_loop *ir)
|
|||
* We could perform some conservative analysis (prove there's no statically
|
||||
* possible assignment, etc.) but it isn't worth it for now; function
|
||||
* inlining will allow us to unroll loops anyway.
|
||||
*
|
||||
* We also skip doing any work in the first pass, where we are just identifying
|
||||
* variables that cannot be inductors.
|
||||
*/
|
||||
if (ls->contains_calls)
|
||||
if (ls->contains_calls || this->first_pass)
|
||||
return visit_continue;
|
||||
|
||||
foreach_in_list(ir_instruction, node, &ir->body_instructions) {
|
||||
|
@ -591,7 +633,7 @@ loop_analysis::visit_enter(ir_assignment *ir)
|
|||
/* If we're not somewhere inside a loop, there's nothing to do.
|
||||
*/
|
||||
if (this->state.is_empty())
|
||||
return visit_continue_with_parent;
|
||||
return visit_continue;
|
||||
|
||||
this->current_assignment = ir;
|
||||
|
||||
|
@ -601,10 +643,8 @@ loop_analysis::visit_enter(ir_assignment *ir)
|
|||
ir_visitor_status
|
||||
loop_analysis::visit_leave(ir_assignment *ir)
|
||||
{
|
||||
/* Since the visit_enter exits with visit_continue_with_parent for this
|
||||
* case, the loop state stack should never be empty here.
|
||||
*/
|
||||
assert(!this->state.is_empty());
|
||||
if (this->state.is_empty())
|
||||
return visit_continue;
|
||||
|
||||
assert(this->current_assignment == ir);
|
||||
this->current_assignment = NULL;
|
||||
|
@ -612,6 +652,24 @@ loop_analysis::visit_leave(ir_assignment *ir)
|
|||
return visit_continue;
|
||||
}
|
||||
|
||||
void
|
||||
loop_analysis::visit_general(ir_instruction *ir)
|
||||
{
|
||||
/* If we're inside a loop, we can't start marking things as non-inductors
|
||||
* Likewise in the second pass we've done all this work, so return early
|
||||
*/
|
||||
if (!this->state.is_empty() || !this->first_pass)
|
||||
return;
|
||||
|
||||
ir_variable_refcount_visitor refs;
|
||||
ir->accept (&refs);
|
||||
|
||||
struct hash_entry *referenced_var;
|
||||
hash_table_foreach (refs.ht, referenced_var) {
|
||||
ir_variable *var = (ir_variable *)referenced_var->key;
|
||||
loops->reference_variable(var, false);
|
||||
}
|
||||
}
|
||||
|
||||
class examine_rhs : public ir_hierarchical_visitor {
|
||||
public:
|
||||
|
@ -733,72 +791,23 @@ is_loop_terminator(ir_if *ir)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
used_outside_loops(exec_node *head, ir_variable *var, bool first_assignment)
|
||||
{
|
||||
ir_variable_refcount_visitor refs;
|
||||
for (exec_node* node = head;
|
||||
!node->is_tail_sentinel();
|
||||
node = node->next)
|
||||
{
|
||||
ir_instruction *ir = (ir_instruction *) node;
|
||||
if (ir->ir_type == ir_type_variable)
|
||||
continue;
|
||||
|
||||
// ignore the first assignment
|
||||
if (!first_assignment && ir->ir_type == ir_type_assignment)
|
||||
{
|
||||
ir_assignment *assign = ir->as_assignment();
|
||||
ir_variable *assignee = assign->lhs->whole_variable_referenced();
|
||||
|
||||
if(assignee == var)
|
||||
{
|
||||
first_assignment = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// we don't want to recurse into loops
|
||||
if (ir->ir_type == ir_type_loop)
|
||||
continue;
|
||||
|
||||
// recurse only for if statements, the other case we would need to recurse is
|
||||
// loops, but we are looking for uses outside of loops.
|
||||
if (ir->ir_type == ir_type_if)
|
||||
{
|
||||
ir_if *irif = ir->as_if();
|
||||
if (used_outside_loops(irif->then_instructions.head, var, first_assignment))
|
||||
return true;
|
||||
if (used_outside_loops(irif->else_instructions.head, var, first_assignment))
|
||||
return true;
|
||||
|
||||
// if we didn't find in each branch with our recursion, skip
|
||||
// otherwise the accept (&refs) below will recurse into loops
|
||||
// and may give a false positive.
|
||||
continue;
|
||||
}
|
||||
|
||||
// we know that we're not inside a loop as we haven't recursed inside,
|
||||
// and we started outside of a loop, so any references to this variable
|
||||
// mean it is used outside of any loops
|
||||
ir->accept (&refs);
|
||||
if (refs.find_variable_entry(var))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
loop_state *
|
||||
analyze_loop_variables(exec_list *instructions)
|
||||
{
|
||||
loop_state *loops = new loop_state;
|
||||
loop_analysis v(loops);
|
||||
|
||||
/* Do two passes over the instructions. The first pass builds a view
|
||||
* of the variables declared and whether or not they're used outside
|
||||
* of loops (if so, they cannot be inductors).
|
||||
*
|
||||
* In the second pass we apply this information to do the loop analysis
|
||||
* itself.
|
||||
*/
|
||||
v.first_pass = true;
|
||||
v.run(instructions);
|
||||
v.first_pass = false;
|
||||
v.run(instructions);
|
||||
|
||||
return v.loops;
|
||||
}
|
||||
|
|
|
@ -251,6 +251,8 @@ public:
|
|||
loop_variable_state* get_for_inductor (const ir_variable*);
|
||||
bool insert_inductor(loop_variable* loopvar, loop_variable_state* state, ir_loop* loop);
|
||||
void insert_non_inductor(ir_variable *var);
|
||||
void insert_variable(ir_variable *var);
|
||||
void reference_variable(ir_variable *var, bool assignment);
|
||||
|
||||
bool loop_found;
|
||||
|
||||
|
@ -267,6 +269,7 @@ private:
|
|||
*/
|
||||
hash_table *ht_inductors;
|
||||
hash_table *ht_non_inductors;
|
||||
hash_table *ht_variables;
|
||||
|
||||
|
||||
void *mem_ctx;
|
||||
|
|
|
@ -84,6 +84,8 @@ hash_table_ctor(unsigned num_buckets, hash_func_t hash,
|
|||
void
|
||||
hash_table_dtor(struct hash_table *ht)
|
||||
{
|
||||
if (!ht)
|
||||
return;
|
||||
hash_table_clear(ht);
|
||||
free(ht);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float4 gl_FragCoord [[position]];
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
half2 xlv_TEXCOORD0;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float2 varUV;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
constant float2 _xlat_mtl_const1[12] = {float2(-0.326212, -0.40581), float2(-0.840144, -0.07358), float2(-0.695914, 0.457137), float2(-0.203345, 0.620716), float2(0.96234, -0.194983), float2(0.473434, -0.480026), float2(0.519456, 0.767022), float2(0.185461, -0.893124), float2(0.507431, 0.064425), float2(0.89642, 0.412458), float2(-0.32194, -0.932615), float2(-0.791559, -0.59771)};
|
||||
struct xlatMtlShaderInput {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float2 gl_PointCoord [[point_coord]];
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
half4 xlv_TEXCOORD0;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float4 xlv_TEXCOORD0;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float2 xlv_uv;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float2 xlv_uv;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
inline float4x4 _xlcast_float4x4(half4x4 v) { return float4x4(float4(v[0]), float4(v[1]), float4(v[2]), float4(v[3])); }
|
||||
inline float3x3 _xlcast_float3x3(half3x3 v) { return float3x3(float3(v[0]), float3(v[1]), float3(v[2])); }
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
inline float4x4 _xlinit_float4x4(float v) { return float4x4(float4(v), float4(v), float4(v), float4(v)); }
|
||||
inline float3x3 _xlinit_float3x3(float v) { return float3x3(float3(v), float3(v), float3(v)); }
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
half4 xlv_COLOR0;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
half3 normal;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
half3 inNormal;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float4 varUV;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float4 xlv_TEXCOORD0;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float4 xlv_TEXCOORD0;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float4 uv;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
half3 uv1;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float4 uvHi;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
constexpr sampler _mtl_xl_shadow_sampler(address::clamp_to_edge, filter::linear, compare_func::less);
|
||||
struct xlatMtlShaderInput {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float3 uv;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
constexpr sampler _mtl_xl_shadow_sampler(address::clamp_to_edge, filter::linear, compare_func::less);
|
||||
struct xlatMtlShaderInput {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
half3 uv;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
constexpr sampler _mtl_xl_shadow_sampler(address::clamp_to_edge, filter::linear, compare_func::less);
|
||||
struct xlatMtlShaderInput {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float2 xlv_TEXCOORD0;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float2 xlv_TEXCOORD0;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float4 _uv0;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float2 xlv_TEXCOORD0;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float2 xlv_TEXCOORD0;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float4 xlv_TEXCOORD0;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float2 xlv_TEXCOORD0;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float2 xlv_TEXCOORD0;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float4 xlv_TEXCOORD0;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float2 xlv_TEXCOORD0;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
half2 xlv_TEXCOORD0;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
constant float3 _xlat_mtl_const1[8] = {float3(0.0130572, 0.587232, -0.119337), float3(0.323078, 0.0220727, -0.418873), float3(-0.310725, -0.191367, 0.0561369), float3(-0.479646, 0.0939877, -0.580265), float3(0.139999, -0.33577, 0.559679), float3(-0.248458, 0.255532, 0.348944), float3(0.18719, -0.702764, -0.231748), float3(0.884915, 0.284208, 0.368524)};
|
||||
struct xlatMtlShaderInput {
|
||||
|
|
|
@ -315,9 +315,9 @@ static bool CheckGLSL (bool vertex, bool gles, const std::string& testName, cons
|
|||
|
||||
static bool CheckMetal (bool vertex, bool gles, const std::string& testName, const char* prefix, const std::string& source)
|
||||
{
|
||||
#if !GOT_GFX
|
||||
#if !GOT_GFX || !defined(__APPLE__)
|
||||
return true; // just assume it's ok
|
||||
#endif
|
||||
#else
|
||||
|
||||
FILE* f = fopen ("metalTemp.metal", "wb");
|
||||
fwrite (source.c_str(), source.size(), 1, f);
|
||||
|
@ -333,6 +333,7 @@ static bool CheckMetal (bool vertex, bool gles, const std::string& testName, con
|
|||
#endif //
|
||||
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float4 _inVertex [[attribute(0)]];
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float4 _glesVertex [[attribute(0)]];
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float3 _inPos [[attribute(0)]];
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float4 _glesVertex [[attribute(0)]];
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float4 dcl_Input0_POSITION0 [[attribute(0)]];
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float4 in_POSITION0 [[attribute(0)]];
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float4 _glesVertex [[attribute(0)]];
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float4 _inVertex [[attribute(0)]];
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
inline float4x4 _xlcast_float4x4(half4x4 v) { return float4x4(float4(v[0]), float4(v[1]), float4(v[2]), float4(v[3])); }
|
||||
inline float3x3 _xlcast_float3x3(half3x3 v) { return float3x3(float3(v[0]), float3(v[1]), float3(v[2])); }
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float4 attrVertex [[attribute(0)]];
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float4 _glesVertex [[attribute(0)]];
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float4 _inVertex [[attribute(0)]];
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float4 _glesVertex [[attribute(0)]];
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float4 _glesVertex [[attribute(0)]];
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float4 _vertex [[attribute(0)]];
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <metal_stdlib>
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
using namespace metal;
|
||||
struct xlatMtlShaderInput {
|
||||
float4 _inVertex [[attribute(0)]];
|
||||
|
|
Loading…
Reference in a new issue