aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/program
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/program')
-rw-r--r--mesalib/src/mesa/program/Android.mk14
-rw-r--r--mesalib/src/mesa/program/hash_table.h4
-rw-r--r--mesalib/src/mesa/program/prog_cache.c2
-rw-r--r--mesalib/src/mesa/program/prog_to_nir.c25
4 files changed, 30 insertions, 15 deletions
diff --git a/mesalib/src/mesa/program/Android.mk b/mesalib/src/mesa/program/Android.mk
index a237b65bc..ccb0fa5f3 100644
--- a/mesalib/src/mesa/program/Android.mk
+++ b/mesalib/src/mesa/program/Android.mk
@@ -44,8 +44,9 @@ include $(CLEAR_VARS)
LOCAL_MODULE := libmesa_program
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+LOCAL_STATIC_LIBRARIES := libmesa_glsl
-intermediates := $(call local-intermediates-dir)
+intermediates := $(call local-generated-sources-dir)
# TODO(chadv): In Makefile.sources, move these vars to a different list so we can
# remove this kludge.
@@ -55,7 +56,8 @@ generated_sources_basenames := \
program_parse.tab.h
LOCAL_SRC_FILES := \
- $(filter-out $(generated_sources_basenames),$(subst program/,,$(PROGRAM_FILES)))
+ $(filter-out $(generated_sources_basenames),$(subst program/,,$(PROGRAM_FILES))) \
+ $(subst program/,,$(PROGRAM_NIR_FILES))
LOCAL_GENERATED_SOURCES := \
$(addprefix $(intermediates)/program/,$(generated_sources_basenames))
@@ -70,11 +72,13 @@ $(intermediates)/program/lex.yy.c: $(LOCAL_PATH)/program_lexer.l
$(local-l-to-c)
LOCAL_C_INCLUDES := \
- $(intermediates) \
- $(MESA_TOP)/src \
$(MESA_TOP)/src/mapi \
$(MESA_TOP)/src/mesa \
- $(MESA_TOP)/src/glsl
+ $(MESA_TOP)/src/glsl \
+ $(MESA_TOP)/src/gallium/auxiliary \
+ $(MESA_TOP)/src/gallium/include
+
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(intermediates)
include $(MESA_COMMON_MK)
include $(BUILD_STATIC_LIBRARY)
diff --git a/mesalib/src/mesa/program/hash_table.h b/mesalib/src/mesa/program/hash_table.h
index eed2e55dc..e85a836a0 100644
--- a/mesalib/src/mesa/program/hash_table.h
+++ b/mesalib/src/mesa/program/hash_table.h
@@ -116,8 +116,8 @@ extern void hash_table_insert(struct hash_table *ht, void *data,
* Add an element to a hash table with replacement
*
* \return
- * 1 if it did replace the the value (in which case the old key is kept), 0 if
- * it did not replace the value (in which case the new key is kept).
+ * 1 if it did replace the value (in which case the old key is kept), 0 if it
+ * did not replace the value (in which case the new key is kept).
*
* \warning
* If \c key is already in the hash table, \c data will \b replace the most
diff --git a/mesalib/src/mesa/program/prog_cache.c b/mesalib/src/mesa/program/prog_cache.c
index 34609f056..ed93af7f1 100644
--- a/mesalib/src/mesa/program/prog_cache.c
+++ b/mesalib/src/mesa/program/prog_cache.c
@@ -77,7 +77,7 @@ hash_key(const void *key, GLuint key_size)
/**
- * Rebuild/expand the hash table to accomodate more entries
+ * Rebuild/expand the hash table to accommodate more entries
*/
static void
rehash(struct gl_program_cache *cache)
diff --git a/mesalib/src/mesa/program/prog_to_nir.c b/mesalib/src/mesa/program/prog_to_nir.c
index c738f5073..ff3d9f3be 100644
--- a/mesalib/src/mesa/program/prog_to_nir.c
+++ b/mesalib/src/mesa/program/prog_to_nir.c
@@ -222,12 +222,23 @@ ptn_get_src(struct ptn_compile *c, const struct prog_src_register *prog_src)
}
nir_ssa_def *def;
- if (!HAS_EXTENDED_SWIZZLE(prog_src->Swizzle)) {
+ if (!HAS_EXTENDED_SWIZZLE(prog_src->Swizzle) &&
+ (prog_src->Negate == NEGATE_NONE || prog_src->Negate == NEGATE_XYZW)) {
+ /* The simple non-SWZ case. */
for (int i = 0; i < 4; i++)
src.swizzle[i] = GET_SWZ(prog_src->Swizzle, i);
def = nir_fmov_alu(b, src, 4);
+
+ if (prog_src->Abs)
+ def = nir_fabs(b, def);
+
+ if (prog_src->Negate)
+ def = nir_fneg(b, def);
} else {
+ /* The SWZ instruction allows per-component zero/one swizzles, and also
+ * per-component negation.
+ */
nir_ssa_def *chans[4];
for (int i = 0; i < 4; i++) {
int swizzle = GET_SWZ(prog_src->Swizzle, i);
@@ -246,16 +257,16 @@ ptn_get_src(struct ptn_compile *c, const struct prog_src_register *prog_src)
chans[i] = &mov->dest.dest.ssa;
}
+
+ if (prog_src->Abs)
+ chans[i] = nir_fabs(b, chans[i]);
+
+ if (prog_src->Negate & (1 << i))
+ chans[i] = nir_fneg(b, chans[i]);
}
def = nir_vec4(b, chans[0], chans[1], chans[2], chans[3]);
}
- if (prog_src->Abs)
- def = nir_fabs(b, def);
-
- if (prog_src->Negate)
- def = nir_fneg(b, def);
-
return def;
}