head 1.1; branch 1.1.1; access; symbols netbsd-11-0-RC5:1.1.1.1 netbsd-11-0-RC4:1.1.1.1 netbsd-11-0-RC3:1.1.1.1 netbsd-11-0-RC2:1.1.1.1 netbsd-11-0-RC1:1.1.1.1 netbsd-11:1.1.1.1.0.4 netbsd-11-base:1.1.1.1 netbsd-10-1-RELEASE:1.1.1.1 netbsd-10-0-RELEASE:1.1.1.1 netbsd-10-0-RC6:1.1.1.1 netbsd-10-0-RC5:1.1.1.1 netbsd-10-0-RC4:1.1.1.1 netbsd-10-0-RC3:1.1.1.1 netbsd-10-0-RC2:1.1.1.1 netbsd-10-0-RC1:1.1.1.1 netbsd-10:1.1.1.1.0.2 netbsd-10-base:1.1.1.1 mesa-21-3-7:1.1.1.1 mesalib-19-1-7:1.1.1.1 xorg:1.1.1; locks; strict; comment @# @; 1.1 date 2019.09.24.16.40.25; author maya; state Exp; branches 1.1.1.1; next ; commitid KJXusGl8fi9AAhEB; 1.1.1.1 date 2019.09.24.16.40.25; author maya; state Exp; branches; next ; commitid KJXusGl8fi9AAhEB; desc @@ 1.1 log @Initial revision @ text @/* Compile with: * * glsl_compiler --version 400 --dump-builder int64.glsl > builtin_int64.h * * Version 4.00+ is required for umulExtended. */ #version 400 #extension GL_ARB_gpu_shader_int64: require #extension GL_ARB_shading_language_420pack: require uvec2 umul64(uvec2 a, uvec2 b) { uvec2 result; umulExtended(a.x, b.x, result.y, result.x); result.y += a.x * b.y + a.y * b.x; return result; } ivec2 sign64(ivec2 a) { ivec2 result; result.y = a.y >> 31; result.x = result.y | int((a.x | a.y) != 0); return result; } uvec4 udivmod64(uvec2 n, uvec2 d) { uvec2 quot = uvec2(0U, 0U); int log2_denom = findMSB(d.y) + 32; /* If the upper 32 bits of denom are non-zero, it is impossible for shifts * greater than 32 bits to occur. If the upper 32 bits of the numerator * are zero, it is impossible for (denom << [63, 32]) <= numer unless * denom == 0. */ if (d.y == 0 && n.y >= d.x) { log2_denom = findMSB(d.x); /* Since the upper 32 bits of denom are zero, log2_denom <= 31 and we * don't have to compare log2_denom inside the loop as is done in the * general case (below). */ for (int i = 31; i >= 1; i--) { if (log2_denom <= 31 - i && (d.x << i) <= n.y) { n.y -= d.x << i; quot.y |= 1U << i; } } /* log2_denom is always <= 31, so manually peel the last loop * iteration. */ if (d.x <= n.y) { n.y -= d.x; quot.y |= 1U; } } uint64_t d64 = packUint2x32(d); uint64_t n64 = packUint2x32(n); for (int i = 31; i >= 1; i--) { if (log2_denom <= 63 - i && (d64 << i) <= n64) { n64 -= d64 << i; quot.x |= 1U << i; } } /* log2_denom is always <= 63, so manually peel the last loop * iteration. */ if (d64 <= n64) { n64 -= d64; quot.x |= 1U; } return uvec4(quot, unpackUint2x32(n64)); } uvec2 udiv64(uvec2 n, uvec2 d) { return udivmod64(n, d).xy; } ivec2 idiv64(ivec2 _n, ivec2 _d) { const bool negate = (_n.y < 0) != (_d.y < 0); uvec2 n = unpackUint2x32(uint64_t(abs(packInt2x32(_n)))); uvec2 d = unpackUint2x32(uint64_t(abs(packInt2x32(_d)))); uvec2 quot = udivmod64(n, d).xy; return negate ? unpackInt2x32(-int64_t(packUint2x32(quot))) : ivec2(quot); } uvec2 umod64(uvec2 n, uvec2 d) { return udivmod64(n, d).zw; } ivec2 imod64(ivec2 _n, ivec2 _d) { const bool negate = (_n.y < 0) != (_d.y < 0); uvec2 n = unpackUint2x32(uint64_t(abs(packInt2x32(_n)))); uvec2 d = unpackUint2x32(uint64_t(abs(packInt2x32(_d)))); uvec2 rem = udivmod64(n, d).zw; return negate ? unpackInt2x32(-int64_t(packUint2x32(rem))) : ivec2(rem); } @ 1.1.1.1 log @Import mesa 19.1.7 New features in mesa 19.1.0: GL_ARB_parallel_shader_compile on all drivers. GL_EXT_gpu_shader4 on all GL 3.1 drivers. GL_EXT_shader_image_load_formatted on radeonsi. GL_EXT_texture_buffer_object on all GL 3.1 drivers. GL_EXT_texture_compression_s3tc_srgb on Gallium drivers and i965 (ES extension). GL_NV_compute_shader_derivatives on iris and i965. GL_KHR_parallel_shader_compile on all drivers. VK_EXT_buffer_device_address on Intel and RADV. VK_EXT_depth_clip_enable on Intel and RADV. VK_KHR_ycbcr_image_arrays on Intel. VK_EXT_inline_uniform_block on Intel and RADV. VK_EXT_external_memory_host on Intel. VK_EXT_host_query_reset on Intel and RADV. VK_KHR_surface_protected_capabilities on Intel and RADV. VK_EXT_pipeline_creation_feedback on Intel and RADV. VK_KHR_8bit_storage on RADV. VK_AMD_gpu_shader_int16 on RADV. VK_AMD_gpu_shader_half_float on RADV. VK_NV_compute_shader_derivatives on Intel. VK_KHR_shader_float16_int8 on Intel and RADV (RADV only supports int8). VK_KHR_shader_atomic_int64 on Intel. VK_EXT_descriptor_indexing on Intel. VK_KHR_shader_float16_int8 on Intel and RADV. GL_INTEL_conservative_rasterization on iris. VK_EXT_memory_budget on Intel. New features in mesa 19.0.0: GL_AMD_texture_texture4 on all GL 4.0 drivers. GL_EXT_shader_implicit_conversions on all drivers (ES extension). GL_EXT_texture_compression_bptc on all GL 4.0 drivers (ES extension). GL_EXT_texture_compression_rgtc on all GL 3.0 drivers (ES extension). GL_EXT_render_snorm on gallium drivers (ES extension). GL_EXT_texture_view on drivers supporting texture views (ES extension). GL_OES_texture_view on drivers supporting texture views (ES extension). GL_NV_shader_atomic_float on nvc0 (Fermi/Kepler only). Shader-based software implementations of GL_ARB_gpu_shader_fp64, GL_ARB_gpu_shader_int64, GL_ARB_vertex_attrib_64bit, and GL_ARB_shader_ballot on i965. VK_ANDROID_external_memory_android_hardware_buffer on Intel Fixed and re-exposed VK_EXT_pci_bus_info on Intel and RADV VK_EXT_scalar_block_layout on Intel and RADV VK_KHR_depth_stencil_resolve on Intel VK_KHR_draw_indirect_count on Intel VK_EXT_conditional_rendering on Intel VK_EXT_memory_budget on RADV Also, bug fixes. @ text @@