🔧 Make nix develop work
Signed-off-by: Julius Koskela <julius.koskela@unikie.com>
This commit is contained in:
parent
f7b29baf95
commit
0d701a49b6
76
default.nix
76
default.nix
@ -1,45 +1,41 @@
|
|||||||
{pkgs}:
|
{pkgs}: let
|
||||||
with pkgs;
|
manifest = (pkgs.lib.importTOML ./Cargo.toml).package;
|
||||||
rustPlatform.buildRustPackage {
|
buildInputs = with pkgs; [
|
||||||
pname = "matmul-vshader";
|
udev
|
||||||
version = "0.1.0";
|
alsa-lib
|
||||||
|
vulkan-loader
|
||||||
|
vulkan-headers
|
||||||
|
vulkan-tools
|
||||||
|
vulkan-validation-layers
|
||||||
|
xorg.libX11
|
||||||
|
xorg.libXcursor
|
||||||
|
xorg.libXi
|
||||||
|
xorg.libXrandr # To use the x11 feature
|
||||||
|
libxkbcommon
|
||||||
|
wayland # To use the wayland feature
|
||||||
|
];
|
||||||
|
in
|
||||||
|
pkgs.rustPlatform.buildRustPackage {
|
||||||
|
inherit buildInputs;
|
||||||
|
pname = manifest.name;
|
||||||
|
version = manifest.version;
|
||||||
|
|
||||||
src = ./.;
|
src = pkgs.lib.cleanSource ./.;
|
||||||
|
|
||||||
packages = [cmake shaderc];
|
nativeBuildInputs = with pkgs; [
|
||||||
buildInputs = [cmake shaderc];
|
pkg-config
|
||||||
nativeBuildInputs = [
|
];
|
||||||
vulkan-headers
|
|
||||||
vulkan-loader
|
|
||||||
vulkan-validation-layers
|
|
||||||
vulkan-tools
|
|
||||||
pkg-config
|
|
||||||
git
|
|
||||||
gcc
|
|
||||||
cmake
|
|
||||||
glibc
|
|
||||||
python3
|
|
||||||
shaderc
|
|
||||||
];
|
|
||||||
|
|
||||||
RUST_BACKTRACE = "1";
|
preConfigure = ''
|
||||||
# LD_LIBRARY_PATH = "${vulkan-loader}/lib:${vulkan-validation-layers}/lib:${vulkan-tools}/lib:${vulkan-headers}/lib:${pkgs.stdenv.cc.cc.lib}:${pkgs.stdenv.cc.cc.lib64}";
|
LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath buildInputs}
|
||||||
# VK_ICD_FILENAMES = "${vulkan-loader}/share/vulkan/icd.d/radeon_icd64.json";
|
'';
|
||||||
# VK_LAYER_PATH = "${vulkan-validation-layers}/share/vulkan/explicit_layer.d";
|
|
||||||
# VK_INSTANCE_LAYERS = "VK_LAYER_KHRONOS_validation";
|
|
||||||
# VK_DEVICE_LAYERS = "VK_LAYER_KHRONOS_validation";
|
|
||||||
# VK_LOADER_DEBUG = "all";
|
|
||||||
# VK_LOADER_DEBUG_FILE = "/tmp/vulkan.log";
|
|
||||||
# VK_INSTANCE_EXTENSIONS = "VK_EXT_debug_utils";
|
|
||||||
# VK_DEVICE_EXTENSIONS = "VK_EXT_debug_utils";
|
|
||||||
# VK_LAYER_ENABLES = "VK_LAYER_KHRONOS_validation";
|
|
||||||
# VK_LAYER_DISABLES = "VK_LAYER_LUNARG_api_dump";
|
|
||||||
# VK_LAYER_PATH = "${vulkan-validation-layers}/share/vulkan/explicit_layer.d";
|
|
||||||
|
|
||||||
cargoBuildFlags = ["--release"];
|
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;
|
||||||
|
|
||||||
cargoLock = {
|
cargoBuildFlags = ["--release"];
|
||||||
lockFile = ./Cargo.lock;
|
|
||||||
allowBuiltinFetchGit = true;
|
cargoLock = {
|
||||||
};
|
lockFile = ./Cargo.lock;
|
||||||
}
|
allowBuiltinFetchGit = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
nixpkgs,
|
nixpkgs,
|
||||||
}: {
|
}: {
|
||||||
packages.x86_64-linux.default = nixpkgs.legacyPackages.x86_64-linux.callPackage ./default.nix {};
|
packages.x86_64-linux.default = nixpkgs.legacyPackages.x86_64-linux.callPackage ./default.nix {};
|
||||||
devShells.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.callPackage ./shell.nix {};
|
|
||||||
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
|
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
30
shell.nix
30
shell.nix
@ -1,30 +0,0 @@
|
|||||||
let
|
|
||||||
nixpkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz") {};
|
|
||||||
in
|
|
||||||
with nixpkgs; let
|
|
||||||
buildInputs = [
|
|
||||||
udev
|
|
||||||
alsa-lib
|
|
||||||
vulkan-loader
|
|
||||||
vulkan-headers
|
|
||||||
vulkan-tools
|
|
||||||
vulkan-validation-layers
|
|
||||||
xorg.libX11
|
|
||||||
xorg.libXcursor
|
|
||||||
xorg.libXi
|
|
||||||
xorg.libXrandr # To use the x11 feature
|
|
||||||
libxkbcommon
|
|
||||||
wayland # To use the wayland feature
|
|
||||||
];
|
|
||||||
in
|
|
||||||
mkShell {
|
|
||||||
inherit buildInputs;
|
|
||||||
nativeBuildInputs = [
|
|
||||||
pkg-config
|
|
||||||
];
|
|
||||||
LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs;
|
|
||||||
|
|
||||||
shellHook = ''
|
|
||||||
export LD_LIBRARY_PATH=${lib.makeLibraryPath buildInputs}
|
|
||||||
'';
|
|
||||||
}
|
|
12
src/main.rs
12
src/main.rs
@ -46,12 +46,12 @@ const MATRIX_B: [[f32; 4]; 4] = [
|
|||||||
[13.0, 14.0, 15.0, 16.0],
|
[13.0, 14.0, 15.0, 16.0],
|
||||||
];
|
];
|
||||||
|
|
||||||
const EXPECT: [[f32; 4]; 4] = [
|
// const EXPECT: [[f32; 4]; 4] = [
|
||||||
[90.0, 100.0, 110.0, 120.0],
|
// [90.0, 100.0, 110.0, 120.0],
|
||||||
[202.0, 228.0, 254.0, 280.0],
|
// [202.0, 228.0, 254.0, 280.0],
|
||||||
[314.0, 356.0, 398.0, 440.0],
|
// [314.0, 356.0, 398.0, 440.0],
|
||||||
[426.0, 484.0, 542.0, 600.0],
|
// [426.0, 484.0, 542.0, 600.0],
|
||||||
];
|
// ];
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<(), Error> {
|
async fn main() -> Result<(), Error> {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// #![allow(unused)]
|
// #![allow(unused)]
|
||||||
use bytemuck;
|
use bytemuck;
|
||||||
use getset::{Getters, MutGetters};
|
use getset::{Getters, MutGetters};
|
||||||
use std::{collections::HashMap, result};
|
use std::collections::HashMap;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use wgpu::util::DeviceExt;
|
use wgpu::util::DeviceExt;
|
||||||
|
|
||||||
@ -401,7 +401,7 @@ impl PPU {
|
|||||||
receiver.receive().await.unwrap().unwrap();
|
receiver.receive().await.unwrap().unwrap();
|
||||||
|
|
||||||
let data = buffer_slice.get_mapped_range().to_vec();
|
let data = buffer_slice.get_mapped_range().to_vec();
|
||||||
// buffers.staging().unmap();
|
buffers.staging().unmap();
|
||||||
|
|
||||||
let result = data
|
let result = data
|
||||||
.chunks_exact(std::mem::size_of::<T>())
|
.chunks_exact(std::mem::size_of::<T>())
|
||||||
|
Loading…
Reference in New Issue
Block a user