🔧 Make nix develop work
Signed-off-by: Julius Koskela <julius.koskela@unikie.com>
This commit is contained in:
parent
f7b29baf95
commit
0d701a49b6
60
default.nix
60
default.nix
@ -1,40 +1,36 @@
|
||||
{pkgs}:
|
||||
with pkgs;
|
||||
rustPlatform.buildRustPackage {
|
||||
pname = "matmul-vshader";
|
||||
version = "0.1.0";
|
||||
|
||||
src = ./.;
|
||||
|
||||
packages = [cmake shaderc];
|
||||
buildInputs = [cmake shaderc];
|
||||
nativeBuildInputs = [
|
||||
vulkan-headers
|
||||
{pkgs}: let
|
||||
manifest = (pkgs.lib.importTOML ./Cargo.toml).package;
|
||||
buildInputs = with pkgs; [
|
||||
udev
|
||||
alsa-lib
|
||||
vulkan-loader
|
||||
vulkan-validation-layers
|
||||
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 = pkgs.lib.cleanSource ./.;
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
pkg-config
|
||||
git
|
||||
gcc
|
||||
cmake
|
||||
glibc
|
||||
python3
|
||||
shaderc
|
||||
];
|
||||
|
||||
RUST_BACKTRACE = "1";
|
||||
# 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}";
|
||||
# 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";
|
||||
preConfigure = ''
|
||||
LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath buildInputs}
|
||||
'';
|
||||
|
||||
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;
|
||||
|
||||
cargoBuildFlags = ["--release"];
|
||||
|
||||
|
@ -7,7 +7,6 @@
|
||||
nixpkgs,
|
||||
}: {
|
||||
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;
|
||||
};
|
||||
}
|
||||
|
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],
|
||||
];
|
||||
|
||||
const EXPECT: [[f32; 4]; 4] = [
|
||||
[90.0, 100.0, 110.0, 120.0],
|
||||
[202.0, 228.0, 254.0, 280.0],
|
||||
[314.0, 356.0, 398.0, 440.0],
|
||||
[426.0, 484.0, 542.0, 600.0],
|
||||
];
|
||||
// const EXPECT: [[f32; 4]; 4] = [
|
||||
// [90.0, 100.0, 110.0, 120.0],
|
||||
// [202.0, 228.0, 254.0, 280.0],
|
||||
// [314.0, 356.0, 398.0, 440.0],
|
||||
// [426.0, 484.0, 542.0, 600.0],
|
||||
// ];
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Error> {
|
||||
|
@ -1,7 +1,7 @@
|
||||
// #![allow(unused)]
|
||||
use bytemuck;
|
||||
use getset::{Getters, MutGetters};
|
||||
use std::{collections::HashMap, result};
|
||||
use std::collections::HashMap;
|
||||
use thiserror::Error;
|
||||
use wgpu::util::DeviceExt;
|
||||
|
||||
@ -401,7 +401,7 @@ impl PPU {
|
||||
receiver.receive().await.unwrap().unwrap();
|
||||
|
||||
let data = buffer_slice.get_mapped_range().to_vec();
|
||||
// buffers.staging().unmap();
|
||||
buffers.staging().unmap();
|
||||
|
||||
let result = data
|
||||
.chunks_exact(std::mem::size_of::<T>())
|
||||
|
Loading…
Reference in New Issue
Block a user