Metal fixes
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
|
||||
#[set(everything)]
|
||||
const constants: {
|
||||
empty: float4;
|
||||
};
|
||||
|
||||
#[set(everything)]
|
||||
const sampler_linear: sampler;
|
||||
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
|
||||
#[set(everything)]
|
||||
const constants: {
|
||||
empty: float4;
|
||||
};
|
||||
|
||||
#[set(everything)]
|
||||
const sampler_linear: sampler;
|
||||
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
|
||||
#[set(everything)]
|
||||
const constants: {
|
||||
empty: float4;
|
||||
};
|
||||
|
||||
#[set(everything)]
|
||||
const sampler_linear: sampler;
|
||||
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
|
||||
#[set(everything)]
|
||||
const constants: {
|
||||
empty: float4;
|
||||
};
|
||||
|
||||
#[set(everything)]
|
||||
const sampler_linear: sampler;
|
||||
|
||||
|
||||
@@ -859,9 +859,6 @@ void iron_gpu_pipeline_compile(iron_gpu_pipeline_t *pipe) {
|
||||
case IRON_GPU_VERTEX_DATA_F32_4X:
|
||||
vertexDesc[i].Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
|
||||
break;
|
||||
case IRON_GPU_VERTEX_DATA_U8_4X_NORM:
|
||||
vertexDesc[i].Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
break;
|
||||
case IRON_GPU_VERTEX_DATA_I16_2X_NORM:
|
||||
vertexDesc[i].Format = DXGI_FORMAT_R16G16_SNORM;
|
||||
break;
|
||||
@@ -1485,14 +1482,13 @@ void iron_gpu_render_target_set_depth_from(iron_gpu_texture_t *render_target, ir
|
||||
|
||||
void iron_gpu_vertex_buffer_init(iron_gpu_buffer_t *buffer, int count, iron_gpu_vertex_structure_t *structure, bool gpuMemory) {
|
||||
buffer->myCount = count;
|
||||
buffer->impl.myCount = count;
|
||||
|
||||
buffer->impl.myStride = 0;
|
||||
for (int i = 0; i < structure->size; ++i) {
|
||||
buffer->impl.myStride += iron_gpu_vertex_data_size(structure->elements[i].data);
|
||||
}
|
||||
|
||||
int uploadBufferSize = buffer->impl.myStride * buffer->impl.myCount;
|
||||
int uploadBufferSize = buffer->impl.myStride * buffer-.myCount;
|
||||
|
||||
D3D12_HEAP_PROPERTIES heapProperties = {
|
||||
.Type = D3D12_HEAP_TYPE_UPLOAD,
|
||||
@@ -1562,7 +1558,7 @@ int iron_gpu_internal_vertex_buffer_set(iron_gpu_buffer_t *buffer) {
|
||||
}
|
||||
|
||||
int iron_gpu_vertex_buffer_count(iron_gpu_buffer_t *buffer) {
|
||||
return buffer->impl.myCount;
|
||||
return buffer->myCount;
|
||||
}
|
||||
|
||||
int iron_gpu_vertex_buffer_stride(iron_gpu_buffer_t *buffer) {
|
||||
@@ -2254,10 +2250,10 @@ void iron_gpu_raytrace_acceleration_structure_build(iron_gpu_raytrace_accelerati
|
||||
|
||||
#ifdef is_forge
|
||||
create_srv_ib(_ib_full, _ib_full->impl.count, 0);
|
||||
create_srv_vb(_vb_full, _vb_full->impl.myCount, vb[0]->impl.myStride);
|
||||
create_srv_vb(_vb_full, _vb_full->myCount, vb[0]->impl.myStride);
|
||||
#else
|
||||
create_srv_ib(ib[0], ib[0]->impl.count, 0);
|
||||
create_srv_vb(vb[0], vb[0]->impl.myCount, vb[0]->impl.myStride);
|
||||
create_srv_vb(vb[0], vb[0]->myCount, vb[0]->impl.myStride);
|
||||
#endif
|
||||
|
||||
// Reset the command list for the acceleration structure construction
|
||||
@@ -2288,14 +2284,14 @@ void iron_gpu_raytrace_acceleration_structure_build(iron_gpu_raytrace_accelerati
|
||||
.Triangles.IndexFormat = DXGI_FORMAT_R32_UINT,
|
||||
.Triangles.Transform3x4 = 0,
|
||||
.Triangles.VertexFormat = DXGI_FORMAT_R16G16B16A16_SNORM,
|
||||
.Triangles.VertexCount = vb[i]->impl.myCount,
|
||||
.Triangles.VertexCount = vb[i]->myCount,
|
||||
};
|
||||
|
||||
D3D12_RESOURCE_DESC desc;
|
||||
vb[i]->impl.uploadBuffer->lpVtbl->GetDesc(vb[i]->impl.uploadBuffer, &desc);
|
||||
|
||||
geometryDesc.Triangles.VertexBuffer.StartAddress = vb[i]->impl.uploadBuffer->lpVtbl->GetGPUVirtualAddress(vb[i]->impl.uploadBuffer);
|
||||
geometryDesc.Triangles.VertexBuffer.StrideInBytes = desc.Width / vb[i]->impl.myCount;
|
||||
geometryDesc.Triangles.VertexBuffer.StrideInBytes = desc.Width / vb[i]->myCount;
|
||||
geometryDesc.Flags = D3D12_RAYTRACING_GEOMETRY_FLAG_OPAQUE;
|
||||
geometryDescs[i] = geometryDesc;
|
||||
|
||||
|
||||
@@ -119,7 +119,6 @@ struct D3D12IindexBufferView {
|
||||
typedef struct {
|
||||
struct ID3D12Resource *uploadBuffer;
|
||||
struct D3D12VertexBufferView view;
|
||||
int myCount;
|
||||
int myStride;
|
||||
int lastStart;
|
||||
int lastCount;
|
||||
|
||||
@@ -44,13 +44,11 @@ typedef struct {
|
||||
void *_tex;
|
||||
void *data;
|
||||
bool has_mipmaps;
|
||||
|
||||
void *_texReadback;
|
||||
void *_depthTex;
|
||||
} gpu_texture_impl_t;
|
||||
|
||||
typedef struct {
|
||||
int myCount;
|
||||
int myStride;
|
||||
void *metal_buffer;
|
||||
int count;
|
||||
|
||||
@@ -20,7 +20,7 @@ static id<MTLArgumentEncoder> argument_encoder = nil;
|
||||
static id<MTLBuffer> argument_buffer = nil;
|
||||
static int argument_buffer_step;
|
||||
static id<CAMetalDrawable> drawable;
|
||||
static id<MTLTexture> depth_texture;
|
||||
static id<MTLTexture> framebuffer_depth;
|
||||
static int depth_bits;
|
||||
static bool has_depth = false;
|
||||
static int framebuffer_count = 0;
|
||||
@@ -266,7 +266,10 @@ void iron_gpu_begin(iron_gpu_texture_t *target) {
|
||||
CAMetalLayer *layer = getMetalLayer();
|
||||
drawable = [layer nextDrawable];
|
||||
|
||||
if (depth_bits > 0 && (depth_texture == nil || depth_texture.width != drawable.texture.width || depth_texture.height != drawable.texture.height)) {
|
||||
if (depth_bits > 0 && (framebuffer_depth == nil || framebuffer_depth.width != drawable.texture.width || framebuffer_depth.height != drawable.texture.height)) {
|
||||
if (framebuffer_depth != nil) {
|
||||
framebuffer_depth = nil;
|
||||
}
|
||||
MTLTextureDescriptor *desc = [MTLTextureDescriptor new];
|
||||
desc.textureType = MTLTextureType2D;
|
||||
desc.width = drawable.texture.width;
|
||||
@@ -278,12 +281,9 @@ void iron_gpu_begin(iron_gpu_texture_t *target) {
|
||||
desc.resourceOptions = MTLResourceStorageModePrivate;
|
||||
desc.usage = MTLTextureUsageRenderTarget;
|
||||
id<MTLDevice> device = getMetalDevice();
|
||||
depth_texture = [device newTextureWithDescriptor:desc];
|
||||
has_depth = true;
|
||||
}
|
||||
else {
|
||||
has_depth = false;
|
||||
framebuffer_depth = [device newTextureWithDescriptor:desc];
|
||||
}
|
||||
has_depth = (depth_bits > 0 && framebuffer_depth != nil);
|
||||
}
|
||||
|
||||
void iron_gpu_end() {
|
||||
@@ -401,6 +401,12 @@ void iron_gpu_command_list_set_index_buffer(iron_gpu_command_list_t *list, iron_
|
||||
}
|
||||
|
||||
void iron_gpu_command_list_set_render_targets(iron_gpu_command_list_t *list, iron_gpu_texture_t **targets, int count, unsigned flags, unsigned color, float depth) {
|
||||
if (command_buffer != nil && command_encoder != nil) {
|
||||
[command_encoder endEncoding];
|
||||
[command_buffer commit];
|
||||
[command_buffer waitUntilCompleted];
|
||||
}
|
||||
|
||||
if (targets[0]->framebuffer_index >= 0) {
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
render_targets[i] = NULL;
|
||||
@@ -412,23 +418,14 @@ void iron_gpu_command_list_set_render_targets(iron_gpu_command_list_t *list, iro
|
||||
for (int i = 0; i < count; ++i) {
|
||||
render_targets[i] = targets[i];
|
||||
}
|
||||
for (int i = count; i < 8; ++i) {
|
||||
render_targets[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (command_buffer != nil && command_encoder != nil) {
|
||||
[command_encoder endEncoding];
|
||||
[command_buffer commit];
|
||||
[command_buffer waitUntilCompleted];
|
||||
}
|
||||
|
||||
MTLRenderPassDescriptor *desc = [MTLRenderPassDescriptor renderPassDescriptor];
|
||||
for (int i = 0; i < count; ++i) {
|
||||
if (targets == NULL) {
|
||||
desc.colorAttachments[i].texture = drawable.texture;
|
||||
desc.depthAttachment.texture = depth_texture;
|
||||
has_depth = depth_texture != nil;
|
||||
desc.depthAttachment.texture = framebuffer_depth;
|
||||
has_depth = framebuffer_depth != nil;
|
||||
}
|
||||
else {
|
||||
desc.colorAttachments[i].texture = (__bridge id<MTLTexture>)targets[i]->impl._tex;
|
||||
@@ -559,8 +556,6 @@ void iron_gpu_pipeline_init(iron_gpu_pipeline_t *pipeline) {
|
||||
}
|
||||
|
||||
void iron_gpu_pipeline_destroy(iron_gpu_pipeline_t *pipeline) {
|
||||
pipeline->impl._depthStencil = NULL;
|
||||
|
||||
id<MTLRenderPipelineState> pipe = (__bridge_transfer id<MTLRenderPipelineState>)pipeline->impl._pipeline;
|
||||
pipe = nil;
|
||||
pipeline->impl._pipeline = NULL;
|
||||
@@ -579,7 +574,6 @@ void iron_gpu_pipeline_destroy(iron_gpu_pipeline_t *pipeline) {
|
||||
}
|
||||
|
||||
void iron_gpu_pipeline_compile(iron_gpu_pipeline_t *pipeline) {
|
||||
|
||||
id<MTLDevice> device = getMetalDevice();
|
||||
NSError *error = nil;
|
||||
id<MTLLibrary> library = [device newLibraryWithSource:[[NSString alloc] initWithBytes:pipeline->vertex_shader->impl.source length:pipeline->vertex_shader->impl.length encoding:NSUTF8StringEncoding] options:nil error:&error];
|
||||
@@ -620,35 +614,29 @@ void iron_gpu_pipeline_compile(iron_gpu_pipeline_t *pipeline) {
|
||||
MTLVertexDescriptor *vertexDescriptor = [[MTLVertexDescriptor alloc] init];
|
||||
|
||||
for (int i = 0; i < pipeline->input_layout->size; ++i) {
|
||||
int index = i;
|
||||
vertexDescriptor.attributes[index].bufferIndex = 0;
|
||||
vertexDescriptor.attributes[index].offset = offset;
|
||||
|
||||
vertexDescriptor.attributes[i].bufferIndex = 0;
|
||||
vertexDescriptor.attributes[i].offset = offset;
|
||||
offset += iron_gpu_vertex_data_size(pipeline->input_layout->elements[i].data);
|
||||
if (index >= 0) {
|
||||
switch (pipeline->input_layout->elements[i].data) {
|
||||
case IRON_GPU_VERTEX_DATA_F32_1X:
|
||||
vertexDescriptor.attributes[index].format = MTLVertexFormatFloat;
|
||||
break;
|
||||
case IRON_GPU_VERTEX_DATA_F32_2X:
|
||||
vertexDescriptor.attributes[index].format = MTLVertexFormatFloat2;
|
||||
break;
|
||||
case IRON_GPU_VERTEX_DATA_F32_3X:
|
||||
vertexDescriptor.attributes[index].format = MTLVertexFormatFloat3;
|
||||
break;
|
||||
case IRON_GPU_VERTEX_DATA_F32_4X:
|
||||
vertexDescriptor.attributes[index].format = MTLVertexFormatFloat4;
|
||||
break;
|
||||
case IRON_GPU_VERTEX_DATA_U8_4X_NORM:
|
||||
vertexDescriptor.attributes[index].format = MTLVertexFormatUChar4Normalized;
|
||||
break;
|
||||
case IRON_GPU_VERTEX_DATA_I16_2X_NORM:
|
||||
vertexDescriptor.attributes[index].format = MTLVertexFormatShort2Normalized;
|
||||
break;
|
||||
case IRON_GPU_VERTEX_DATA_I16_4X_NORM:
|
||||
vertexDescriptor.attributes[index].format = MTLVertexFormatShort4Normalized;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (pipeline->input_layout->elements[i].data) {
|
||||
case IRON_GPU_VERTEX_DATA_F32_1X:
|
||||
vertexDescriptor.attributes[i].format = MTLVertexFormatFloat;
|
||||
break;
|
||||
case IRON_GPU_VERTEX_DATA_F32_2X:
|
||||
vertexDescriptor.attributes[i].format = MTLVertexFormatFloat2;
|
||||
break;
|
||||
case IRON_GPU_VERTEX_DATA_F32_3X:
|
||||
vertexDescriptor.attributes[i].format = MTLVertexFormatFloat3;
|
||||
break;
|
||||
case IRON_GPU_VERTEX_DATA_F32_4X:
|
||||
vertexDescriptor.attributes[i].format = MTLVertexFormatFloat4;
|
||||
break;
|
||||
case IRON_GPU_VERTEX_DATA_I16_2X_NORM:
|
||||
vertexDescriptor.attributes[i].format = MTLVertexFormatShort2Normalized;
|
||||
break;
|
||||
case IRON_GPU_VERTEX_DATA_I16_4X_NORM:
|
||||
vertexDescriptor.attributes[i].format = MTLVertexFormatShort4Normalized;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -940,7 +928,7 @@ void iron_gpu_render_target_set_depth_from(iron_gpu_texture_t *target, iron_gpu_
|
||||
|
||||
void iron_gpu_vertex_buffer_init(iron_gpu_buffer_t *buffer, int count, iron_gpu_vertex_structure_t *structure, bool gpu_memory) {
|
||||
memset(&buffer->impl, 0, sizeof(buffer->impl));
|
||||
buffer->impl.myCount = count;
|
||||
buffer->myCount = count;
|
||||
buffer->impl.gpu_memory = gpu_memory;
|
||||
for (int i = 0; i < structure->size; ++i) {
|
||||
iron_gpu_vertex_element_t element = structure->elements[i];
|
||||
@@ -971,7 +959,7 @@ void iron_gpu_vertex_buffer_unlock(iron_gpu_buffer_t *buf) {
|
||||
}
|
||||
|
||||
int iron_gpu_vertex_buffer_count(iron_gpu_buffer_t *buffer) {
|
||||
return buffer->impl.myCount;
|
||||
return buffer->myCount;
|
||||
}
|
||||
|
||||
int iron_gpu_vertex_buffer_stride(iron_gpu_buffer_t *buffer) {
|
||||
|
||||
@@ -2447,9 +2447,6 @@ void iron_gpu_pipeline_compile(iron_gpu_pipeline_t *pipeline) {
|
||||
case IRON_GPU_VERTEX_DATA_F32_4X:
|
||||
vi_attrs[attr].format = VK_FORMAT_R32G32B32A32_SFLOAT;
|
||||
break;
|
||||
case IRON_GPU_VERTEX_DATA_U8_4X_NORM:
|
||||
vi_attrs[attr].format = VK_FORMAT_R8G8B8A8_UNORM;
|
||||
break;
|
||||
case IRON_GPU_VERTEX_DATA_I16_2X_NORM:
|
||||
vi_attrs[attr].format = VK_FORMAT_R16G16_SNORM;
|
||||
break;
|
||||
@@ -3257,8 +3254,7 @@ void iron_gpu_render_target_set_depth_from(iron_gpu_texture_t *target, iron_gpu_
|
||||
}
|
||||
|
||||
void iron_gpu_vertex_buffer_init(iron_gpu_buffer_t *buffer, int vertexCount, iron_gpu_vertex_structure_t *structure, bool gpuMemory) {
|
||||
buffer->myCount = count;
|
||||
buffer->impl.myCount = vertexCount;
|
||||
buffer->myCount = vertexCount;
|
||||
buffer->impl.myStride = 0;
|
||||
for (int i = 0; i < structure->size; ++i) {
|
||||
iron_gpu_vertex_element_t element = structure->elements[i];
|
||||
@@ -3320,7 +3316,7 @@ void iron_gpu_vertex_buffer_destroy(iron_gpu_buffer_t *buffer) {
|
||||
|
||||
float *iron_gpu_vertex_buffer_lock(iron_gpu_buffer_t *buffer) {
|
||||
int start = 0;
|
||||
int count = buffer->impl.myCount;
|
||||
int count = buffer->myCount;
|
||||
vkMapMemory(vk_ctx.device, buffer->impl.mem, start * buffer->impl.myStride, count * buffer->impl.myStride, 0, (void **)&buffer->impl.data);
|
||||
return buffer->impl.data;
|
||||
}
|
||||
@@ -3334,7 +3330,7 @@ int iron_gpu_internal_vertex_buffer_set(iron_gpu_buffer_t *buffer) {
|
||||
}
|
||||
|
||||
int iron_gpu_vertex_buffer_count(iron_gpu_buffer_t *buffer) {
|
||||
return buffer->impl.myCount;
|
||||
return buffer->myCount;
|
||||
}
|
||||
|
||||
int iron_gpu_vertex_buffer_stride(iron_gpu_buffer_t *buffer) {
|
||||
@@ -3402,7 +3398,7 @@ int iron_gpu_constant_buffer_size(iron_gpu_buffer_t *buffer) {
|
||||
}
|
||||
|
||||
void iron_gpu_index_buffer_init(iron_gpu_buffer_t *buffer, int indexCount, bool gpuMemory) {
|
||||
buffer->impl.myCount = indexCount;
|
||||
buffer->myCount = indexCount;
|
||||
|
||||
VkBufferCreateInfo buf_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
|
||||
@@ -3469,7 +3465,7 @@ void iron_gpu_index_buffer_unlock(iron_gpu_buffer_t *buffer) {
|
||||
}
|
||||
|
||||
int iron_gpu_index_buffer_count(iron_gpu_buffer_t *buffer) {
|
||||
return buffer->impl.myCount;
|
||||
return buffer->myCount;
|
||||
}
|
||||
|
||||
static const int INDEX_RAYGEN = 0;
|
||||
@@ -3942,8 +3938,8 @@ void iron_gpu_raytrace_acceleration_structure_build(iron_gpu_raytrace_accelerati
|
||||
if (build_bottom) {
|
||||
for (int i = 0; i < vb_count; ++i) {
|
||||
|
||||
uint32_t prim_count = ib[i]->impl.myCount / 3;
|
||||
uint32_t vert_count = vb[i]->impl.myCount;
|
||||
uint32_t prim_count = ib[i]->myCount / 3;
|
||||
uint32_t vert_count = vb[i]->myCount;
|
||||
|
||||
VkDeviceOrHostAddressConstKHR vertex_data_device_address = {0};
|
||||
VkDeviceOrHostAddressConstKHR index_data_device_address = {0};
|
||||
@@ -3959,7 +3955,7 @@ void iron_gpu_raytrace_acceleration_structure_build(iron_gpu_raytrace_accelerati
|
||||
.geometry.triangles.vertexFormat = VK_FORMAT_R16G16B16A16_SNORM,
|
||||
.geometry.triangles.vertexData.deviceAddress = vertex_data_device_address.deviceAddress,
|
||||
.geometry.triangles.vertexStride = vb[i]->impl.myStride,
|
||||
.geometry.triangles.maxVertex = vb[i]->impl.myCount,
|
||||
.geometry.triangles.maxVertex = vb[i]->myCount,
|
||||
.geometry.triangles.indexType = VK_INDEX_TYPE_UINT32,
|
||||
.geometry.triangles.indexData.deviceAddress = index_data_device_address.deviceAddress,
|
||||
};
|
||||
@@ -4180,7 +4176,7 @@ void iron_gpu_raytrace_acceleration_structure_build(iron_gpu_raytrace_accelerati
|
||||
|
||||
int ib_off = 0;
|
||||
for (int j = 0; j < instances[i].i; ++j) {
|
||||
ib_off += ib[j]->impl.myCount * 4;
|
||||
ib_off += ib[j]->myCount * 4;
|
||||
}
|
||||
instance.instanceCustomIndex = ib_off;
|
||||
|
||||
|
||||
@@ -259,9 +259,6 @@ void iron_gpu_pipeline_compile(iron_gpu_pipeline_t *pipe) {
|
||||
case IRON_GPU_VERTEX_DATA_F32_4X:
|
||||
vaDesc[i].format = WGPUVertexFormat_Float32x4;
|
||||
break;
|
||||
case IRON_GPU_VERTEX_DATA_U8_4X_NORM:
|
||||
vaDesc[i].format = WGPUVertexFormat_Unorm8x4;
|
||||
break;
|
||||
case IRON_GPU_VERTEX_DATA_I16_2X_NORM:
|
||||
vaDesc[i].format = WGPUVertexFormat_Snorm16x2;
|
||||
break;
|
||||
|
||||
@@ -550,10 +550,12 @@ void draw_string(const char *text, float x, float y) {
|
||||
if (draw_font_get_baked_quad(draw_font, draw_font_size, &q, codepoint, xpos, ypos)) {
|
||||
xpos += q.xadvance;
|
||||
|
||||
//
|
||||
gpu_set_pipeline(draw_custom_pipeline != NULL ? draw_custom_pipeline : _draw_current != NULL ? &text_pipeline_rt : &text_pipeline);
|
||||
gpu_set_vertex_buffer(&rect_vertex_buffer);
|
||||
gpu_set_index_buffer(&rect_index_buffer);
|
||||
gpu_set_texture(&text_tex_unit, tex);
|
||||
//
|
||||
|
||||
gpu_set_float4(&text_pos_loc, q.x0 / vw(), q.y0 / vh(), (q.x1 - q.x0) / vw(), (q.y1 - q.y0) / vh());
|
||||
gpu_set_float4(&text_tex_loc, q.s0, q.t0, q.s1 - q.s0, q.t1 - q.t0);
|
||||
|
||||
@@ -45,7 +45,6 @@ typedef enum iron_gpu_vertex_data {
|
||||
IRON_GPU_VERTEX_DATA_F32_2X,
|
||||
IRON_GPU_VERTEX_DATA_F32_3X,
|
||||
IRON_GPU_VERTEX_DATA_F32_4X,
|
||||
IRON_GPU_VERTEX_DATA_U8_4X_NORM,
|
||||
IRON_GPU_VERTEX_DATA_I16_2X_NORM,
|
||||
IRON_GPU_VERTEX_DATA_I16_4X_NORM,
|
||||
} iron_gpu_vertex_data_t;
|
||||
@@ -292,8 +291,6 @@ static inline int iron_gpu_vertex_data_size(iron_gpu_vertex_data_t data) {
|
||||
return 3 * 4;
|
||||
case IRON_GPU_VERTEX_DATA_F32_4X:
|
||||
return 4 * 4;
|
||||
case IRON_GPU_VERTEX_DATA_U8_4X_NORM:
|
||||
return 4 * 1;
|
||||
case IRON_GPU_VERTEX_DATA_I16_2X_NORM:
|
||||
return 2 * 2;
|
||||
case IRON_GPU_VERTEX_DATA_I16_4X_NORM:
|
||||
|
||||
@@ -9,7 +9,6 @@ function const_data_create_screen_aligned_data() {
|
||||
let data: f32[] = [-1.0, -1.0, 3.0, -1.0, -1.0, 3.0];
|
||||
let indices: i32[] = [0, 1, 2];
|
||||
|
||||
// Mandatory vertex data names and sizes
|
||||
let structure: iron_gpu_vertex_structure_t = gpu_vertex_struct_create();
|
||||
gpu_vertex_struct_add(structure, "pos", vertex_data_t.F32_2X);
|
||||
const_data_screen_aligned_vb = gpu_create_vertex_buffer(math_floor(data.length / math_floor(iron_gpu_vertex_struct_size(structure) / 4)), structure, usage_t.STATIC);
|
||||
|
||||
@@ -665,7 +665,6 @@ enum vertex_data_t {
|
||||
F32_2X,
|
||||
F32_3X,
|
||||
F32_4X,
|
||||
U8_4X_NORM,
|
||||
I16_2X_NORM,
|
||||
I16_4X_NORM,
|
||||
}
|
||||
|
||||
@@ -182,15 +182,18 @@ function node_shader_get(raw: node_shader_t): string {
|
||||
}
|
||||
s += "}\n\n";
|
||||
|
||||
s += "#[set(everything)]\n";
|
||||
s += "const constants: {\n";
|
||||
if (raw.constants.length > 0) {
|
||||
s += "#[set(everything)]\n";
|
||||
s += "const constants: {\n";
|
||||
for (let i: i32 = 0; i < raw.constants.length; ++i) {
|
||||
let a: string = raw.constants[i];
|
||||
s += "\t" + a + ";\n";
|
||||
}
|
||||
s += "};\n\n";
|
||||
}
|
||||
else {
|
||||
s += "\tempty: float4;\n";
|
||||
}
|
||||
s += "};\n\n";
|
||||
|
||||
if (raw.textures.length > 0) {
|
||||
s += "#[set(everything)]\n";
|
||||
|
||||
@@ -350,9 +350,6 @@ function render_path_base_draw_taa(bufa: string, bufb: string) {
|
||||
|
||||
function render_path_base_draw_gbuffer() {
|
||||
render_path_set_target("gbuffer0", null, clear_flag_t.DEPTH, 0, 1.0); // Only clear gbuffer0
|
||||
if (make_mesh_layer_pass_count == 1) {
|
||||
render_path_set_target("gbuffer2", null, clear_flag_t.COLOR, 0xff000000);
|
||||
}
|
||||
let additional: string[] = ["gbuffer1", "gbuffer2"];
|
||||
render_path_set_target("gbuffer0", additional);
|
||||
render_path_paint_bind_layers();
|
||||
|
||||
Reference in New Issue
Block a user