mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 10:35:43 -05:00
Integrated glsl-optimizer.
This commit is contained in:
parent
2936474f49
commit
8d5f9f3355
3 changed files with 6 additions and 3 deletions
|
@ -171,7 +171,7 @@ static void propagate_precision_expr(ir_instruction *ir, void *data)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
glsl_precision prec_params_max = glsl_precision_undefined;
|
glsl_precision prec_params_max = glsl_precision_undefined;
|
||||||
for (int i = 0; i < expr->get_num_operands(); ++i)
|
for (int i = 0; i < (int)expr->get_num_operands(); ++i)
|
||||||
{
|
{
|
||||||
ir_rvalue* op = expr->operands[i];
|
ir_rvalue* op = expr->operands[i];
|
||||||
if (op && op->get_precision() != glsl_precision_undefined)
|
if (op && op->get_precision() != glsl_precision_undefined)
|
||||||
|
@ -317,7 +317,7 @@ glslopt_shader* glslopt_optimize (glslopt_ctx* ctx, glslopt_shader_type type, co
|
||||||
{
|
{
|
||||||
glslopt_shader* shader = new (ctx->mem_ctx) glslopt_shader ();
|
glslopt_shader* shader = new (ctx->mem_ctx) glslopt_shader ();
|
||||||
|
|
||||||
PrintGlslMode printMode;
|
PrintGlslMode printMode = kPrintGlslVertex;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case kGlslOptShaderVertex: shader->shader->Type = GL_VERTEX_SHADER; printMode = kPrintGlslVertex; break;
|
case kGlslOptShaderVertex: shader->shader->Type = GL_VERTEX_SHADER; printMode = kPrintGlslVertex; break;
|
||||||
case kGlslOptShaderFragment: shader->shader->Type = GL_FRAGMENT_SHADER; printMode = kPrintGlslFragment; break;
|
case kGlslOptShaderFragment: shader->shader->Type = GL_FRAGMENT_SHADER; printMode = kPrintGlslFragment; break;
|
||||||
|
|
2
3rdparty/glsl-optimizer/src/glsl/ir.cpp
vendored
2
3rdparty/glsl-optimizer/src/glsl/ir.cpp
vendored
|
@ -1544,7 +1544,7 @@ ir_swizzle::variable_referenced() const
|
||||||
ir_variable::ir_variable(const struct glsl_type *type, const char *name,
|
ir_variable::ir_variable(const struct glsl_type *type, const char *name,
|
||||||
ir_variable_mode mode, glsl_precision precision)
|
ir_variable_mode mode, glsl_precision precision)
|
||||||
: max_array_access(0), read_only(false), centroid(false), invariant(false),
|
: max_array_access(0), read_only(false), centroid(false), invariant(false),
|
||||||
mode(mode), precision(precision), interpolation(INTERP_QUALIFIER_NONE)
|
mode(mode), interpolation(INTERP_QUALIFIER_NONE), precision(precision)
|
||||||
{
|
{
|
||||||
this->ir_type = ir_type_variable;
|
this->ir_type = ir_type_variable;
|
||||||
this->type = type;
|
this->type = type;
|
||||||
|
|
|
@ -227,6 +227,9 @@ ir_visitor_status
|
||||||
ir_validate::visit_leave(ir_expression *ir)
|
ir_validate::visit_leave(ir_expression *ir)
|
||||||
{
|
{
|
||||||
switch (ir->operation) {
|
switch (ir->operation) {
|
||||||
|
case ir_ternop_clamp:
|
||||||
|
case ir_ternop_mix:
|
||||||
|
break;
|
||||||
case ir_unop_bit_not:
|
case ir_unop_bit_not:
|
||||||
assert(ir->operands[0]->type == ir->type);
|
assert(ir->operands[0]->type == ir->type);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue