glsl: remove now unused linker code

This has all be replaced by a nir based linker implementation.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31137>
This commit is contained in:
Timothy Arceri 2024-08-30 19:40:59 +10:00 committed by Marge Bot
parent cbfc225e2b
commit f6e7520b13
11 changed files with 0 additions and 2553 deletions

View file

@ -38,7 +38,6 @@
#include "ir.h"
#include "ir_builder.h"
#include "linker.h"
#include "glsl_parser_extras.h"
#include "glsl_symbol_table.h"
#include "main/consts_exts.h"

View file

@ -122,7 +122,6 @@
*/
#include "ir.h"
#include "glsl_parser_extras.h"
#include "linker.h"
#include "util/hash_table.h"
#include "program.h"

View file

@ -1,357 +0,0 @@
/*
* Copyright © 2010 Intel Corporation
*
* 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, sublicense,
* 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 NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
*/
#include "glsl_symbol_table.h"
#include "glsl_parser_extras.h"
#include "ir.h"
#include "program.h"
#include "util/set.h"
#include "util/hash_table.h"
#include "linker.h"
#include "main/shader_types.h"
static ir_function_signature *
find_matching_signature(const char *name, const exec_list *actual_parameters,
glsl_symbol_table *symbols,
bool has_implicit_conversions,
bool has_implicit_int_to_uint_conversion);
namespace {
class call_link_visitor : public ir_hierarchical_visitor {
public:
call_link_visitor(gl_shader_program *prog, gl_linked_shader *linked,
gl_shader *main, gl_shader **shader_list,
unsigned num_shaders)
{
this->prog = prog;
this->shader_list = shader_list;
this->num_shaders = num_shaders;
this->success = true;
this->linked = linked;
this->main = main;
this->locals = _mesa_pointer_set_create(NULL);
}
~call_link_visitor()
{
_mesa_set_destroy(this->locals, NULL);
}
call_link_visitor(const call_link_visitor &) = delete;
call_link_visitor & operator=(const call_link_visitor &) = delete;
virtual ir_visitor_status visit(ir_variable *ir)
{
_mesa_set_add(locals, ir);
return visit_continue;
}
virtual ir_visitor_status visit_enter(ir_call *ir)
{
/* If ir is an ir_call from a function that was imported from another
* shader callee will point to an ir_function_signature in the original
* shader. In this case the function signature MUST NOT BE MODIFIED.
* Doing so will modify the original shader. This may prevent that
* shader from being linkable in other programs.
*/
const ir_function_signature *const callee = ir->callee;
assert(callee != NULL);
const char *const name = callee->function_name();
/* We don't actually need to find intrinsics; they're not real */
if (callee->is_intrinsic())
return visit_continue;
/* Determine if the requested function signature already exists in the
* final linked shader. If it does, use it as the target of the call.
*/
ir_function_signature *sig =
find_matching_signature(name, &callee->parameters, linked->symbols,
main->has_implicit_conversions,
main->has_implicit_int_to_uint_conversion);
if (sig != NULL) {
ir->callee = sig;
return visit_continue;
}
/* Try to find the signature in one of the other shaders that is being
* linked. If it's not found there, return an error.
*/
for (unsigned i = 0; i < num_shaders; i++) {
sig = find_matching_signature(name, &ir->actual_parameters,
shader_list[i]->symbols,
shader_list[i]->has_implicit_conversions,
shader_list[i]->has_implicit_int_to_uint_conversion);
if (sig)
break;
}
if (sig == NULL) {
/* FINISHME: Log the full signature of unresolved function.
*/
linker_error(this->prog, "unresolved reference to function `%s'\n",
name);
this->success = false;
return visit_stop;
}
/* Find the prototype information in the linked shader. Generate any
* details that may be missing.
*/
ir_function *f = linked->symbols->get_function(name);
if (f == NULL) {
f = new(linked) ir_function(name);
/* Add the new function to the linked IR. Put it at the end
* so that it comes after any global variable declarations
* that it refers to.
*/
linked->symbols->add_function(f);
linked->ir->push_tail(f);
}
ir_function_signature *linked_sig =
f->exact_matching_signature(NULL, &callee->parameters);
if (linked_sig == NULL) {
linked_sig = new(linked) ir_function_signature(callee->return_type);
f->add_signature(linked_sig);
}
/* At this point linked_sig and called may be the same. If ir is an
* ir_call from linked then linked_sig and callee will be
* ir_function_signatures that have no definitions (is_defined is false).
*/
assert(!linked_sig->is_defined);
assert(linked_sig->body.is_empty());
/* Create an in-place clone of the function definition. This multistep
* process introduces some complexity here, but it has some advantages.
* The parameter list and the and function body are cloned separately.
* The clone of the parameter list is used to prime the hashtable used
* to replace variable references in the cloned body.
*
* The big advantage is that the ir_function_signature does not change.
* This means that we don't have to process the rest of the IR tree to
* patch ir_call nodes. In addition, there is no way to remove or
* replace signature stored in a function. One could easily be added,
* but this avoids the need.
*/
struct hash_table *ht = _mesa_pointer_hash_table_create(NULL);
exec_list formal_parameters;
foreach_in_list(const ir_instruction, original, &sig->parameters) {
assert(const_cast<ir_instruction *>(original)->as_variable());
ir_instruction *copy = original->clone(linked, ht);
formal_parameters.push_tail(copy);
}
linked_sig->replace_parameters(&formal_parameters);
linked_sig->intrinsic_id = sig->intrinsic_id;
if (sig->is_defined) {
foreach_in_list(const ir_instruction, original, &sig->body) {
ir_instruction *copy = original->clone(linked, ht);
linked_sig->body.push_tail(copy);
}
linked_sig->is_defined = true;
}
_mesa_hash_table_destroy(ht, NULL);
/* Patch references inside the function to things outside the function
* (i.e., function calls and global variables).
*/
linked_sig->accept(this);
ir->callee = linked_sig;
return visit_continue;
}
virtual ir_visitor_status visit_leave(ir_call *ir)
{
/* Traverse list of function parameters, and for array parameters
* propagate max_array_access. Otherwise arrays that are only referenced
* from inside functions via function parameters will be incorrectly
* optimized. This will lead to incorrect code being generated (or worse).
* Do it when leaving the node so the children would propagate their
* array accesses first.
*/
const exec_node *formal_param_node = ir->callee->parameters.get_head();
if (formal_param_node) {
const exec_node *actual_param_node = ir->actual_parameters.get_head();
while (!actual_param_node->is_tail_sentinel()) {
ir_variable *formal_param = (ir_variable *) formal_param_node;
ir_rvalue *actual_param = (ir_rvalue *) actual_param_node;
formal_param_node = formal_param_node->get_next();
actual_param_node = actual_param_node->get_next();
if (glsl_type_is_array(formal_param->type)) {
ir_dereference_variable *deref = actual_param->as_dereference_variable();
if (deref && deref->var && glsl_type_is_array(deref->var->type)) {
deref->var->data.max_array_access =
MAX2(formal_param->data.max_array_access,
deref->var->data.max_array_access);
}
}
}
}
return visit_continue;
}
virtual ir_visitor_status visit(ir_dereference_variable *ir)
{
if (_mesa_set_search(locals, ir->var) == NULL) {
/* The non-function variable must be a global, so try to find the
* variable in the shader's symbol table. If the variable is not
* found, then it's a global that *MUST* be defined in the original
* shader.
*/
ir_variable *var = linked->symbols->get_variable(ir->var->name);
if (var == NULL) {
/* Clone the ir_variable that the dereference already has and add
* it to the linked shader.
*/
var = ir->var->clone(linked, NULL);
linked->symbols->add_variable(var);
linked->ir->push_head(var);
} else {
if (glsl_type_is_array(var->type)) {
/* It is possible to have a global array declared in multiple
* shaders without a size. The array is implicitly sized by
* the maximal access to it in *any* shader. Because of this,
* we need to track the maximal access to the array as linking
* pulls more functions in that access the array.
*/
var->data.max_array_access =
MAX2(var->data.max_array_access,
ir->var->data.max_array_access);
if (var->type->length == 0 && ir->var->type->length != 0)
var->type = ir->var->type;
}
if (var->is_interface_instance()) {
/* Similarly, we need implicit sizes of arrays within interface
* blocks to be sized by the maximal access in *any* shader.
*/
int *const linked_max_ifc_array_access =
var->get_max_ifc_array_access();
int *const ir_max_ifc_array_access =
ir->var->get_max_ifc_array_access();
assert(linked_max_ifc_array_access != NULL);
assert(ir_max_ifc_array_access != NULL);
for (unsigned i = 0; i < var->get_interface_type()->length;
i++) {
linked_max_ifc_array_access[i] =
MAX2(linked_max_ifc_array_access[i],
ir_max_ifc_array_access[i]);
}
}
}
ir->var = var;
}
return visit_continue;
}
/** Was function linking successful? */
bool success;
private:
/**
* Shader program being linked
*
* This is only used for logging error messages.
*/
gl_shader_program *prog;
/** List of shaders available for linking. */
gl_shader **shader_list;
/** Number of shaders available for linking. */
unsigned num_shaders;
/**
* Final linked shader
*
* This is used two ways. It is used to find global variables in the
* linked shader that are accessed by the function. It is also used to add
* global variables from the shader where the function originated.
*/
gl_linked_shader *linked;
gl_shader *main;
/**
* Table of variables local to the function.
*/
set *locals;
};
} /* anonymous namespace */
/**
* Searches a list of shaders for a particular function definition
*/
ir_function_signature *
find_matching_signature(const char *name, const exec_list *actual_parameters,
glsl_symbol_table *symbols,
bool has_implicit_conversions,
bool has_implicit_int_to_uint_conversion)
{
ir_function *const f = symbols->get_function(name);
if (f) {
ir_function_signature *sig =
f->matching_signature(NULL, actual_parameters,
has_implicit_conversions,
has_implicit_int_to_uint_conversion, false);
if (sig && (sig->is_defined || sig->is_intrinsic()))
return sig;
}
return NULL;
}
bool
link_function_calls(gl_shader_program *prog, gl_linked_shader *main_linked,
gl_shader *main, gl_shader **shader_list,
unsigned num_shaders)
{
call_link_visitor v(prog, main_linked, main, shader_list, num_shaders);
v.run(main_linked->ir);
return v.success;
}

