Files
intel-hard-graphics/flake.nix
T
elwrclandClaude Opus 5 636d2c2f70 hasvk: Add host_image_copy, H.264 encode and a batch of gen7 fixes.
Squashed work that had been sitting in the working tree. Grouped by area:

Extensions
  VK_EXT_host_image_copy, with a MEMCPY_BIT path that reads and writes the
  image's own tiled layout, VkSubresourceHostMemcpySizeEXT filled in, and
  VkHostImageCopyDevicePerformanceQueryEXT answered.  Depth/stencil and
  non-power-of-two bpb stay NotSupported.
  VK_EXT_pipeline_robustness, VK_KHR_shader_float_controls2,
  VK_KHR_shader_subgroup_rotate, VK_EXT_vertex_input_dynamic_state,
  VK_EXT_conditional_rendering (an MI_PREDICATE path for gen7, which has no
  GPRs), custom_border_color, border_color_swizzle, map_memory2,
  load_store_op_none, depth_clamp_zero_one,
  dynamic_rendering_unused_attachments, index_type_uint8,
  line_rasterization, vertex_attribute_divisor, mutable_descriptor_type.

H.264 encode
  MFC command emission and a bitstream writer, driving intra-only encode
  through the video queue.  Video profile reporting was also corrected from
  270 combinations down to the 11 that actually exist.

Correctness
  gfx7 routes typed surface writes through the render cache, so
  VK_ACCESS_SHADER_WRITE barriers have to flush it -- without that, nothing a
  fragment shader stored was visible.
  nir_opt_algebraic's fadd->flrp fusion rules dropped signed zero; '~' only
  excludes nir_fp_exact, not preserve_signed_zero, so reflect() with a -0
  input came out wrong.  Guarded with (nsz).
  Stop advertising STORAGE_READ_WITHOUT_FORMAT: shaderStorageImageReadWithout-
  Format is false here, and since Vulkan 1.3 the per-format bit is what grants
  permission, so reporting it while rejecting the pipeline is a contradiction.
  gfx7's typed data port ignores SURFTYPE_NULL -- the null surface still has
  one addressable texel, which read and wrote graphics address zero.  Bounds
  check typed image access against the image param when nullDescriptor is
  enabled, the same trick lower_image_atomic_instr already used on IVB.
  Formats that require a sampler Y'CbCr conversion no longer report
  BLIT_SRC/BLIT_DST/STORAGE_IMAGE.  Video decode does not need them.
  Check the surface state allocations in emit_binding_table() and in the push
  descriptor path instead of writing through a NULL map in release builds.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-08-09 00:32:40 +03:00

