Mesa (master): spirv: Move SPIR-V building to Makefile.spirv.am and spirv/meson.build
Module: Mesa Branch: master Commit: 042ee4bea26272bd7c358cc9541e576a8352890c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=042ee4bea26272bd7c358cc9541e576a8352890c Author: Ian Romanick Date: Mon Aug 14 10:40:09 2017 -0700 spirv: Move SPIR-V building to Makefile.spirv.am and spirv/meson.build Future changes will add generated files used only from src/compiler/glsl. These can't be built from Makefile.nir.am, and we can't move all the rules from Makefile.nir.am to Makefile.spirv.am (and it would be silly anyway). v2: Do it for meson too. Signed-off-by: Ian Romanick Reviewed-by: Eric Engestrom (the meson bits) Reviewed-by: Alejandro Piñeiro (the automake bits) --- src/compiler/Makefile.am | 2 ++ src/compiler/Makefile.nir.am | 36 ++ src/compiler/Makefile.spirv.am | 58 ++ src/compiler/meson.build | 5 src/compiler/nir/meson.build | 15 --- src/compiler/spirv/meson.build | 33 6 files changed, 100 insertions(+), 49 deletions(-) diff --git a/src/compiler/Makefile.am b/src/compiler/Makefile.am index 18c062019f..8ec9b0449c 100644 --- a/src/compiler/Makefile.am +++ b/src/compiler/Makefile.am @@ -69,6 +69,8 @@ EXTRA_DIST = \ MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D) PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) +include Makefile.spirv.am + include Makefile.glsl.am include Makefile.nir.am diff --git a/src/compiler/Makefile.nir.am b/src/compiler/Makefile.nir.am index d805f573d5..32e4145b70 100644 --- a/src/compiler/Makefile.nir.am +++ b/src/compiler/Makefile.nir.am @@ -60,33 +60,6 @@ nir/nir_opt_algebraic.c: nir/nir_opt_algebraic.py nir/nir_algebraic.py $(MKDIR_GEN) $(PYTHON_GEN) $(srcdir)/nir/nir_opt_algebraic.py > $@ || ($(RM) $@; false) -spirv/spirv_info.c: spirv/spirv_info_c.py spirv/spirv.core.grammar.json - $(MKDIR_GEN) - $(PYTHON_GEN) $(srcdir)/spirv/spirv_info_c.py $(srcdir)/spirv/spirv.core.grammar.json $@ || ($(RM) $@; false) - -spirv/vtn_gather_types.c: spirv/vtn_gather_types_c.py spirv/spirv.core.grammar.json - $(MKDIR_GEN) - $(PYTHON_GEN) $(srcdir)/spirv/vtn_gather_types_c.py $(srcdir)/spirv/spirv.core.grammar.json $@ || ($(RM) $@; false) - -noinst_PROGRAMS += spirv2nir - -spirv2nir_SOURCES = \ - spirv/spirv2nir.c - -spirv2nir_CPPFLAGS = \ - $(AM_CPPFLAGS) \ - -I$(top_builddir)/src/compiler/nir \ - -I$(top_srcdir)/src/compiler/nir\ - -I$(top_srcdir)/src/compiler/spirv - -spirv2nir_LDADD = \ - nir/libnir.la \ - $(top_builddir)/src/util/libmesautil.la \ - -lm \ - $(PTHREAD_LIBS) - -nodist_EXTRA_spirv2nir_SOURCES = dummy.cpp - check_PROGRAMS += nir/tests/control_flow_tests nir_tests_control_flow_tests_CPPFLAGS = \ @@ -109,12 +82,10 @@ TESTS += nir/tests/control_flow_tests BUILT_SOURCES += \ - $(NIR_GENERATED_FILES) \ - $(SPIRV_GENERATED_FILES) + $(NIR_GENERATED_FILES) CLEANFILES += \ - $(NIR_GENERATED_FILES) \ - $(SPIRV_GENERATED_FILES) + $(NIR_GENERATED_FILES) EXTRA_DIST += \ nir/nir_algebraic.py\ @@ -129,7 +100,4 @@ EXTRA_DIST += \ nir/nir_opt_algebraic.py\ nir/tests \ nir/README \ - spirv/spirv_info_c.py \ - spirv/spirv.core.grammar.json \ - spirv/vtn_gather_types_c.py \ SConscript.nir diff --git a/src/compiler/Makefile.spirv.am b/src/compiler/Makefile.spirv.am new file mode 100644 index 00..a9f90c26e7 --- /dev/null +++ b/src/compiler/Makefile.spirv.am @@ -0,0 +1,58 @@ +# +# Copyright (C) 2017 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 +# FR
Mesa (master): i965: Don't request GLSL IR lowering of gl_VertexID
Module: Mesa Branch: master Commit: 19e0dd1ad3ad43ddc3aeba1e11852dce3f55d1f1 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=19e0dd1ad3ad43ddc3aeba1e11852dce3f55d1f1 Author: Ian Romanick Date: Wed Oct 18 08:59:47 2017 -0700 i965: Don't request GLSL IR lowering of gl_VertexID Let the lowering in NIR handle it instead. This hurts one shader that occurs twice in shader-db (SynMark GSCloth) on IVB and HSW. No other shaders or platforms were affected. total cycles in shared programs: 253438422 -> 253438426 (0.00%) cycles in affected programs: 412 -> 416 (0.97%) helped: 0 HURT: 2 Signed-off-by: Ian Romanick Reviewed-by: Antia Puentes --- src/mesa/drivers/dri/i965/brw_context.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index fca5c8e307..4e37425099 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -595,7 +595,6 @@ brw_initialize_context_constants(struct brw_context *brw) ctx->Const.QuadsFollowProvokingVertexConvention = false; ctx->Const.NativeIntegers = true; - ctx->Const.VertexID_is_zero_based = true; /* Regarding the CMP instruction, the Ivybridge PRM says: * ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): util: Optimize util_is_power_of_two_nonzero
Module: Mesa Branch: master Commit: ef7a4c90155cb180a4f0d289594ef11da9a2b21a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ef7a4c90155cb180a4f0d289594ef11da9a2b21a Author: Ian Romanick Date: Mon Nov 13 13:11:09 2017 -0800 util: Optimize util_is_power_of_two_nonzero Signed-off-by: Ian Romanick Suggested-by: Matt Turner Reviewed-by: Eduardo Lima Mitev --- src/util/bitscan.h | 17 + 1 file changed, 17 insertions(+) diff --git a/src/util/bitscan.h b/src/util/bitscan.h index a3f2d414bd..5cc75f0beb 100644 --- a/src/util/bitscan.h +++ b/src/util/bitscan.h @@ -38,6 +38,10 @@ #include #endif +#if defined(__POPCNT__) +#include +#endif + #include "c99_compat.h" #ifdef __cplusplus @@ -127,7 +131,20 @@ util_is_power_of_two_or_zero(unsigned v) static inline bool util_is_power_of_two_nonzero(unsigned v) { + /* __POPCNT__ is different from HAVE___BUILTIN_POPCOUNT. The latter +* indicates the existence of the __builtin_popcount function. The former +* indicates that _mm_popcnt_u32 exists and is a native instruction. +* +* The other alternative is to use SSE 4.2 compile-time flags. This has +* two drawbacks. First, there is currently no build infrastructure for +* SSE 4.2 (only 4.1), so that would have to be added. Second, some AMD +* CPUs support POPCNT but not SSE 4.2 (e.g., Barcelona). +*/ +#ifdef __POPCNT__ + return _mm_popcnt_u32(v) == 1; +#else return v != 0 && (v & (v - 1)) == 0; +#endif } /* For looping over a bitmask when you want to loop over consecutive bits ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): util: Add and use util_is_power_of_two_nonzero
Module: Mesa Branch: master Commit: 22fbb5c5949b1590ef04b6432dd7f3a93a37c2ed URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=22fbb5c5949b1590ef04b6432dd7f3a93a37c2ed Author: Ian Romanick Date: Mon Nov 13 13:00:53 2017 -0800 util: Add and use util_is_power_of_two_nonzero Signed-off-by: Ian Romanick Reviewed-by: Eduardo Lima Mitev --- src/compiler/nir/nir_search_helpers.h | 13 - src/compiler/nir/nir_validate.c | 2 +- src/gallium/drivers/etnaviv/etnaviv_blt.c | 2 +- src/intel/compiler/brw_fs.cpp | 4 ++-- src/util/bitscan.h| 11 +++ 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/compiler/nir/nir_search_helpers.h b/src/compiler/nir/nir_search_helpers.h index 2d399bd5dc..8bc6d723c3 100644 --- a/src/compiler/nir/nir_search_helpers.h +++ b/src/compiler/nir/nir_search_helpers.h @@ -28,12 +28,7 @@ #define _NIR_SEARCH_HELPERS_ #include "nir.h" - -static inline bool -__is_power_of_two(unsigned int x) -{ - return ((x != 0) && !(x & (x - 1))); -} +#include "util/bitscan.h" static inline bool is_pos_power_of_two(nir_alu_instr *instr, unsigned src, unsigned num_components, @@ -50,11 +45,11 @@ is_pos_power_of_two(nir_alu_instr *instr, unsigned src, unsigned num_components, case nir_type_int: if (val->i32[swizzle[i]] < 0) return false; - if (!__is_power_of_two(val->i32[swizzle[i]])) + if (!util_is_power_of_two_nonzero(val->i32[swizzle[i]])) return false; break; case nir_type_uint: - if (!__is_power_of_two(val->u32[swizzle[i]])) + if (!util_is_power_of_two_nonzero(val->u32[swizzle[i]])) return false; break; default: @@ -80,7 +75,7 @@ is_neg_power_of_two(nir_alu_instr *instr, unsigned src, unsigned num_components, case nir_type_int: if (val->i32[swizzle[i]] > 0) return false; - if (!__is_power_of_two(abs(val->i32[swizzle[i]]))) + if (!util_is_power_of_two_nonzero(abs(val->i32[swizzle[i]]))) return false; break; default: diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c index 725ba43152..565cb2ef16 100644 --- a/src/compiler/nir/nir_validate.c +++ b/src/compiler/nir/nir_validate.c @@ -982,7 +982,7 @@ validate_var_decl(nir_variable *var, bool is_global, validate_state *state) validate_assert(state, is_global == nir_variable_is_global(var)); /* Must have exactly one mode set */ - validate_assert(state, util_bitcount(var->data.mode) == 1); + validate_assert(state, util_is_power_of_two_nonzero(var->data.mode)); if (var->data.compact) { /* The "compact" flag is only valid on arrays of scalars. */ diff --git a/src/gallium/drivers/etnaviv/etnaviv_blt.c b/src/gallium/drivers/etnaviv/etnaviv_blt.c index c30c11ab61..52731a9c77 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_blt.c +++ b/src/gallium/drivers/etnaviv/etnaviv_blt.c @@ -178,7 +178,7 @@ emit_blt_copyimage(struct etna_cmd_stream *stream, const struct blt_imgcopy_op * static void emit_blt_inplace(struct etna_cmd_stream *stream, const struct blt_inplace_op *op) { - assert(op->bpp > 0 && util_is_power_of_two_or_zero(op->bpp)); + assert(op->bpp > 0 && util_is_power_of_two_nonzero(op->bpp)); etna_cmd_stream_reserve(stream, 64*2); /* Never allow BLT sequences to be broken up */ etna_set_state(stream, VIVS_BLT_ENABLE, 0x0001); etna_set_state(stream, VIVS_BLT_CONFIG, diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp index fdcc909a3d..40896db26b 100644 --- a/src/intel/compiler/brw_fs.cpp +++ b/src/intel/compiler/brw_fs.cpp @@ -1976,7 +1976,7 @@ struct cplx_align { static void cplx_align_assert_sane(struct cplx_align a) { - assert(a.mul > 0 && util_is_power_of_two_or_zero(a.mul)); + assert(a.mul > 0 && util_is_power_of_two_nonzero(a.mul)); assert(a.offset < a.mul); } @@ -2028,7 +2028,7 @@ static void mark_uniform_slots_read(struct uniform_slot_info *slots, unsigned num_slots, unsigned alignment) { - assert(alignment > 0 && util_is_power_of_two_or_zero(alignment)); + assert(alignment > 0 && util_is_power_of_two_nonzero(alignment)); assert(alignment <= CPLX_ALIGN_MAX_MUL); /* We can't align a slot to anything less than the slot size */ diff --git a/src/util/bitscan.h b/src/util/bitscan.h index 2d4e46ec0f..a3f2d414bd 100644 --- a/src/util/bitscan.h +++ b/src/util/bitscan.h @@ -119,6 +119,17 @@ util_is_power_of_two_or_zero(unsigned v) return (v & (v - 1)) == 0; } +/* Determine if an unsigned value is a power of two. + * + * \note + * Zero is \b not treated as a power of two. + */ +static inline bool +util_is_power_of_two_nonzero(unsigned v) +{ + return v != 0 && (v & (v - 1)) == 0; +} + /* For looping over a bitmask when you want to loop over consecutive bits * manually, for example: *
Mesa (master): compiler: All leaf Makefile.am should use +=
Module: Mesa Branch: master Commit: 2c9621ee5c5fa40be071858f99fb256fc37369b4 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2c9621ee5c5fa40be071858f99fb256fc37369b4 Author: Ian Romanick Date: Mon Aug 14 10:38:10 2017 -0700 compiler: All leaf Makefile.am should use += This slightly simplifies later changes that add more Makefile.*.am files. Signed-off-by: Ian Romanick Reviewed-by: Eduardo Lima Mitev --- src/compiler/Makefile.am | 1 + src/compiler/Makefile.glsl.am | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/Makefile.am b/src/compiler/Makefile.am index fd6811ff26..18c062019f 100644 --- a/src/compiler/Makefile.am +++ b/src/compiler/Makefile.am @@ -53,6 +53,7 @@ noinst_LTLIBRARIES = libcompiler.la libcompiler_la_SOURCES = $(LIBCOMPILER_FILES) +noinst_PROGRAMS = check_PROGRAMS = TESTS = BUILT_SOURCES = diff --git a/src/compiler/Makefile.glsl.am b/src/compiler/Makefile.glsl.am index 179f415fe6..ad19b14e44 100644 --- a/src/compiler/Makefile.glsl.am +++ b/src/compiler/Makefile.glsl.am @@ -54,7 +54,7 @@ check_PROGRAMS += \ glsl/tests/sampler-types-test \ glsl/tests/uniform-initializer-test -noinst_PROGRAMS = glsl_compiler +noinst_PROGRAMS += glsl_compiler glsl_tests_blob_test_SOURCES = \ glsl/tests/blob_test.c ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): util: Move util_is_power_of_two to bitscan.h and rename to util_is_power_of_two_or_zero
Module: Mesa Branch: master Commit: d76c204d0564701b4b8b6a2bdda50e2939683e66 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d76c204d0564701b4b8b6a2bdda50e2939683e66 Author: Ian Romanick Date: Mon Nov 13 11:17:41 2017 -0800 util: Move util_is_power_of_two to bitscan.h and rename to util_is_power_of_two_or_zero The new name make the zero-input behavior more obvious. The next patch adds a new function with different zero-input behavior. Signed-off-by: Ian Romanick Suggested-by: Matt Turner Reviewed-by: Alejandro Piñeiro --- src/amd/common/ac_gpu_info.c | 4 ++-- src/amd/common/ac_surface.c | 2 +- src/amd/vulkan/radv_formats.c| 4 ++-- src/broadcom/compiler/nir_to_vir.c | 4 ++-- src/gallium/auxiliary/gallivm/lp_bld_arit.c | 2 +- src/gallium/auxiliary/gallivm/lp_bld_debug.cpp | 2 +- src/gallium/auxiliary/gallivm/lp_bld_format_aos.c| 4 ++-- src/gallium/auxiliary/gallivm/lp_bld_gather.c| 8 src/gallium/auxiliary/gallivm/lp_bld_pack.c | 2 +- src/gallium/auxiliary/gallivm/lp_bld_sample.c| 6 +++--- src/gallium/auxiliary/util/u_math.h | 10 +- src/gallium/auxiliary/util/u_ringbuffer.c| 2 +- src/gallium/drivers/etnaviv/etnaviv_blt.c| 2 +- src/gallium/drivers/etnaviv/etnaviv_texture_state.c | 3 ++- src/gallium/drivers/freedreno/freedreno_query_hw.c | 2 +- src/gallium/drivers/i915/i915_state_sampler.c| 3 ++- src/gallium/drivers/llvmpipe/lp_state_fs.c | 2 +- src/gallium/drivers/llvmpipe/lp_texture.c| 2 +- src/gallium/drivers/nouveau/codegen/nv50_ir.cpp | 2 +- src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 4 ++-- src/gallium/drivers/nouveau/nv30/nv30_miptree.c | 6 +++--- src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c | 2 +- src/gallium/drivers/r300/r300_texture_desc.c | 6 +++--- src/gallium/drivers/r600/r600_texture.c | 2 +- src/gallium/drivers/radeon/r600_texture.c| 2 +- src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c | 2 +- src/gallium/drivers/softpipe/sp_texture.c| 12 ++-- src/gallium/drivers/swr/swr_screen.cpp | 4 ++-- src/gallium/drivers/vc4/vc4_program.c| 4 ++-- src/intel/compiler/brw_fs.cpp| 4 ++-- src/intel/vulkan/anv_allocator.c | 6 +++--- src/intel/vulkan/anv_formats.c | 4 ++-- src/intel/vulkan/anv_nir_lower_multiview.c | 2 +- src/mesa/state_tracker/st_cb_readpixels.c| 4 ++-- src/mesa/state_tracker/st_cb_texture.c | 6 +++--- src/util/bitscan.h | 12 src/util/u_vector.c | 4 ++-- 37 files changed, 79 insertions(+), 73 deletions(-) diff --git a/src/amd/common/ac_gpu_info.c b/src/amd/common/ac_gpu_info.c index 73fc36203c..f93ef4cbad 100644 --- a/src/amd/common/ac_gpu_info.c +++ b/src/amd/common/ac_gpu_info.c @@ -333,8 +333,8 @@ bool ac_query_gpu_info(int fd, amdgpu_device_handle dev, } info->has_virtual_memory = true; - assert(util_is_power_of_two(dma.available_rings + 1)); - assert(util_is_power_of_two(compute.available_rings + 1)); + assert(util_is_power_of_two_or_zero(dma.available_rings + 1)); + assert(util_is_power_of_two_or_zero(compute.available_rings + 1)); info->num_sdma_rings = util_bitcount(dma.available_rings); info->num_compute_rings = util_bitcount(compute.available_rings); diff --git a/src/amd/common/ac_surface.c b/src/amd/common/ac_surface.c index 81882576ba..1e1641daee 100644 --- a/src/amd/common/ac_surface.c +++ b/src/amd/common/ac_surface.c @@ -275,7 +275,7 @@ static int gfx6_compute_level(ADDR_HANDLE addrlib, AddrSurfInfoIn->bpp) { unsigned alignment = 256 / (AddrSurfInfoIn->bpp / 8); - assert(util_is_power_of_two(AddrSurfInfoIn->bpp)); + assert(util_is_power_of_two_or_zero(AddrSurfInfoIn->bpp)); AddrSurfInfoIn->width = align(AddrSurfInfoIn->width, alignment); } diff --git a/src/amd/vulkan/radv_formats.c b/src/amd/vulkan/radv_formats.c index efb1d78790..1bafe09e77 100644 --- a/src/amd/vulkan/radv_formats.c +++ b/src/amd/vulkan/radv_formats.c @@ -638,13 +638,13 @@ radv_physical_device_get_format_properties(struct radv_physical_device *physical tiled |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT; } } - if (tiled && util_is_power_of_two(vk_format_get_blocksize(format)) && !scaled) { + if (tiled && util_is_po
Mesa (master): util: Include bitscan.h directly
Module: Mesa Branch: master Commit: 4925347ec5d469574f1280e972940cfea345ed6e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4925347ec5d469574f1280e972940cfea345ed6e Author: Ian Romanick Date: Wed Jul 26 13:32:01 2017 -0700 util: Include bitscan.h directly Previously bitset.h would include u_math.h to get bitscan.h. u_math.h lives in src/gallium/auxiliary/util while both bitset.h and bitscan.h live in src/util. Having the one file directly include another file that lives in the same directory makes much more sense. As a side-effect, several files need to directly include standard header files that were previously indirectly included. v2: Fix build break in src/amd/common/ac_nir_to_llvm.c. Signed-off-by: Ian Romanick Reviewed-by: Eduardo Lima Mitev --- src/amd/common/ac_nir_to_llvm.c | 1 + src/compiler/nir/nir.c | 1 + src/compiler/spirv/vtn_alu.c | 1 + src/compiler/spirv/vtn_glsl450.c | 1 + src/util/bitset.h| 2 +- 5 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 7efbe4b31a..053c19808f 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -28,6 +28,7 @@ #include "sid.h" #include "nir/nir.h" #include "util/bitscan.h" +#include "util/u_math.h" #include "ac_shader_abi.h" #include "ac_shader_util.h" diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index a97b119bf7..3fb16e6ca5 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -28,6 +28,7 @@ #include "nir.h" #include "nir_control_flow_private.h" #include "util/half_float.h" +#include #include #include diff --git a/src/compiler/spirv/vtn_alu.c b/src/compiler/spirv/vtn_alu.c index 01be397e27..fc378495b8 100644 --- a/src/compiler/spirv/vtn_alu.c +++ b/src/compiler/spirv/vtn_alu.c @@ -21,6 +21,7 @@ * IN THE SOFTWARE. */ +#include #include "vtn_private.h" /* diff --git a/src/compiler/spirv/vtn_glsl450.c b/src/compiler/spirv/vtn_glsl450.c index 7d32914d51..eb0b90f797 100644 --- a/src/compiler/spirv/vtn_glsl450.c +++ b/src/compiler/spirv/vtn_glsl450.c @@ -25,6 +25,7 @@ * */ +#include #include "vtn_private.h" #include "GLSL.std.450.h" diff --git a/src/util/bitset.h b/src/util/bitset.h index b4c2152023..75e29a9a51 100644 --- a/src/util/bitset.h +++ b/src/util/bitset.h @@ -31,7 +31,7 @@ #ifndef BITSET_H #define BITSET_H -#include "util/u_math.h" +#include "util/bitscan.h" / * generic bitset implementation ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965: Silence unused parameter warning
Module: Mesa Branch: master Commit: 2765633116da69c194fd815303605e91285201bb URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2765633116da69c194fd815303605e91285201bb Author: Ian Romanick Date: Mon Mar 26 17:25:27 2018 -0700 i965: Silence unused parameter warning src/mesa/drivers/dri/i965/brw_draw_upload.c: In function ‘double_types’: src/mesa/drivers/dri/i965/brw_draw_upload.c:225:34: warning: unused parameter ‘brw’ [-Wunused-parameter] double_types(struct brw_context *brw, ^~~ Signed-off-by: Ian Romanick Reviewed-by: Alejandro Piñeiro --- src/mesa/drivers/dri/i965/brw_draw_upload.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index 4ede33aea1..344e2f2b4e 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -222,9 +222,7 @@ static const GLuint byte_types_scale[5] = { }; static GLuint -double_types(struct brw_context *brw, - int size, - GLboolean doubles) +double_types(int size, GLboolean doubles) { /* From the BDW PRM, Volume 2d, page 588 (VERTEX_ELEMENT_STATE): * "When SourceElementFormat is set to one of the *64*_PASSTHRU formats, @@ -292,7 +290,7 @@ brw_get_vertex_surface_type(struct brw_context *brw, return ISL_FORMAT_R11G11B10_FLOAT; } else if (glattrib->Normalized) { switch (glattrib->Type) { - case GL_DOUBLE: return double_types(brw, size, glattrib->Doubles); + case GL_DOUBLE: return double_types(size, glattrib->Doubles); case GL_FLOAT: return float_types[size]; case GL_HALF_FLOAT: case GL_HALF_FLOAT_OES: @@ -371,7 +369,7 @@ brw_get_vertex_surface_type(struct brw_context *brw, } assert(glattrib->Format == GL_RGBA); /* sanity check */ switch (glattrib->Type) { - case GL_DOUBLE: return double_types(brw, size, glattrib->Doubles); + case GL_DOUBLE: return double_types(size, glattrib->Doubles); case GL_FLOAT: return float_types[size]; case GL_HALF_FLOAT: case GL_HALF_FLOAT_OES: ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): util: Use util_is_power_of_two_nonzero in u_vector
Module: Mesa Branch: master Commit: cd18aa1e50e4668c8d992816bcdb74376dd1064c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=cd18aa1e50e4668c8d992816bcdb74376dd1064c Author: Ian Romanick Date: Mon Mar 26 10:52:43 2018 -0700 util: Use util_is_power_of_two_nonzero in u_vector Previously size=0, element_size=0 would have been allowed. That combination can only lead to despair. Signed-off-by: Ian Romanick Reviewed-by: Alejandro Piñeiro --- src/util/u_vector.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/u_vector.c b/src/util/u_vector.c index bec6e5bbc3..15f8ed6bda 100644 --- a/src/util/u_vector.c +++ b/src/util/u_vector.c @@ -37,8 +37,8 @@ int u_vector_init(struct u_vector *vector, uint32_t element_size, uint32_t size) { - assert(util_is_power_of_two_or_zero(size)); - assert(element_size < size && util_is_power_of_two_or_zero(element_size)); + assert(util_is_power_of_two_nonzero(size)); + assert(element_size < size && util_is_power_of_two_nonzero(element_size)); vector->head = 0; vector->tail = 0; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): meson: Use the same version for all libdrm checks
Module: Mesa Branch: master Commit: c445b1d56f47922206de55e557444aadb62e11f6 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c445b1d56f47922206de55e557444aadb62e11f6 Author: Dylan Baker Date: Mon Mar 12 16:32:59 2018 -0700 meson: Use the same version for all libdrm checks Currently each driver specifies it's own version, and core libdrm specifies a version. In the most common case this is fine, since there will be exactly one libdrm installed on a system, but if there are more than one it's possible that mesa will be linked against different versions of libdrm. There is also the possibility that the current approach makes the pkg-config files we generate incorrect, since there could be #defines that use newer features if they're available. This patch corrects all of that. All of the versions are still set by driver (along with a default core version). Then all of the drivers that are enabled have their versions compared and the highest version is selected, then all libdrm checks are made with that version. v2: - Reorder the list to have the name first and whether the dependency is needed second (Eric) Signed-off-by: Dylan Baker Reviewed-by: Eric Engestrom --- meson.build | 66 + 1 file changed, 45 insertions(+), 21 deletions(-) diff --git a/meson.build b/meson.build index cfb40deaaf..ee2b4151e2 100644 --- a/meson.build +++ b/meson.build @@ -1020,35 +1020,59 @@ dep_expat = dependency('expat') # its not linux and and wont dep_m = cc.find_library('m', required : false) +# Check for libdrm. various drivers have different libdrm version requirements, +# but we always want to use the same version for all libdrm modules. That means +# even if driver foo requires 2.4.0 and driver bar requires 2.4.3, if foo and +# bar are both on use 2.4.3 for both of them dep_libdrm_amdgpu = [] dep_libdrm_radeon = [] dep_libdrm_nouveau = [] dep_libdrm_etnaviv = [] dep_libdrm_freedreno = [] dep_libdrm_intel = [] -if with_dri_i915 or with_gallium_i915 - dep_libdrm_intel = dependency('libdrm_intel', version : '>= 2.4.75') -endif -if with_amd_vk or with_gallium_radeonsi - dep_libdrm_amdgpu = dependency('libdrm_amdgpu', version : '>= 2.4.91') -endif -if (with_gallium_radeonsi or with_dri_r100 or with_dri_r200 or -with_gallium_r300 or with_gallium_r600) - dep_libdrm_radeon = dependency('libdrm_radeon', version : '>= 2.4.71') -endif -if with_gallium_nouveau or with_dri_nouveau - dep_libdrm_nouveau = dependency('libdrm_nouveau', version : '>= 2.4.66') -endif -if with_gallium_etnaviv - dep_libdrm_etnaviv = dependency('libdrm_etnaviv', version : '>= 2.4.82') -endif -if with_gallium_freedreno - dep_libdrm_freedreno = dependency('libdrm_freedreno', version : '>= 2.4.91') -endif + +_drm_amdgpu_ver = '2.4.91' +_drm_radeon_ver = '2.4.71' +_drm_nouveau_ver = '2.4.66' +_drm_etnaviv_ver = '2.4.82' +_drm_freedreno_ver = '2.4.91' +_drm_intel_ver = '2.4.75' +_drm_ver = '2.4.75' + +_libdrm_checks = [ + ['intel', with_dri_i915 or with_gallium_i915], + ['amdgpu', with_amd_vk or with_gallium_radeonsi], + ['radeon', (with_gallium_radeonsi or with_dri_r100 or with_dri_r200 or + with_gallium_r300 or with_gallium_r600)], + ['nouveau', (with_gallium_nouveau or with_dri_nouveau)], + ['etnaviv', with_gallium_etnaviv], + ['freedreno', with_gallium_freedreno], +] + +# Loop over the enables versions and get the highest libdrm requirement for all +# active drivers. +foreach d : _libdrm_checks + ver = get_variable('_drm_@0@_ver'.format(d[0])) + if d[1] and ver.version_compare('>' + _drm_ver) +_drm_ver = ver + endif +endforeach + +# Then get each libdrm module +foreach d : _libdrm_checks + if d[1] +set_variable( + 'dep_libdrm_' + d[0], + dependency('libdrm_' + d[0], version : '>=' + _drm_ver) +) + endif +endforeach with_gallium_drisw_kms = false -dep_libdrm = dependency('libdrm', version : '>= 2.4.75', -required : with_dri2 or with_dri3) +dep_libdrm = dependency( + 'libdrm', version : '>=' + _drm_ver, + required : with_dri2 or with_dri3 +) if dep_libdrm.found() pre_args += '-DHAVE_LIBDRM' if with_dri_platform == 'drm' and with_dri ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): meson: use dep_libdrm version for pkg-config
Module: Mesa Branch: master Commit: a3a16d4aa7e5a22816226d8e7417138164b10525 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a3a16d4aa7e5a22816226d8e7417138164b10525 Author: Dylan Baker Date: Mon Mar 12 16:39:01 2018 -0700 meson: use dep_libdrm version for pkg-config This corrects pkg-config to use the libdrm version (as computed by the previous patch) instead of using a hardcoded value that may or may not (probably not) be right. Signed-off-by: Dylan Baker Reviewed-by: Eric Engestrom --- src/gallium/targets/d3dadapter9/meson.build | 2 +- src/mesa/drivers/dri/meson.build| 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/targets/d3dadapter9/meson.build b/src/gallium/targets/d3dadapter9/meson.build index e3f4ae58f5..2cdc0e0e1f 100644 --- a/src/gallium/targets/d3dadapter9/meson.build +++ b/src/gallium/targets/d3dadapter9/meson.build @@ -71,6 +71,6 @@ pkg.generate( name : 'd3d', description : 'Native D3D driver modules', version : '.'.join(nine_version), - requires_private : 'libdrm >= 2.4.75', + requires_private : 'libdrm >= ' + dep_libdrm.version(), variables : ['moduledir=${prefix}/@0@'.format(d3d_drivers_path)], ) diff --git a/src/mesa/drivers/dri/meson.build b/src/mesa/drivers/dri/meson.build index 6342168ab3..8e23fd43ad 100644 --- a/src/mesa/drivers/dri/meson.build +++ b/src/mesa/drivers/dri/meson.build @@ -69,7 +69,7 @@ endif if with_dri dri_req_private = [] if dep_libdrm.found() -dri_req_private = ['libdrm >= 2.4.75'] # FIXME: don't hardcode this +dri_req_private = ['libdrm >= ' + dep_libdrm.version()] endif pkg.generate( ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): meson: group libdrm dependencies
Module: Mesa Branch: master Commit: acadf06f564da15c0bfc44265e804b866fbb9cb3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=acadf06f564da15c0bfc44265e804b866fbb9cb3 Author: Dylan Baker Date: Mon Mar 12 15:58:40 2018 -0700 meson: group libdrm dependencies The reason libdrm is after libdrm_* will be made clear in later patches. Signed-off-by: Dylan Baker Reviewed-by: Eric Engestrom --- meson.build | 29 ++--- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/meson.build b/meson.build index f210eeb253..cfb40deaaf 100644 --- a/meson.build +++ b/meson.build @@ -230,11 +230,6 @@ if with_gallium_tegra and not with_gallium_nouveau error('tegra driver requires nouveau driver') endif -dep_libdrm_intel = [] -if with_dri_i915 or with_gallium_i915 - dep_libdrm_intel = dependency('libdrm_intel', version : '>= 2.4.75') -endif - if host_machine.system() == 'darwin' with_dri_platform = 'apple' elif ['windows', 'cygwin'].contains(host_machine.system()) @@ -1005,16 +1000,6 @@ else dep_clock = cc.find_library('rt') endif -with_gallium_drisw_kms = false -dep_libdrm = dependency('libdrm', version : '>= 2.4.75', -required : with_dri2 or with_dri3) -if dep_libdrm.found() - pre_args += '-DHAVE_LIBDRM' - if with_dri_platform == 'drm' and with_dri -with_gallium_drisw_kms = true - endif -endif - # TODO: some of these may be conditional dep_zlib = dependency('zlib', version : '>= 1.2.3') pre_args += '-DHAVE_ZLIB' @@ -1040,6 +1025,10 @@ dep_libdrm_radeon = [] dep_libdrm_nouveau = [] dep_libdrm_etnaviv = [] dep_libdrm_freedreno = [] +dep_libdrm_intel = [] +if with_dri_i915 or with_gallium_i915 + dep_libdrm_intel = dependency('libdrm_intel', version : '>= 2.4.75') +endif if with_amd_vk or with_gallium_radeonsi dep_libdrm_amdgpu = dependency('libdrm_amdgpu', version : '>= 2.4.91') endif @@ -1057,6 +1046,16 @@ if with_gallium_freedreno dep_libdrm_freedreno = dependency('libdrm_freedreno', version : '>= 2.4.91') endif +with_gallium_drisw_kms = false +dep_libdrm = dependency('libdrm', version : '>= 2.4.75', +required : with_dri2 or with_dri3) +if dep_libdrm.found() + pre_args += '-DHAVE_LIBDRM' + if with_dri_platform == 'drm' and with_dri +with_gallium_drisw_kms = true + endif +endif + llvm_modules = ['bitwriter', 'engine', 'mcdisassembler', 'mcjit'] if with_amd_vk or with_gallium_radeonsi or with_gallium_r600 llvm_modules += ['amdgpu', 'bitreader', 'ipo'] ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gl.h: remove stale comment, trailing whitespace
Module: Mesa Branch: master Commit: e520ca562a410d3dc3708515b44ca09a50c59830 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e520ca562a410d3dc3708515b44ca09a50c59830 Author: Brian Paul Date: Tue Mar 27 12:56:19 2018 -0600 gl.h: remove stale comment, trailing whitespace Reviewed-by: Emil Velikov --- include/GL/gl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/GL/gl.h b/include/GL/gl.h index 5b28480288..f5bac3670a 100644 --- a/include/GL/gl.h +++ b/include/GL/gl.h @@ -47,9 +47,9 @@ #define GLAPI __declspec(dllimport) # else /* for use with static link lib build of Win32 edition only */ #define GLAPI extern -# endif /* _STATIC_MESA support */ +# endif # if defined(__MINGW32__) && defined(GL_NO_STDCALL) || defined(UNDER_CE) /* The generated DLLs by MingW with STDCALL are not compatible with the ones done by Microsoft's compilers */ -#define GLAPIENTRY +#define GLAPIENTRY # else #define GLAPIENTRY __stdcall # endif ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glapi: add glBlendBarrier(), glPrimitiveBoundingBox() prototypes
Module: Mesa Branch: master Commit: 4ff6a7b0de47b1f4037068497281aa824ddb914a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4ff6a7b0de47b1f4037068497281aa824ddb914a Author: Brian Paul Date: Mon Mar 26 16:47:46 2018 -0600 glapi: add glBlendBarrier(), glPrimitiveBoundingBox() prototypes in glapi_dispatch.c, as we have for many other GLES functions. Fixes a cross-compile issue (missing prototype) when GLES support is disabled. Reviewed-by: Sinclair Yeh --- src/mapi/glapi/glapi_dispatch.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mapi/glapi/glapi_dispatch.c b/src/mapi/glapi/glapi_dispatch.c index 269adc7ea0..323952366d 100644 --- a/src/mapi/glapi/glapi_dispatch.c +++ b/src/mapi/glapi/glapi_dispatch.c @@ -143,6 +143,8 @@ GL_API void GL_APIENTRY glTexParameterx (GLenum target, GLenum pname, GLfixed pa GL_API void GL_APIENTRY glTexParameterxv (GLenum target, GLenum pname, const GLfixed *params); GL_API void GL_APIENTRY glTranslatex (GLfixed x, GLfixed y, GLfixed z); GL_API void GL_APIENTRY glPointSizePointerOES (GLenum type, GLsizei stride, const GLvoid *pointer); +GL_API void GL_APIENTRY glBlendBarrier (void); +GL_API void GL_APIENTRY glPrimitiveBoundingBox (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); /* Enable frame pointer elimination on Windows, otherwise forgetting to add * APIENTRY to _mesa_* entrypoints will not cause crashes on debug builds, as ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/mesa: silence unhandled switch case warning
Module: Mesa Branch: master Commit: 5cd5878a1f8cbd2d878f0941d86f33530950acb4 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5cd5878a1f8cbd2d878f0941d86f33530950acb4 Author: Brian Paul Date: Thu Mar 22 09:23:09 2018 -0600 st/mesa: silence unhandled switch case warning And improve the unreachable() error message. Reviewed-by: Mathias Fröhlich --- src/mesa/state_tracker/st_glsl_types.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_glsl_types.cpp b/src/mesa/state_tracker/st_glsl_types.cpp index ef7b7fa777..baba2d414b 100644 --- a/src/mesa/state_tracker/st_glsl_types.cpp +++ b/src/mesa/state_tracker/st_glsl_types.cpp @@ -146,7 +146,8 @@ st_glsl_type_dword_size(const struct glsl_type *type) case GLSL_TYPE_ERROR: case GLSL_TYPE_INTERFACE: case GLSL_TYPE_FUNCTION: - unreachable("not reached"); + default: + unreachable("invalid type in st_glsl_type_dword_size()"); } return 0; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: Inherit texture view multi-sample information from the original texture images.
Module: Mesa Branch: master Commit: 0b73c86b8030a7f7cb35fc85c83eff7f2b8c24a4 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0b73c86b8030a7f7cb35fc85c83eff7f2b8c24a4 Author: Henri Verbeet Date: Mon Mar 26 19:24:08 2018 +0430 mesa: Inherit texture view multi-sample information from the original texture images. Found running "The Witness" in Wine. Without this patch, texture views created on multi-sample textures would have a GL_TEXTURE_SAMPLES of 0. All things considered such views actually work surprisingly well, but when combined with (plain) multi-sample textures in a framebuffer object, the resulting FBO is incomplete because the sample counts don't match. CC: Signed-off-by: Henri Verbeet Reviewed-by: Brian Paul --- src/mesa/main/teximage.c| 20 ++-- src/mesa/main/teximage.h| 8 src/mesa/main/textureview.c | 12 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 9e139d746f..8f5351085c 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -837,8 +837,8 @@ clear_teximage_fields(struct gl_texture_image *img) * Fills in the fields of \p img with the given information. * Note: width, height and depth include the border. */ -static void -init_teximage_fields_ms(struct gl_context *ctx, +void +_mesa_init_teximage_fields_ms(struct gl_context *ctx, struct gl_texture_image *img, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum internalFormat, @@ -950,8 +950,8 @@ _mesa_init_teximage_fields(struct gl_context *ctx, GLint border, GLenum internalFormat, mesa_format format) { - init_teximage_fields_ms(ctx, img, width, height, depth, border, - internalFormat, format, 0, GL_TRUE); + _mesa_init_teximage_fields_ms(ctx, img, width, height, depth, border, + internalFormat, format, 0, GL_TRUE); } @@ -5891,9 +5891,9 @@ texture_image_multisample(struct gl_context *ctx, GLuint dims, if (_mesa_is_proxy_texture(target)) { if (samplesOK && dimensionsOK && sizeOK) { - init_teximage_fields_ms(ctx, texImage, width, height, depth, 0, - internalformat, texFormat, - samples, fixedsamplelocations); + _mesa_init_teximage_fields_ms(ctx, texImage, width, height, depth, 0, + internalformat, texFormat, + samples, fixedsamplelocations); } else { /* clear all image fields */ @@ -5920,9 +5920,9 @@ texture_image_multisample(struct gl_context *ctx, GLuint dims, ctx->Driver.FreeTextureImageBuffer(ctx, texImage); - init_teximage_fields_ms(ctx, texImage, width, height, depth, 0, - internalformat, texFormat, - samples, fixedsamplelocations); + _mesa_init_teximage_fields_ms(ctx, texImage, width, height, depth, 0, +internalformat, texFormat, +samples, fixedsamplelocations); if (width > 0 && height > 0 && depth > 0) { if (memObj) { diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h index 2e950bf42b..bf790af276 100644 --- a/src/mesa/main/teximage.h +++ b/src/mesa/main/teximage.h @@ -130,6 +130,14 @@ _mesa_init_teximage_fields(struct gl_context *ctx, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum internalFormat, mesa_format format); +extern void +_mesa_init_teximage_fields_ms(struct gl_context *ctx, + struct gl_texture_image *img, + GLsizei width, GLsizei height, GLsizei depth, + GLint border, GLenum internalFormat, + mesa_format format, + GLuint numSamples, + GLboolean fixedSampleLocations); extern mesa_format diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c index 89af068fae..9a064ffd71 100644 --- a/src/mesa/main/textureview.c +++ b/src/mesa/main/textureview.c @@ -304,7 +304,8 @@ initialize_texture_fields(struct gl_context *ctx, struct gl_texture_object *texObj, GLint levels, GLsizei width, GLsizei height, GLsizei depth, - GLenum internalFormat, mesa_format texFormat) + GLenum internalFormat, mesa_format texFormat, + GLuint numSamples, GLboolean fixedSampleLocations) { const GLuint numFaces = _mesa_num_tex_faces(target); GLint level, levelWidth = w
Mesa (master): radv: fix scanning output_usage_mask with structs
Module: Mesa Branch: master Commit: e45fe0ed66af32a36b03d5a5141e68fad0d15e6a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e45fe0ed66af32a36b03d5a5141e68fad0d15e6a Author: Samuel Pitoiset Date: Thu Mar 22 18:38:04 2018 +0100 radv: fix scanning output_usage_mask with structs To fix a regression in: dEQP-VK.spirv_assembly.instruction.graphics.variable_init.output.struct And the following regressions (Polaris only): dEQP-VK.glsl.indexing.varying_array.* Fixes: f3275ca01c ("ac/nir: only enable used channels when exporting parameters") Signed-off-by: Samuel Pitoiset Reviewed-by: Dave Airlie --- src/amd/vulkan/radv_shader_info.c | 56 --- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/src/amd/vulkan/radv_shader_info.c b/src/amd/vulkan/radv_shader_info.c index 47389d1b88..1fb350faed 100644 --- a/src/amd/vulkan/radv_shader_info.c +++ b/src/amd/vulkan/radv_shader_info.c @@ -47,6 +47,46 @@ static void mark_tess_output(struct radv_shader_info *info, info->tcs.outputs_written |= (mask << param); } +static void get_deref_offset(nir_deref_var *deref, unsigned *const_out) +{ + nir_deref *tail = &deref->deref; + unsigned const_offset = 0; + + if (deref->var->data.compact) { + assert(tail->child->deref_type == nir_deref_type_array); + assert(glsl_type_is_scalar(glsl_without_array(deref->var->type))); + + nir_deref_array *deref_array = nir_deref_as_array(tail->child); + /* We always lower indirect dereferences for "compact" array vars. */ + assert(deref_array->deref_array_type == nir_deref_array_type_direct); + + *const_out = deref_array->base_offset; + return; + } + + while (tail->child != NULL) { + const struct glsl_type *parent_type = tail->type; + tail = tail->child; + + if (tail->deref_type == nir_deref_type_array) { + nir_deref_array *deref_array = nir_deref_as_array(tail); + unsigned size = glsl_count_attribute_slots(tail->type, false); + + const_offset += size * deref_array->base_offset; + } else if (tail->deref_type == nir_deref_type_struct) { + nir_deref_struct *deref_struct = nir_deref_as_struct(tail); + + for (unsigned i = 0; i < deref_struct->index; i++) { + const struct glsl_type *ft = glsl_get_struct_field(parent_type, i); + const_offset += glsl_count_attribute_slots(ft, false); + } + } else + unreachable("unsupported deref type"); + } + + *const_out = const_offset; +} + static void gather_intrinsic_info(const nir_shader *nir, const nir_intrinsic_instr *instr, struct radv_shader_info *info) @@ -174,15 +214,23 @@ gather_intrinsic_info(const nir_shader *nir, const nir_intrinsic_instr *instr, nir_variable *var = dvar->var; if (var->data.mode == nir_var_shader_out) { + unsigned attrib_count = glsl_count_attribute_slots(var->type, false); unsigned idx = var->data.location; unsigned comp = var->data.location_frac; + unsigned const_offset = 0; + + get_deref_offset(dvar, &const_offset); if (nir->info.stage == MESA_SHADER_VERTEX) { - info->vs.output_usage_mask[idx] |= - instr->const_index[0] << comp; + for (unsigned i = 0; i < attrib_count; i++) { + info->vs.output_usage_mask[idx + i + const_offset] |= + instr->const_index[0] << comp; + } } else if (nir->info.stage == MESA_SHADER_TESS_EVAL) { - info->tes.output_usage_mask[idx] |= - instr->const_index[0] << comp; + for (unsigned i = 0; i < attrib_count; i++) { + info->tes.output_usage_mask[idx + i + const_offset] |= + instr->const_index[0] << comp; + } } else if (nir->info.stage == MESA_SHADER_TESS_CTRL) { unsigned param = shader_io_get_unique_index(idx); const struct glsl_type *type = var->type; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit