mirror of
https://github.com/elwrcl/copnix.git
synced 2026-10-31 14:28:02 +03:00
changed format
This commit is contained in:
35 files changed
+73
-161
No files matched your search
@@ -1,7 +1,4 @@
|
||||
{
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
hardware.graphics.extraPackages = with pkgs; [
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
driver = config.elars.hardware.graphics.driver;
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
{
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
wayland-intel-vaapi-driver = pkgs.intel-vaapi-driver.overrideAttrs (oldAttrs: {
|
||||
version = "2.4.4-wayland-fix";
|
||||
@@ -22,8 +19,8 @@ let
|
||||
};
|
||||
|
||||
});
|
||||
hasvk14-layer = pkgs.callPackage ./vk {};
|
||||
hasvk14-layer-32 = pkgs.pkgsi686Linux.callPackage ./vk {};
|
||||
hasvk14-layer = pkgs.callPackage ./vk { };
|
||||
hasvk14-layer-32 = pkgs.pkgsi686Linux.callPackage ./vk { };
|
||||
in
|
||||
|
||||
{
|
||||
@@ -44,4 +41,4 @@ in
|
||||
environment.variables = {
|
||||
LIBVA_DRIVER_NAME = "i965";
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,4 @@
|
||||
{
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{ config, ... }:
|
||||
|
||||
{
|
||||
services.xserver.videoDrivers = [ "nvidia" ];
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "vulkan-layer-hasvk14";
|
||||
src = ./.;
|
||||
src = ./.;
|
||||
|
||||
buildInputs = [ pkgs.vulkan-headers ];
|
||||
|
||||
|
||||
@@ -6,18 +6,16 @@
|
||||
#include <vulkan/vk_layer.h>
|
||||
#include <string.h>
|
||||
|
||||
static PFN_vkGetInstanceProcAddr g_next_gipa = NULL;
|
||||
static PFN_vkGetPhysicalDeviceProperties g_next_gdp = NULL;
|
||||
static PFN_vkGetPhysicalDeviceProperties2 g_next_gdp2 = NULL;
|
||||
static PFN_vkGetInstanceProcAddr g_next_gipa = NULL;
|
||||
static PFN_vkGetPhysicalDeviceProperties g_next_gdp = NULL;
|
||||
static PFN_vkGetPhysicalDeviceProperties2 g_next_gdp2 = NULL;
|
||||
|
||||
#define HASVK14_API_VERSION VK_MAKE_API_VERSION(0, 1, 4, VK_HEADER_VERSION)
|
||||
#define INTEL_VENDOR_ID 0x8086
|
||||
#define INTEL_VENDOR_ID 0x8086
|
||||
|
||||
static int is_intel_below_14(uint32_t vendorID, uint32_t apiVersion)
|
||||
{
|
||||
return vendorID == INTEL_VENDOR_ID
|
||||
&& VK_API_VERSION_MAJOR(apiVersion) == 1
|
||||
&& VK_API_VERSION_MINOR(apiVersion) < 4;
|
||||
return vendorID == INTEL_VENDOR_ID && VK_API_VERSION_MAJOR(apiVersion) == 1 && VK_API_VERSION_MINOR(apiVersion) < 4;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
@@ -28,30 +26,33 @@ HaVK14_EnumerateInstanceVersion(uint32_t *pApiVersion)
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
HaVK14_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
||||
HaVK14_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkInstance *pInstance)
|
||||
VkInstance *pInstance)
|
||||
{
|
||||
VkLayerInstanceCreateInfo *link =
|
||||
(VkLayerInstanceCreateInfo *)pCreateInfo->pNext;
|
||||
|
||||
while (link &&
|
||||
!(link->sType == VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO &&
|
||||
!(link->sType == VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO &&
|
||||
link->function == VK_LAYER_LINK_INFO))
|
||||
link = (VkLayerInstanceCreateInfo *)link->pNext;
|
||||
|
||||
if (!link) return VK_ERROR_INITIALIZATION_FAILED;
|
||||
g_next_gipa = link->u.pLayerInfo->pfnNextGetInstanceProcAddr;
|
||||
if (!link)
|
||||
return VK_ERROR_INITIALIZATION_FAILED;
|
||||
g_next_gipa = link->u.pLayerInfo->pfnNextGetInstanceProcAddr;
|
||||
link->u.pLayerInfo = link->u.pLayerInfo->pNext;
|
||||
PFN_vkCreateInstance next_ci =
|
||||
(PFN_vkCreateInstance)g_next_gipa(NULL, "vkCreateInstance");
|
||||
VkResult res = next_ci(pCreateInfo, pAllocator, pInstance);
|
||||
if (res != VK_SUCCESS) return res;
|
||||
g_next_gdp = (PFN_vkGetPhysicalDeviceProperties)
|
||||
if (res != VK_SUCCESS)
|
||||
return res;
|
||||
g_next_gdp = (PFN_vkGetPhysicalDeviceProperties)
|
||||
g_next_gipa(*pInstance, "vkGetPhysicalDeviceProperties");
|
||||
g_next_gdp2 = (PFN_vkGetPhysicalDeviceProperties2)
|
||||
g_next_gipa(*pInstance, "vkGetPhysicalDeviceProperties2");
|
||||
if (!g_next_gdp2) {
|
||||
if (!g_next_gdp2)
|
||||
{
|
||||
g_next_gdp2 = (PFN_vkGetPhysicalDeviceProperties2)
|
||||
g_next_gipa(*pInstance, "vkGetPhysicalDeviceProperties2KHR");
|
||||
}
|
||||
@@ -60,36 +61,44 @@ HaVK14_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
HaVK14_GetPhysicalDeviceProperties(VkPhysicalDevice device,
|
||||
HaVK14_GetPhysicalDeviceProperties(VkPhysicalDevice device,
|
||||
VkPhysicalDeviceProperties *props)
|
||||
{
|
||||
if (g_next_gdp) g_next_gdp(device, props);
|
||||
if (props && is_intel_below_14(props->vendorID, props->apiVersion)) {
|
||||
if (g_next_gdp)
|
||||
g_next_gdp(device, props);
|
||||
if (props && is_intel_below_14(props->vendorID, props->apiVersion))
|
||||
{
|
||||
props->apiVersion = HASVK14_API_VERSION;
|
||||
}
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
HaVK14_GetPhysicalDeviceProperties2(VkPhysicalDevice device,
|
||||
HaVK14_GetPhysicalDeviceProperties2(VkPhysicalDevice device,
|
||||
VkPhysicalDeviceProperties2 *props2)
|
||||
{
|
||||
if (g_next_gdp2) g_next_gdp2(device, props2);
|
||||
if (!props2) return;
|
||||
if (g_next_gdp2)
|
||||
g_next_gdp2(device, props2);
|
||||
if (!props2)
|
||||
return;
|
||||
VkPhysicalDeviceProperties *props = &props2->properties;
|
||||
if (!is_intel_below_14(props->vendorID, props->apiVersion)) return;
|
||||
if (!is_intel_below_14(props->vendorID, props->apiVersion))
|
||||
return;
|
||||
|
||||
props->apiVersion = HASVK14_API_VERSION;
|
||||
VkBaseOutStructure *s = (VkBaseOutStructure *)props2->pNext;
|
||||
while (s) {
|
||||
if (s->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES) {
|
||||
while (s)
|
||||
{
|
||||
if (s->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES)
|
||||
{
|
||||
VkPhysicalDeviceVulkan12Properties *p12 =
|
||||
(VkPhysicalDeviceVulkan12Properties *)s;
|
||||
p12->conformanceVersion = (VkConformanceVersion){ 1, 4, 1, 1 };
|
||||
p12->conformanceVersion = (VkConformanceVersion){1, 4, 1, 1};
|
||||
}
|
||||
if (s->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES) {
|
||||
if (s->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES)
|
||||
{
|
||||
VkPhysicalDeviceDriverProperties *drv =
|
||||
(VkPhysicalDeviceDriverProperties *)s;
|
||||
drv->conformanceVersion = (VkConformanceVersion){ 1, 4, 1, 1 };
|
||||
drv->conformanceVersion = (VkConformanceVersion){1, 4, 1, 1};
|
||||
}
|
||||
s = s->pNext;
|
||||
}
|
||||
@@ -99,16 +108,18 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
|
||||
HaVK14_GetInstanceProcAddr(VkInstance instance, const char *pName)
|
||||
{
|
||||
|
||||
#define INTERCEPT(fn) \
|
||||
if (strcmp(pName, "vk" #fn) == 0) return (PFN_vkVoidFunction)HaVK14_##fn;
|
||||
#define INTERCEPT(fn) \
|
||||
if (strcmp(pName, "vk" #fn) == 0) \
|
||||
return (PFN_vkVoidFunction)HaVK14_##fn;
|
||||
|
||||
INTERCEPT(GetInstanceProcAddr)
|
||||
INTERCEPT(EnumerateInstanceVersion)
|
||||
INTERCEPT(CreateInstance)
|
||||
INTERCEPT(GetPhysicalDeviceProperties)
|
||||
INTERCEPT(GetPhysicalDeviceProperties2)
|
||||
|
||||
if (strcmp(pName, "vkGetPhysicalDeviceProperties2KHR") == 0) {
|
||||
|
||||
if (strcmp(pName, "vkGetPhysicalDeviceProperties2KHR") == 0)
|
||||
{
|
||||
return (PFN_vkVoidFunction)HaVK14_GetPhysicalDeviceProperties2;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user