View file

@ -1,317 +0,0 @@
/*
* Copyright © 2013 Intel Corporation
*
* 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, sublicense,
* 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 NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS 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 link_interface_blocks.cpp
* Linker support for GLSL's interface blocks.
*/
#include "ir.h"
#include "glsl_symbol_table.h"
#include "linker.h"
#include "main/macros.h"
#include "main/shader_types.h"
#include "util/hash_table.h"
#include "util/u_string.h"
namespace {
/**
* Return true if interface members mismatch and its not allowed by GLSL.
*/
static bool
interstage_member_mismatch(struct gl_shader_program *prog,
const glsl_type *c, const glsl_type *p) {
if (c->length != p->length)
return true;
for (unsigned i = 0; i < c->length; i++) {
if (c->fields.structure[i].type != p->fields.structure[i].type)
return true;
if (strcmp(c->fields.structure[i].name,
p->fields.structure[i].name) != 0)
return true;
if (c->fields.structure[i].location !=
p->fields.structure[i].location)
return true;
if (c->fields.structure[i].component !=
p->fields.structure[i].component)
return true;
if (c->fields.structure[i].patch !=
p->fields.structure[i].patch)
return true;
/* From Section 4.5 (Interpolation Qualifiers) of the GLSL 4.40 spec:
*
* "It is a link-time error if, within the same stage, the
* interpolation qualifiers of variables of the same name do not
* match."
*/
if (prog->IsES || prog->GLSL_Version < 440)
if (c->fields.structure[i].interpolation !=
p->fields.structure[i].interpolation)
return true;
/* From Section 4.3.4 (Input Variables) of the GLSL ES 3.0 spec:
*
* "The output of the vertex shader and the input of the fragment
* shader form an interface. For this interface, vertex shader
* output variables and fragment shader input variables of the same
* name must match in type and qualification (other than precision
* and out matching to in).
*
* The table in Section 9.2.1 Linked Shaders of the GLSL ES 3.1 spec
* says that centroid no longer needs to match for varyings.
*
* The table in Section 9.2.1 Linked Shaders of the GLSL ES 3.2 spec
* says that sample need not match for varyings.
*/
if (!prog->IsES || prog->GLSL_Version < 310)
if (c->fields.structure[i].centroid !=
p->fields.structure[i].centroid)
return true;
if (!prog->IsES)
if (c->fields.structure[i].sample !=
p->fields.structure[i].sample)
return true;
}
return false;
}
/**
* Check if two interfaces match, according to intrastage interface matching
* rules. If they do, and the first interface uses an unsized array, it will
* be updated to reflect the array size declared in the second interface.
*/
bool
intrastage_match(ir_variable *a,
ir_variable *b,
struct gl_shader_program *prog,
bool match_precision)
{
/* From section 4.7 "Precision and Precision Qualifiers" in GLSL 4.50:
*
* "For the purposes of determining if an output from one shader
* stage matches an input of the next stage, the precision qualifier
* need not match."
*/
bool interface_type_match =
(prog->IsES ?
a->get_interface_type() == b->get_interface_type() :
glsl_type_compare_no_precision(a->get_interface_type(), b->get_interface_type()));
/* Types must match. */
if (!interface_type_match) {
/* Exception: if both the interface blocks are implicitly declared,
* don't force their types to match. They might mismatch due to the two
* shaders using different GLSL versions, and that's ok.
*/
if ((a->data.how_declared != ir_var_declared_implicitly ||
b->data.how_declared != ir_var_declared_implicitly) &&
(!prog->IsES ||
interstage_member_mismatch(prog, a->get_interface_type(),
b->get_interface_type())))
return false;
}
/* Presence/absence of interface names must match. */
if (a->is_interface_instance() != b->is_interface_instance())
return false;
/* For uniforms, instance names need not match. For shader ins/outs,
* it's not clear from the spec whether they need to match, but
* Mesa's implementation relies on them matching.
*/
if (a->is_interface_instance() && b->data.mode != ir_var_uniform &&
b->data.mode != ir_var_shader_storage &&
strcmp(a->name, b->name) != 0) {
return false;
}
bool type_match = (match_precision ?
a->type == b->type :
glsl_type_compare_no_precision(a->type, b->type));
/* If a block is an array then it must match across the shader.
* Unsized arrays are also processed and matched agaist sized arrays.
*/
if (!type_match && (glsl_type_is_array(b->type) || glsl_type_is_array(a->type)) &&
(b->is_interface_instance() || a->is_interface_instance()) &&
!validate_intrastage_arrays(prog, b, a, match_precision))
return false;
return true;
}
/**
* This class keeps track of a mapping from an interface block name to the
* necessary information about that interface block to determine whether to
* generate a link error.
*
* Note: this class is expected to be short lived, so it doesn't make copies
* of the strings it references; it simply borrows the pointers from the
* ir_variable class.
*/
class interface_block_definitions
{
public:
interface_block_definitions()
: mem_ctx(ralloc_context(NULL)),
ht(_mesa_hash_table_create(NULL, _mesa_hash_string,
_mesa_key_string_equal))
{
}
~interface_block_definitions()
{
ralloc_free(mem_ctx);
_mesa_hash_table_destroy(ht, NULL);
}
interface_block_definitions(const interface_block_definitions &) = delete;
interface_block_definitions & operator=(const interface_block_definitions &) = delete;
/**
* Lookup the interface definition. Return NULL if none is found.
*/
ir_variable *lookup(ir_variable *var)
{
if (var->data.explicit_location &&
var->data.location >= VARYING_SLOT_VAR0) {
char location_str[11];
snprintf(location_str, 11, "%d", var->data.location);
const struct hash_entry *entry =
_mesa_hash_table_search(ht, location_str);
return entry ? (ir_variable *) entry->data : NULL;
} else {
const struct hash_entry *entry =
_mesa_hash_table_search(ht,
glsl_get_type_name(glsl_without_array(var->get_interface_type())));
return entry ? (ir_variable *) entry->data : NULL;
}
}
/**
* Add a new interface definition.
*/
void store(ir_variable *var)
{
if (var->data.explicit_location &&
var->data.location >= VARYING_SLOT_VAR0) {
/* If explicit location is given then lookup the variable by location.
* We turn the location into a string and use this as the hash key
* rather than the name. Note: We allocate enough space for a 32-bit
* unsigned location value which is overkill but future proof.
*/
char location_str[11];
snprintf(location_str, 11, "%d", var->data.location);
_mesa_hash_table_insert(ht, ralloc_strdup(mem_ctx, location_str), var);
} else {
_mesa_hash_table_insert(ht,
glsl_get_type_name(glsl_without_array(var->get_interface_type())), var);
}
}
private:
/**
* Ralloc context for data structures allocated by this class.
*/
void *mem_ctx;
/**
* Hash table mapping interface block name to an \c
* ir_variable.
*/
hash_table *ht;
};
}; /* anonymous namespace */
void
validate_intrastage_interface_blocks(struct gl_shader_program *prog,
const gl_shader **shader_list,
unsigned num_shaders)
{
interface_block_definitions in_interfaces;
interface_block_definitions out_interfaces;
interface_block_definitions uniform_interfaces;
interface_block_definitions buffer_interfaces;
for (unsigned int i = 0; i < num_shaders; i++) {
if (shader_list[i] == NULL)
continue;
foreach_in_list(ir_instruction, node, shader_list[i]->ir) {
ir_variable *var = node->as_variable();
if (!var)
continue;
const glsl_type *iface_type = var->get_interface_type();
if (iface_type == NULL)
continue;
interface_block_definitions *definitions;
switch (var->data.mode) {
case ir_var_shader_in:
definitions = &in_interfaces;
break;
case ir_var_shader_out:
definitions = &out_interfaces;
break;
case ir_var_uniform:
definitions = &uniform_interfaces;
break;
case ir_var_shader_storage:
definitions = &buffer_interfaces;
break;
default:
/* Only in, out, and uniform interfaces are legal, so we should
* never get here.
*/
assert(!"illegal interface type");
continue;
}
ir_variable *prev_def = definitions->lookup(var);
if (prev_def == NULL) {
/* This is the first time we've seen the interface, so save
* it into the appropriate data structure.
*/
definitions->store(var);
} else if (!intrastage_match(prev_def, var, prog,
true /* match_precision */)) {
linker_error(prog, "definitions of interface block `%s' do not"
" match\n", glsl_get_type_name(iface_type));
return;
}
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,58 +0,0 @@
/* -*- c++ -*- */
/*
* Copyright © 2010 Intel Corporation
*
* 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, sublicense,
* 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 NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
*/
#ifndef GLSL_LINKER_H
#define GLSL_LINKER_H
#include "linker_util.h"
struct gl_shader_program;
struct gl_shader;
struct gl_linked_shader;
extern bool
link_function_calls(gl_shader_program *prog, gl_linked_shader *main_linked,
gl_shader *main, gl_shader **shader_list,
unsigned num_shaders);
bool
validate_intrastage_arrays(struct gl_shader_program *prog,
ir_variable *const var,
ir_variable *const existing,
bool match_precision = true);
void
validate_intrastage_interface_blocks(struct gl_shader_program *prog,
const gl_shader **shader_list,
unsigned num_shaders);
extern struct gl_linked_shader *
link_intrastage_shaders(void *mem_ctx,
struct gl_context *ctx,
struct gl_shader_program *prog,
struct gl_shader **shader_list,
unsigned num_shaders,
bool allow_missing_main);
#endif /* GLSL_LINKER_H */

View file

@ -170,11 +170,8 @@ files_libglsl = files(
'ir_variable_refcount.h',
'ir_visitor.h',
'linker.cpp',
'linker.h',
'linker_util.h',
'linker_util.cpp',
'link_functions.cpp',
'link_interface_blocks.cpp',
'list.h',
'lower_builtins.cpp',
'lower_instructions.cpp',

View file

@ -53,7 +53,6 @@
#include "ir_optimization.h"
#include "ir_rvalue_visitor.h"
#include "ir_uniform.h"
#include "linker.h"
#include "nir.h"
#include "program.h"
#include "serialize.h"

View file

@ -87,14 +87,6 @@ namespace
return alu->def.bit_size;
}
char *get_fs_ir(void) {
char temp[4096];
FILE *ftemp = fmemopen(temp, sizeof(temp), "w");
_mesa_print_ir(ftemp, whole_program->_LinkedShaders[MESA_SHADER_FRAGMENT]->ir, NULL);
fclose(ftemp);
return strdup(temp);
}
/* Returns the common bit size of all src operands (failing if not matching). */
uint32_t op_src_bits(nir_op op)
{

View file

@ -2000,23 +2000,6 @@ nir_tex_src_for_ssa(nir_tex_src_type src_type, nir_def *def)
static inline nir_def *
nir_build_deriv(nir_builder *b, nir_def *x, nir_op alu, nir_intrinsic_op intrin)
{
/* For derivatives in compute shaders, GLSL_NV_compute_shader_derivatives
* states:
*
* If neither layout qualifier is specified, derivatives in compute
* shaders return zero, which is consistent with the handling of built-in
* texture functions like texture() in GLSL 4.50 compute shaders.
*
* We handle that here so the rest of the stack doesn't have to worry about
* it and for consistency with previous behaviour. In the future, we might
* move this to glsl-to-nir.
*/
if (b->shader->info.stage == MESA_SHADER_COMPUTE &&
b->shader->info.derivative_group == DERIVATIVE_GROUP_NONE) {
return nir_imm_zero(b, x->num_components, x->bit_size);
}
/* Otherwise, build the derivative instruction: either intrinsic or ALU. */
if (b->shader->options->has_ddx_intrinsics) {
if (b->shader->options->scalarize_ddx && x->num_components > 1) {

View file

@ -270,9 +270,6 @@ struct gl_linked_shader
*/
unsigned num_combined_uniform_components;
struct exec_list *ir;
struct glsl_symbol_table *symbols;
/**
* ARB_gl_spirv related data.
*