* The same is done for the gl_FragData fragment shader output.
*/
-#include "main/core.h" /* for snprintf and ARRAY_SIZE */
#include "ir.h"
#include "ir_rvalue_visitor.h"
#include "ir_optimization.h"
#include "ir_print_visitor.h"
#include "compiler/glsl_types.h"
#include "link_varyings.h"
+#include "main/mtypes.h"
+#include "util/u_string.h"
namespace {
!is_gl_identifier(var->name))
return visit_continue;
- /* Only match gl_FragData[], not gl_SecondaryFragDataEXT[] */
- if (this->find_frag_outputs && var->data.location == FRAG_RESULT_DATA0 &&
- var->data.index == 0) {
+ /* Only match gl_FragData[], not gl_SecondaryFragDataEXT[] or
+ * gl_LastFragData[].
+ */
+ if (this->find_frag_outputs && strcmp(var->name, "gl_FragData") == 0) {
this->fragdata_array = var;
ir_constant *index = ir->array_index->as_constant();
tfeedback_decl *tfeedback_decls)
{
/* Lower the gl_FragData array to separate variables. */
- if (consumer && consumer->Stage == MESA_SHADER_FRAGMENT) {
+ if (consumer && consumer->Stage == MESA_SHADER_FRAGMENT &&
+ !ctx->Const.ShaderCompilerOptions[MESA_SHADER_FRAGMENT].NirOptions) {
lower_fragdata_array(consumer);
}
if (producer) {
producer_info.get(producer->ir, num_tfeedback_decls, tfeedback_decls);
+ if (producer->Stage == MESA_SHADER_TESS_CTRL)
+ producer_info.lower_texcoord_array = false;
+
if (!consumer) {
/* At least eliminate unused gl_TexCoord elements. */
if (producer_info.lower_texcoord_array) {
if (consumer) {
consumer_info.get(consumer->ir, 0, NULL);
+ if (consumer->Stage != MESA_SHADER_FRAGMENT)
+ consumer_info.lower_texcoord_array = false;
+
if (!producer) {
/* At least eliminate unused gl_TexCoord elements. */
if (consumer_info.lower_texcoord_array) {