Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
9821ee0
vulkan: update headers to 1.3.235
Cherser-s Dec 4, 2022
c45f3a1
amdilc, mantle: rework descriptor sets usage
Cherser-s Dec 4, 2022
6d4f30a
mantle: replace VkPhysicalDeviceProperties to VkPhysicalDevicePropert…
Cherser-s Dec 4, 2022
e36a4ad
mantle: fix device check for destruction
Cherser-s Dec 4, 2022
087ec17
mantle: load descriptor buffer and buffer address functions
Cherser-s Dec 4, 2022
8c7968b
mantle: add descriptor implementation based on VK_EXT_descriptor_buffer
Cherser-s Dec 4, 2022
14a4b5e
mantle: added quirk to allocate memory specifically for descriptor bu…
Cherser-s Dec 5, 2022
7bb6d3a
mantle: optimize image view and sampler descriptor generation
Cherser-s Apr 23, 2023
8534e3f
mantle: added quirk for internal synchronization of descriptor set ac…
Cherser-s Dec 8, 2022
587928d
amdilc: fixed immediate modifier reading if ADDR_REG_RELATIVE address…
Cherser-s Oct 1, 2021
81ca7d9
amdilc: optimize allocations during decoding and register allocation
Cherser-s Dec 10, 2022
a63a718
amdilc: added STACK_ARRAY to remove excessive malloc calls
Cherser-s Dec 10, 2022
1f9822e
amdilc: increase minimum spirv buffer size to reduce realloc call count
Cherser-s Dec 10, 2022
a788e79
mantle: replace malloc calls for temporary arrays with STACK_ARRAY
Cherser-s Dec 31, 2022
27f729b
mantle: fix globalMemRefs memory management
Cherser-s Dec 31, 2022
cb9a449
mantle: optimize pipeline slot selection
Cherser-s Dec 13, 2022
4e71773
mantle: add support for extended_dynamic_state3 functions loading
Cherser-s Dec 15, 2022
f048f43
mantle: add support for VK_EXT_extended_dynamic_state3
Cherser-s Dec 15, 2022
3b4cdd5
mantle: create a graphics pipeline immediately if all dynamic states …
Cherser-s Dec 17, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/vulkan/vk_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// File: vk_platform.h
//
/*
** Copyright 2014-2021 The Khronos Group Inc.
** Copyright 2014-2022 The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -42,7 +42,7 @@ extern "C"
#define VKAPI_CALL __stdcall
#define VKAPI_PTR VKAPI_CALL
#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7
#error "Vulkan isn't supported for the 'armeabi' NDK ABI"
#error "Vulkan is not supported for the 'armeabi' NDK ABI"
#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
// On Android 32-bit ARM targets, Vulkan functions use the "hardfloat"
// calling convention, i.e. float parameters are passed in registers. This
Expand Down
3 changes: 1 addition & 2 deletions include/vulkan/vulkan.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define VULKAN_H_ 1

/*
** Copyright 2015-2021 The Khronos Group Inc.
** Copyright 2015-2022 The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -38,7 +38,6 @@


#ifdef VK_USE_PLATFORM_WAYLAND_KHR
#include <wayland-client.h>
#include "vulkan_wayland.h"
#endif

Expand Down
14,204 changes: 8,528 additions & 5,676 deletions include/vulkan/vulkan_core.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion include/vulkan/vulkan_win32.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define VULKAN_WIN32_H_ 1

/*
** Copyright 2015-2021 The Khronos Group Inc.
** Copyright 2015-2022 The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0
*/
Expand Down
50 changes: 10 additions & 40 deletions src/amdilc/amdilc.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

static HCRYPTPROV mCryptProvider = 0;

static void freeSource(
Source* src);