201 lines
6.0 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
description = "intel-hard-graphics / clvk development";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs =
{ self, nixpkgs }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
# HD 4000 (Gen7) PCI ID: 8086:0166
pciId = "8086:0166";
defaultClvkBuildDir = "/home/elars/ProjectsHDD/Drivers/clvk/build";
commonBuildInputs = with pkgs; [
llvmPackages_21.clang-unwrapped
llvmPackages_21.llvm.dev
llvmPackages_21.libclang
llvmPackages_21.bintools
python3Packages.packaging
python3Packages.pyyaml
python3Packages.mako
python3
cargo
meson
ninja
pkg-config
spirv-llvm-translator
spirv-tools
rust-bindgen
rustc
vkmark
vulkan-headers
vulkan-loader
vulkan-tools
shaderc
libpciaccess
opencl-headers
libclc
bison
flex
libdrm
libelf
expat
zlib
zstd
libx11
ocl-icd
libxcb
cmake
libxext
libxfixes
libxrandr
libxshmfence
wayland
wayland-protocols
wayland-scanner
xorgproto
xorg.libXxf86vm
xorg.xcbutilkeysyms
(python3.withPackages (
ps: with ps; [
pyopencl
opencv4
numpy
]
))
clinfo
strace
clpeak
pocl
gdb
];
commonShellVars = ''
export LIBRARY_PATH=${pkgs.llvmPackages_21.clang-unwrapped.lib}/lib:$LIBRARY_PATH
export LIBCLANG_PATH=${pkgs.llvmPackages_21.libclang.lib}/lib
export BINDGEN_EXTRA_CLANG_ARGS="-I${pkgs.llvmPackages_21.clang-unwrapped}/lib/clang/21/include"
export C_INCLUDE_PATH=${pkgs.opencl-headers}/include:$C_INCLUDE_PATH
export LIBRARY_PATH=${pkgs.ocl-icd}/lib:$LIBRARY_PATH
export LD_LIBRARY_PATH="${pkgs.vulkan-loader}/lib:${pkgs.zlib}/lib:${pkgs.stdenv.cc.cc.lib}/lib:$LD_LIBRARY_PATH"
'';
# 32-bit (i686) build için: L4D2 gibi 32-bit oyunlarla test amaçlı.
# clvk/rusticl/OpenCL burada yok — sadece hasvk (vulkan_hasvk) + crocus
# için gereken Vulkan/GL/WSI kütüphaneleri, i686 varyantlarıyla.
pkgs32 = pkgs.pkgsi686Linux;
i686BuildInputs = with pkgs32; [
libdrm
libelf
libpciaccess
expat
zlib
zstd
libx11
libxcb
libxext
libxfixes
libxrandr
libxshmfence
wayland
wayland-protocols
xorgproto
xorg.libXxf86vm
xorg.xcbutilkeysyms
vulkan-headers
vulkan-loader
llvmPackages_21.llvm.dev
llvmPackages_21.clang-unwrapped
llvmPackages_21.libclang
spirv-llvm-translator
spirv-tools
libclc
# crocus + hasvk (with_driver_using_cl) libclc'ye hard-dependency,
# rusticl/opencl kapalı olsa bile gerekiyor
];
# Build araçları (meson/ninja/python/bison/flex/pkg-config vs.) i686'da
# da bulunur ama host mimarisinde çalıştırılmaları yeterli; yine de
# pkgsi686Linux'tan almak pkg-config'in .pc arama yollarını tutarlı
# tutar. cmake/rust burada gerekmiyor (clvk 32-bit hedefi değil).
i686NativeBuildInputs = with pkgs32; [
meson
ninja
pkg-config
python3
python3Packages.packaging
python3Packages.pyyaml
python3Packages.mako
bison
flex
wayland-scanner
];
in
{
devShells.${system} = {
# nix develop = intel-hard-graphics shell
default = pkgs.mkShell {
buildInputs = commonBuildInputs;
shellHook = ''
${commonShellVars}
export LD_LIBRARY_PATH=$PWD/build/src/gallium/targets/rusticl:$LD_LIBRARY_PATH
export RUSTICL_ENABLE=crocus
mkdir -p $PWD/.icd-vendors
ln -sf $PWD/build/src/gallium/targets/rusticl/rusticl.icd $PWD/.icd-vendors/rusticl.icd
ln -sf ${pkgs.pocl}/etc/OpenCL/vendors/pocl.icd $PWD/.icd-vendors/pocl.icd
export OCL_ICD_VENDORS=$PWD/.icd-vendors
echo "=== intel-hard-graphics ==="
echo "OCL_ICD_VENDORS=$OCL_ICD_VENDORS"
echo "RUSTICL_ENABLE=$RUSTICL_ENABLE"
echo ""
'';
};
# nix develop .#clvk = clvk shell
clvk = pkgs.mkShell {
buildInputs = commonBuildInputs;
shellHook = ''
${commonShellVars}
CLVK_BUILD_DIR="''${CLVK_BUILD_DIR:-${defaultClvkBuildDir}}"
if [ ! -d "$CLVK_BUILD_DIR" ]; then
echo "UYARI: clvk build dizini bulunamadi: $CLVK_BUILD_DIR"
echo "CLVK_BUILD_DIR ortam degiskeniyle dogru yolu ver, ornek:"
echo " CLVK_BUILD_DIR=/gercek/yol nix develop .#clvk"
else
export LD_LIBRARY_PATH="$CLVK_BUILD_DIR:$LD_LIBRARY_PATH"
fi
export MESA_VK_DEVICE_SELECT="${pciId}"
echo "=== clvk ==="
echo "CLVK_BUILD_DIR=$CLVK_BUILD_DIR"
echo "MESA_VK_DEVICE_SELECT=$MESA_VK_DEVICE_SELECT"
echo ""
'';
};
# nix develop .#i686 = 32-bit hasvk/crocus build shell (L4D2 testi için)
i686 = pkgs32.mkShell {
buildInputs = i686BuildInputs;
nativeBuildInputs = i686NativeBuildInputs;
shellHook = ''
export MESA_VK_DEVICE_SELECT="${pciId}"
echo "=== intel-hard-graphics (i686 / 32-bit) ==="
echo "CC=$CC"
echo "meson setup build32 --buildtype=debugoptimized \\"
echo " -Dgallium-drivers=crocus -Dvulkan-drivers=intel_hasvk \\"
echo " -Dplatforms=x11 -Degl=disabled -Dglx=disabled -Dgbm=disabled \\"
echo " -Dopengl=false -Dgles1=disabled -Dgles2=disabled \\"
echo " -Dgallium-rusticl=false -Dmicrosoft-clc=disabled -Dllvm=enabled"
echo ""
'';
};
};
};
}