}
}
-static unsigned
-panfrost_translate_alt_compare_func(enum pipe_compare_func in)
-{
- switch (in) {
- case PIPE_FUNC_NEVER:
- return MALI_ALT_FUNC_NEVER;
-
- case PIPE_FUNC_LESS:
- return MALI_ALT_FUNC_LESS;
-
- case PIPE_FUNC_EQUAL:
- return MALI_ALT_FUNC_EQUAL;
-
- case PIPE_FUNC_LEQUAL:
- return MALI_ALT_FUNC_LEQUAL;
-
- case PIPE_FUNC_GREATER:
- return MALI_ALT_FUNC_GREATER;
-
- case PIPE_FUNC_NOTEQUAL:
- return MALI_ALT_FUNC_NOTEQUAL;
-
- case PIPE_FUNC_GEQUAL:
- return MALI_ALT_FUNC_GEQUAL;
-
- case PIPE_FUNC_ALWAYS:
- return MALI_ALT_FUNC_ALWAYS;
-
- default:
- unreachable("Invalid alt func");
- }
-}
-
static unsigned
panfrost_translate_stencil_op(enum pipe_stencil_op in)
{
.wrap_s = translate_tex_wrap(cso->wrap_s),
.wrap_t = translate_tex_wrap(cso->wrap_t),
.wrap_r = translate_tex_wrap(cso->wrap_r),
- .compare_func = panfrost_translate_alt_compare_func(cso->compare_func),
+ .compare_func = panfrost_flip_compare_func(
+ panfrost_translate_compare_func(
+ cso->compare_func)),
.border_color = {
cso->border_color.f[0],
cso->border_color.f[1],
encoder/pan_attributes.c \
encoder/pan_encoder.h \
encoder/pan_invocation.c \
+ encoder/pan_sampler.c
encoder/pan_tiler.c \
encoder/pan_scratch.c
'pan_attributes.c',
'pan_invocation.c',
+ 'pan_sampler.c',
'pan_tiler.c',
'pan_scratch.c',
'pan_props.c',
void panfrost_vertex_id(unsigned padded_count, union mali_attr *attr);
void panfrost_instance_id(unsigned padded_count, union mali_attr *attr);
+/* Samplers */
+
+enum mali_func
+panfrost_flip_compare_func(enum mali_func f);
+
#endif
--- /dev/null
+/*
+ * Copyright (C) 2019 Collabora, Ltd.
+ *
+ * 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 "pan_encoder.h"
+
+/* Sampler comparison functions are flipped in OpenGL from the hardware, so we
+ * need to be able to flip accordingly */
+
+enum mali_func
+panfrost_flip_compare_func(enum mali_func f)
+{
+ switch (f) {
+ case MALI_FUNC_LESS:
+ return MALI_FUNC_GREATER;
+ case MALI_FUNC_GREATER:
+ return MALI_FUNC_LESS;
+ case MALI_FUNC_LEQUAL:
+ return MALI_FUNC_GEQUAL;
+ case MALI_FUNC_GEQUAL:
+ return MALI_FUNC_LEQUAL;
+ default:
+ return f;
+ }
+}
MALI_FUNC_ALWAYS = 7
};
-/* Same OpenGL, but mixed up. Why? Because forget me, that's why! */
-
-enum mali_alt_func {
- MALI_ALT_FUNC_NEVER = 0,
- MALI_ALT_FUNC_GREATER = 1,
- MALI_ALT_FUNC_EQUAL = 2,
- MALI_ALT_FUNC_GEQUAL = 3,
- MALI_ALT_FUNC_LESS = 4,
- MALI_ALT_FUNC_NOTEQUAL = 5,
- MALI_ALT_FUNC_LEQUAL = 6,
- MALI_ALT_FUNC_ALWAYS = 7
-};
-
/* Flags apply to unknown2_3? */
#define MALI_HAS_MSAA (1 << 0)
uint16_t min_lod;
uint16_t max_lod;
- /* All one word in reality, but packed a bit */
+ /* All one word in reality, but packed a bit. Comparisons are flipped
+ * from OpenGL. */
enum mali_wrap_mode wrap_s : 4;
enum mali_wrap_mode wrap_t : 4;
enum mali_wrap_mode wrap_r : 4;
- enum mali_alt_func compare_func : 3;
+ enum mali_func compare_func : 3;
/* No effect on 2D textures. For cubemaps, set for ES3 and clear for
* ES2, controlling seamless cubemapping */
}
#undef DEFINE_CASE
-/* Why is this duplicated? Who knows... */
-#define DEFINE_CASE(name) case MALI_ALT_FUNC_ ## name: return "MALI_ALT_FUNC_" #name
-static char *
-pandecode_alt_func(enum mali_alt_func mode)
-{
- switch (mode) {
- DEFINE_CASE(NEVER);
- DEFINE_CASE(LESS);
- DEFINE_CASE(EQUAL);
- DEFINE_CASE(LEQUAL);
- DEFINE_CASE(GREATER);
- DEFINE_CASE(NOTEQUAL);
- DEFINE_CASE(GEQUAL);
- DEFINE_CASE(ALWAYS);
-
- default:
- pandecode_msg("XXX: invalid alt func %X\n", mode);
- return "";
- }
-}
-#undef DEFINE_CASE
-
#define DEFINE_CASE(name) case MALI_STENCIL_ ## name: return "MALI_STENCIL_" #name
static char *
pandecode_stencil_op(enum mali_stencil_op op)
pandecode_prop("wrap_t = %s", pandecode_wrap_mode(s->wrap_t));
pandecode_prop("wrap_r = %s", pandecode_wrap_mode(s->wrap_r));
- pandecode_prop("compare_func = %s", pandecode_alt_func(s->compare_func));
+ pandecode_prop("compare_func = %s", pandecode_func(s->compare_func));
if (s->zero || s->zero2) {
pandecode_msg("XXX: sampler zero tripped\n");