* DEALINGS IN THE SOFTWARE.
*/
-#include "ir.h"
-#include "glsl_types.h"
-#include "ir_visitor.h"
-#include "../glsl/program.h"
-#include "program/hash_table.h"
-#include "ir_uniform.h"
-
-extern "C" {
-#include "main/compiler.h"
#include "main/mtypes.h"
+#include "glsl/nir/glsl_types.h"
+#include "glsl/ir.h"
+#include "glsl/ir_uniform.h"
+#include "glsl/ir_visitor.h"
+#include "glsl/program.h"
+#include "program/hash_table.h"
#include "program/prog_parameter.h"
#include "program/program.h"
-}
+
class get_sampler_name : public ir_hierarchical_visitor
{
};
-extern "C" int
+int
_mesa_get_sampler_uniform_value(class ir_dereference *sampler,
struct gl_shader_program *shader_program,
const struct gl_program *prog)
{
get_sampler_name getname(sampler, shader_program);
- GLuint shader = _mesa_program_target_to_index(prog->Target);
+ GLuint shader = _mesa_program_enum_to_shader_stage(prog->Target);
sampler->accept(&getname);
return 0;
}
- if (!shader_program->UniformStorage[location].sampler[shader].active) {
+ if (!shader_program->UniformStorage[location].opaque[shader].active) {
assert(0 && "cannot return a sampler");
linker_error(shader_program,
"cannot return a sampler named %s, because it is not "
return 0;
}
- return shader_program->UniformStorage[location].sampler[shader].index +
+ return shader_program->UniformStorage[location].opaque[shader].index +
getname.offset;
}
+
+
+class ir_rvalue *
+_mesa_get_sampler_array_nonconst_index(class ir_dereference *sampler)
+{
+ ir_dereference_array *deref_arr = sampler->as_dereference_array();
+ if (!deref_arr || deref_arr->array_index->as_constant())
+ return NULL;
+
+ return deref_arr->array_index;
+}