static void calcSha1(
uint8_t* digest,
const uint8_t* data,
Expand All @@ -33,45 +30,13 @@ static void calcSha1(
CryptDestroyHash(hash);
}

static void freeDestination(
Destination* dst)
{
if (dst->absoluteSrc != NULL) {
freeSource(dst->absoluteSrc);
}
free(dst->absoluteSrc);
}

static void freeSource(
Source* src)
{
for (unsigned i = 0; i < src->srcCount; i++) {
freeSource(&src->srcs[i]);
}
free(src->srcs);
}

static void freeInstruction(
Instruction* instr)
{
for (unsigned i = 0; i < instr->dstCount; i++) {
freeDestination(&instr->dsts[i]);
}
for (unsigned i = 0; i < instr->srcCount; i++) {
freeSource(&instr->srcs[i]);
}
free(instr->dsts);
free(instr->srcs);
free(instr->extras);
}

static void freeKernel(
Kernel* kernel)
{
for (unsigned i = 0; i < kernel->instrCount; i++) {
freeInstruction(&kernel->instrs[i]);
}
free(kernel->instrs);
free(kernel->srcBuffer);
free(kernel->dstBuffer);
free(kernel->extrasBuffer);
}

static bool isShaderDumpEnabled()
Expand Down Expand Up @@ -135,7 +100,10 @@ IlcShader ilcCompileShader(
getShaderName(name, NAME_LEN, code, size);
LOGV("compiling %s...\n", name);

Kernel* kernel = ilcDecodeStream((Token*)code, size / sizeof(Token));
Kernel* kernel = calloc(1, sizeof(Kernel));

ilcDecodeStream(kernel, (Token*)code, size / sizeof(Token));

bool dump = isShaderDumpEnabled();

if (dump) {
Expand All @@ -159,7 +127,9 @@ void ilcDisassembleShader(
const void* code,
unsigned size)
{
Kernel* kernel = ilcDecodeStream((Token*)code, size / sizeof(Token));
Kernel* kernel = calloc(1, sizeof(Kernel));

ilcDecodeStream(kernel, (Token*)code, size / sizeof(Token));

ilcDumpKernel(file, kernel);
freeKernel(kernel);
Expand Down
27 changes: 26 additions & 1 deletion src/amdilc/amdilc.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,31 @@
#define VK_NO_PROTOTYPES
#include "vulkan/vulkan.h"

#define DESCRIPTOR_SET_ID (0)
#define ATOMIC_COUNTER_SET_ID (1)
#define DYNAMIC_MEMORY_VIEW_BINDING_ID (0)
#define DYNAMIC_MEMORY_VIEW_DESCRIPTOR_SET_ID (0)
#define DESCRIPTOR_SET_ID (2)

#define DESCRIPTOR_BUFFERS_ATOMIC_BINDING_ID (0)
#define DESCRIPTOR_BUFFERS_DYNAMIC_MAPPING_BINDING_ID (1)
#define DESCRIPTOR_BUFFERS_BASE_DESCRIPTOR_SET_ID (2)
#define DESCRIPTOR_BUFFERS_PUSH_DESCRIPTOR_SET_ID (1)

#define ILC_MAX_STRIDE_CONSTANTS (8)

#define DESCRIPTOR_CONST_OFFSETS_OFFSET (sizeof(uint32_t) * ILC_MAX_STRIDE_CONSTANTS)
#define DESCRIPTOR_OFFSET_COUNT (32)

typedef enum _IlcBindingType {
ILC_BINDING_SAMPLER,
ILC_BINDING_RESOURCE,
} IlcBindingType;

typedef struct _IlcBinding {
IlcBindingType type;
uint32_t id;
uint32_t offsetSpecId;
uint32_t descriptorSetIndexSpecId;
uint32_t ilIndex;
uint32_t vkIndex; // Unique across shader stages
VkDescriptorType descriptorType;
Expand All @@ -39,6 +52,12 @@ typedef struct _IlcShader {
char* name;
} IlcShader;

typedef struct _IlcBindingPatchEntry {
uint32_t id;
uint32_t bindingIndex;
uint32_t descriptorSetIndex;
} IlcBindingPatchEntry;

IlcShader ilcCompileShader(
const void* code,
unsigned size);
Expand All @@ -52,4 +71,10 @@ void ilcDisassembleShader(
const void* code,
unsigned size);

void patchShaderBindings(
void* code,
uint32_t codeSize,
const IlcBindingPatchEntry* entries,
uint32_t entryCount);

#endif // AMDILC_H_
42 changes: 42 additions & 0 deletions src/amdilc/amdilc_binding_patcher.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include "amdilc_spirv.h"
#include "amdilc_internal.h"

const IlcBindingPatchEntry* findEntryById(
IlcSpvId id,
const IlcBindingPatchEntry* entries,
uint32_t entryCount)
{
for (uint32_t i = 0; i < entryCount; i++) {
if (id == entries[i].id) {
return &entries[i];
}
}
return NULL;
}

void patchShaderBindings(
void* code,
uint32_t codeSize,
const IlcBindingPatchEntry* entries,
uint32_t entryCount)
{
uint32_t wordCount = codeSize / sizeof(uint32_t);
IlcSpvWord* spirvWords = (IlcSpvWord*)code;
for (uint32_t i = 5; i < wordCount;) {
SpvOp opCode = spirvWords[i] & SpvOpCodeMask;
unsigned instrWordCount = spirvWords[i] >> SpvWordCountShift;

if (opCode == SpvOpDecorate) {
IlcSpvWord id = spirvWords[i + 1];
IlcSpvWord decoration = spirvWords[i + 2];
if (decoration == SpvDecorationDescriptorSet || decoration == SpvDecorationBinding) {
const IlcBindingPatchEntry* entry = findEntryById(id, entries, entryCount);
if (entry != NULL) {
spirvWords[i + 3] = (decoration == SpvDecorationDescriptorSet) ? entry->descriptorSetIndex : entry->bindingIndex;
}
}
}

i += instrWordCount;
}
}
Loading