Vulkan fixes
This commit is contained in:
@@ -26,6 +26,28 @@
|
||||
} \
|
||||
}
|
||||
|
||||
struct indexed_name {
|
||||
uint32_t id;
|
||||
char *name;
|
||||
};
|
||||
|
||||
struct indexed_index {
|
||||
uint32_t id;
|
||||
uint32_t value;
|
||||
};
|
||||
|
||||
struct descriptor_set {
|
||||
int id;
|
||||
bool in_use;
|
||||
VkDescriptorImageInfo tex_desc[16];
|
||||
VkDescriptorSet set;
|
||||
};
|
||||
|
||||
typedef struct inst {
|
||||
iron_matrix4x4_t m;
|
||||
int i;
|
||||
} inst_t;
|
||||
|
||||
bool iron_gpu_transpose_mat = true;
|
||||
|
||||
static iron_gpu_texture_t *vulkan_textures[16] = {
|
||||
@@ -1742,13 +1764,13 @@ void iron_gpu_command_list_set_render_targets(iron_gpu_command_list_t *list, str
|
||||
VkClearRect clearRect = {
|
||||
.rect.offset.x = 0,
|
||||
.rect.offset.y = 0,
|
||||
.rect.extent.width = renderTarget->width,
|
||||
.rect.extent.height = renderTarget->height,
|
||||
.rect.extent.width = targets[0]->width,
|
||||
.rect.extent.height = targets[0]->height,
|
||||
.baseArrayLayer = 0,
|
||||
.layerCount = 1,
|
||||
};
|
||||
|
||||
int count = 0;
|
||||
count = 0;
|
||||
VkClearAttachment attachments[2];
|
||||
if (flags & IRON_GPU_CLEAR_COLOR) {
|
||||
VkClearColorValue clearColor = {0};
|
||||
@@ -1761,7 +1783,7 @@ void iron_gpu_command_list_set_render_targets(iron_gpu_command_list_t *list, str
|
||||
attachments[count].clearValue.color = clearColor;
|
||||
count++;
|
||||
}
|
||||
if ((flags & IRON_GPU_CLEAR_DEPTH) && renderTarget->impl.depthBufferBits > 0) {
|
||||
if ((flags & IRON_GPU_CLEAR_DEPTH) && targets[0]->impl.depthBufferBits > 0) {
|
||||
attachments[count].aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT;
|
||||
attachments[count].clearValue.depthStencil.depth = depth;
|
||||
attachments[count].clearValue.depthStencil.stencil = 0;
|
||||
@@ -1874,7 +1896,7 @@ static int write_tex_descs(VkDescriptorImageInfo *tex_descs) {
|
||||
int texture_count = 0;
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
if (vulkan_textures[i] != NULL) {
|
||||
tex_descs[i].sampler = vulkan_samplers[i];
|
||||
// tex_descs[i].sampler = vulkan_samplers[i];
|
||||
if (vulkan_textures[i]->impl.stage_depth == i) {
|
||||
tex_descs[i].imageView = vulkan_textures[i]->impl.depthView;
|
||||
vulkan_textures[i]->impl.stage_depth = -1;
|
||||
@@ -1965,7 +1987,7 @@ VkDescriptorSet get_descriptor_set() {
|
||||
int texture_count = 0;
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
if (vulkan_textures[i] != NULL) {
|
||||
tex_desc[i].sampler = vulkan_samplers[i];
|
||||
// tex_desc[i].sampler = vulkan_samplers[i];
|
||||
if (vulkan_textures[i]->impl.stage_depth == i) {
|
||||
tex_desc[i].imageView = vulkan_textures[i]->impl.depthView;
|
||||
vulkan_textures[i]->impl.stage_depth = -1;
|
||||
@@ -2315,18 +2337,8 @@ static VkCompareOp convert_compare_mode(iron_gpu_compare_mode_t compare) {
|
||||
return VK_COMPARE_OP_ALWAYS;
|
||||
case IRON_GPU_COMPARE_MODE_NEVER:
|
||||
return VK_COMPARE_OP_NEVER;
|
||||
case IRON_GPU_COMPARE_MODE_EQUAL:
|
||||
return VK_COMPARE_OP_EQUAL;
|
||||
case IRON_GPU_COMPARE_MODE_NOT_EQUAL:
|
||||
return VK_COMPARE_OP_NOT_EQUAL;
|
||||
case IRON_GPU_COMPARE_MODE_LESS:
|
||||
return VK_COMPARE_OP_LESS;
|
||||
case IRON_GPU_COMPARE_MODE_LESS_EQUAL:
|
||||
return VK_COMPARE_OP_LESS_OR_EQUAL;
|
||||
case IRON_GPU_COMPARE_MODE_GREATER:
|
||||
return VK_COMPARE_OP_GREATER;
|
||||
case IRON_GPU_COMPARE_MODE_GREATER_EQUAL:
|
||||
return VK_COMPARE_OP_GREATER_OR_EQUAL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2344,18 +2356,6 @@ static VkBlendFactor convert_blend_factor(iron_gpu_blending_factor_t factor) {
|
||||
return VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
|
||||
case IRON_GPU_BLEND_INV_DEST_ALPHA:
|
||||
return VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA;
|
||||
case IRON_GPU_BLEND_SOURCE_COLOR:
|
||||
return VK_BLEND_FACTOR_SRC_COLOR;
|
||||
case IRON_GPU_BLEND_DEST_COLOR:
|
||||
return VK_BLEND_FACTOR_DST_COLOR;
|
||||
case IRON_GPU_BLEND_INV_SOURCE_COLOR:
|
||||
return VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR;
|
||||
case IRON_GPU_BLEND_INV_DEST_COLOR:
|
||||
return VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR;
|
||||
case IRON_GPU_BLEND_CONSTANT:
|
||||
return VK_BLEND_FACTOR_CONSTANT_COLOR;
|
||||
case IRON_GPU_BLEND_INV_CONSTANT:
|
||||
return VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2363,14 +2363,6 @@ static VkBlendOp convert_blend_operation(iron_gpu_blending_operation_t op) {
|
||||
switch (op) {
|
||||
case IRON_GPU_BLENDOP_ADD:
|
||||
return VK_BLEND_OP_ADD;
|
||||
case IRON_GPU_BLENDOP_SUBTRACT:
|
||||
return VK_BLEND_OP_SUBTRACT;
|
||||
case IRON_GPU_BLENDOP_REVERSE_SUBTRACT:
|
||||
return VK_BLEND_OP_REVERSE_SUBTRACT;
|
||||
case IRON_GPU_BLENDOP_MIN:
|
||||
return VK_BLEND_OP_MIN;
|
||||
case IRON_GPU_BLENDOP_MAX:
|
||||
return VK_BLEND_OP_MAX;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,28 +13,6 @@ typedef struct {
|
||||
uint32_t number;
|
||||
} iron_internal_named_number;
|
||||
|
||||
struct indexed_name {
|
||||
uint32_t id;
|
||||
char *name;
|
||||
};
|
||||
|
||||
struct indexed_index {
|
||||
uint32_t id;
|
||||
uint32_t value;
|
||||
};
|
||||
|
||||
struct descriptor_set {
|
||||
int id;
|
||||
bool in_use;
|
||||
VkDescriptorImageInfo tex_desc[16];
|
||||
VkDescriptorSet set;
|
||||
};
|
||||
|
||||
typedef struct inst {
|
||||
iron_matrix4x4_t m;
|
||||
int i;
|
||||
} inst_t;
|
||||
|
||||
struct vk_funs {
|
||||
PFN_vkGetPhysicalDeviceSurfaceSupportKHR fpGetPhysicalDeviceSurfaceSupportKHR;
|
||||
PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR fpGetPhysicalDeviceSurfaceCapabilitiesKHR;
|
||||
|
||||
+3
-2
@@ -976,6 +976,7 @@ iron_gpu_shader_t *gpu_create_shader(buffer_t *data, i32 shader_type) {
|
||||
#include "../../sources/libs/kong/tokenizer.h"
|
||||
#include "../../sources/libs/kong/typer.h"
|
||||
#include "../../sources/libs/kong/types.h"
|
||||
#include "../../sources/libs/kong/transformer.h"
|
||||
#include "../../sources/libs/kong/backends/hlsl.h"
|
||||
#include "../../sources/libs/kong/backends/metal.h"
|
||||
#include "../../sources/libs/kong/backends/spirv.h"
|
||||
@@ -1035,8 +1036,8 @@ void gpu_create_shaders_from_kong(char *kong, char **vs, char **fs) {
|
||||
|
||||
#else
|
||||
|
||||
// transform(TRANSFORM_FLAG_ONE_COMPONENT_SWIZZLE);
|
||||
// spirv_export(output);
|
||||
transform(TRANSFORM_FLAG_ONE_COMPONENT_SWIZZLE | TRANSFORM_FLAG_BINARY_UNIFY_LENGTH);
|
||||
spirv_export2(vs, fs);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "../../sources/libs/kong/tokenizer.h"
|
||||
#include "../../sources/libs/kong/typer.h"
|
||||
#include "../../sources/libs/kong/types.h"
|
||||
#include "../../sources/libs/kong/transformer.h"
|
||||
#include "../../sources/libs/kong/backends/hlsl.h"
|
||||
#include "../../sources/libs/kong/backends/metal.h"
|
||||
#include "../../sources/libs/kong/backends/spirv.h"
|
||||
@@ -180,11 +181,10 @@ void kong_compile(const char *from, const char *to) {
|
||||
|
||||
#else
|
||||
|
||||
// transform(TRANSFORM_FLAG_ONE_COMPONENT_SWIZZLE);
|
||||
|
||||
// int i = string_last_index_of(to, "/");
|
||||
// output[i] = '\0';
|
||||
// spirv_export2(output);
|
||||
transform(TRANSFORM_FLAG_ONE_COMPONENT_SWIZZLE | TRANSFORM_FLAG_BINARY_UNIFY_LENGTH);
|
||||
char *vs;
|
||||
char *fs;
|
||||
spirv_export2(&vs, &fs);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user