Skip to content

Commit

Permalink
Use g5
Browse files Browse the repository at this point in the history
  • Loading branch information
luboslenco committed Feb 17, 2025
1 parent b3fd929 commit fc74872
Show file tree
Hide file tree
Showing 43 changed files with 483 additions and 768 deletions.
2 changes: 1 addition & 1 deletion armorcore/sources/backends/android/kinc/backend/video.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ int kinc_video_height(kinc_video_t *video) {
return 512;
}

kinc_g4_texture_t *kinc_video_current_image(kinc_video_t *video) {
kinc_g5_texture_t *kinc_video_current_image(kinc_video_t *video) {
return NULL;
}

Expand Down
2 changes: 1 addition & 1 deletion armorcore/sources/backends/android/kinc/backend/video.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ typedef struct {
void *sound;
void *androidVideo;
int id;
kinc_g4_texture_t image;
kinc_g5_texture_t image;
double lastTime;
int myWidth;
int myHeight;
Expand Down
2 changes: 1 addition & 1 deletion armorcore/sources/backends/apple/kinc/backend/video.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ typedef struct {
bool loop;
void *sound;
bool image_initialized;
kinc_g4_texture_t image;
kinc_g5_texture_t image;
double lastTime;
float duration;
bool finished;
Expand Down
4 changes: 2 additions & 2 deletions armorcore/sources/backends/apple/kinc/backend/video.m.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ static void updateImage(kinc_video_t *video) {
CGSize size = CVImageBufferGetDisplaySize(pixelBuffer);
video->impl.myWidth = size.width;
video->impl.myHeight = size.height;
kinc_g4_texture_init(&video->impl.image, kinc_video_width(video), kinc_video_height(video), KINC_IMAGE_FORMAT_BGRA32);
kinc_g5_texture_init(&video->impl.image, kinc_video_width(video), kinc_video_height(video), KINC_IMAGE_FORMAT_BGRA32);
video->impl.image_initialized = true;
}

Expand Down Expand Up @@ -284,7 +284,7 @@ int kinc_video_height(kinc_video_t *video) {
return video->impl.myHeight;
}

kinc_g4_texture_t *kinc_video_current_image(kinc_video_t *video) {
kinc_g5_texture_t *kinc_video_current_image(kinc_video_t *video) {
kinc_video_update(video, kinc_time());
return &video->impl.image;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ void kinc_g5_command_list_get_render_target_pixels(kinc_g5_command_list_t *list,
render_target->impl.renderTarget->lpVtbl->GetDesc(render_target->impl.renderTarget, &desc);
DXGI_FORMAT dxgiFormat = desc.Format;
int formatByteSize = formatSize(dxgiFormat);
int rowPitch = render_target->texWidth * formatByteSize;
int rowPitch = render_target->tex_width * formatByteSize;
int align = rowPitch % d3d12_textureAlignment();
if (align != 0)
rowPitch = rowPitch + (d3d12_textureAlignment() - align);
Expand All @@ -395,7 +395,7 @@ void kinc_g5_command_list_get_render_target_pixels(kinc_g5_command_list_t *list,
D3D12_RESOURCE_DESC resourceDesc;
resourceDesc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER;
resourceDesc.Alignment = 0;
resourceDesc.Width = rowPitch * render_target->texHeight;
resourceDesc.Width = rowPitch * render_target->tex_height;
resourceDesc.Height = 1;
resourceDesc.DepthOrArraySize = 1;
resourceDesc.MipLevels = 1;
Expand Down Expand Up @@ -433,8 +433,8 @@ void kinc_g5_command_list_get_render_target_pixels(kinc_g5_command_list_t *list,
dest.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT;
dest.PlacedFootprint.Offset = 0;
dest.PlacedFootprint.Footprint.Format = dxgiFormat;
dest.PlacedFootprint.Footprint.Width = render_target->texWidth;
dest.PlacedFootprint.Footprint.Height = render_target->texHeight;
dest.PlacedFootprint.Footprint.Width = render_target->tex_width;
dest.PlacedFootprint.Footprint.Height = render_target->tex_height;
dest.PlacedFootprint.Footprint.Depth = 1;
dest.PlacedFootprint.Footprint.RowPitch = rowPitch;

Expand All @@ -459,7 +459,7 @@ void kinc_g5_command_list_get_render_target_pixels(kinc_g5_command_list_t *list,
// Read buffer
void *p;
render_target->impl.renderTargetReadback->lpVtbl->Map(render_target->impl.renderTargetReadback, 0, NULL, &p);
memcpy(data, p, render_target->texWidth * render_target->texHeight * formatByteSize);
memcpy(data, p, render_target->tex_width * render_target->tex_height * formatByteSize);
render_target->impl.renderTargetReadback->lpVtbl->Unmap(render_target->impl.renderTargetReadback, 0, NULL);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ void kinc_g5_internal_set_compute_constants(kinc_g5_command_list_t *commandList)
}

void kinc_g5_pipeline_init(kinc_g5_pipeline_t *pipe) {
kinc_g5_internal_pipeline_set_defaults(pipe);
kinc_g5_internal_pipeline_init(pipe);
}

Expand Down Expand Up @@ -227,9 +228,10 @@ static void set_blend_state(D3D12_BLEND_DESC *blend_desc, kinc_g5_pipeline_t *pi
blend_desc->RenderTarget[target].DestBlendAlpha = convert_blend_factor(pipe->alpha_blend_destination);
blend_desc->RenderTarget[target].BlendOpAlpha = convert_blend_operation(pipe->alpha_blend_operation);
blend_desc->RenderTarget[target].RenderTargetWriteMask =
(((pipe->colorWriteMaskRed[target] ? D3D12_COLOR_WRITE_ENABLE_RED : 0) | (pipe->colorWriteMaskGreen[target] ? D3D12_COLOR_WRITE_ENABLE_GREEN : 0)) |
(pipe->colorWriteMaskBlue[target] ? D3D12_COLOR_WRITE_ENABLE_BLUE : 0)) |
(pipe->colorWriteMaskAlpha[target] ? D3D12_COLOR_WRITE_ENABLE_ALPHA : 0);
(((pipe->color_write_mask_red[target] ? D3D12_COLOR_WRITE_ENABLE_RED : 0) |
(pipe->color_write_mask_green[target] ? D3D12_COLOR_WRITE_ENABLE_GREEN : 0)) |
(pipe->color_write_mask_blue[target] ? D3D12_COLOR_WRITE_ENABLE_BLUE : 0)) |
(pipe->color_write_mask_alpha[target] ? D3D12_COLOR_WRITE_ENABLE_ALPHA : 0);
}

void kinc_g5_pipeline_compile(kinc_g5_pipeline_t *pipe) {
Expand Down Expand Up @@ -369,9 +371,9 @@ void kinc_g5_pipeline_compile(kinc_g5_pipeline_t *pipe) {
psoDesc.PS.BytecodeLength = pipe->fragment_shader->impl.length;
psoDesc.PS.pShaderBytecode = pipe->fragment_shader->impl.data;
psoDesc.pRootSignature = globalRootSignature;
psoDesc.NumRenderTargets = pipe->colorAttachmentCount;
for (int i = 0; i < pipe->colorAttachmentCount; ++i) {
psoDesc.RTVFormats[i] = convert_format(pipe->colorAttachment[i]);
psoDesc.NumRenderTargets = pipe->color_attachment_count;
for (int i = 0; i < pipe->color_attachment_count; ++i) {
psoDesc.RTVFormats[i] = convert_format(pipe->color_attachment[i]);
}
psoDesc.DSVFormat = DXGI_FORMAT_UNKNOWN;

Expand Down Expand Up @@ -410,8 +412,10 @@ void kinc_g5_pipeline_compile(kinc_g5_pipeline_t *pipe) {

bool independentBlend = false;
for (int i = 1; i < 8; ++i) {
if (pipe->colorWriteMaskRed[0] != pipe->colorWriteMaskRed[i] || pipe->colorWriteMaskGreen[0] != pipe->colorWriteMaskGreen[i] ||
pipe->colorWriteMaskBlue[0] != pipe->colorWriteMaskBlue[i] || pipe->colorWriteMaskAlpha[0] != pipe->colorWriteMaskAlpha[i]) {
if (pipe->color_write_mask_red[0] != pipe->color_write_mask_red[i] ||
pipe->color_write_mask_green[0] != pipe->color_write_mask_green[i] ||
pipe->color_write_mask_blue[0] != pipe->color_write_mask_blue[i] ||
pipe->color_write_mask_alpha[0] != pipe->color_write_mask_alpha[i]) {
independentBlend = true;
break;
}
Expand All @@ -435,9 +439,9 @@ void kinc_g5_pipeline_compile(kinc_g5_pipeline_t *pipe) {
psoDesc.DepthStencilState.FrontFace = defaultStencilOp;
psoDesc.DepthStencilState.BackFace = defaultStencilOp;

psoDesc.DepthStencilState.DepthEnable = pipe->depthMode != KINC_G5_COMPARE_MODE_ALWAYS;
psoDesc.DepthStencilState.DepthWriteMask = pipe->depthWrite ? D3D12_DEPTH_WRITE_MASK_ALL : D3D12_DEPTH_WRITE_MASK_ZERO;
psoDesc.DepthStencilState.DepthFunc = convert_compare_mode(pipe->depthMode);
psoDesc.DepthStencilState.DepthEnable = pipe->depth_mode != KINC_G5_COMPARE_MODE_ALWAYS;
psoDesc.DepthStencilState.DepthWriteMask = pipe->depth_write ? D3D12_DEPTH_WRITE_MASK_ALL : D3D12_DEPTH_WRITE_MASK_ZERO;
psoDesc.DepthStencilState.DepthFunc = convert_compare_mode(pipe->depth_mode);
psoDesc.DepthStencilState.StencilEnable = false;
psoDesc.DSVFormat = DXGI_FORMAT_D32_FLOAT;
psoDesc.SampleDesc.Count = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -802,8 +802,8 @@ void kinc_raytrace_set_target(kinc_g5_render_target_t *_output) {
heapProperties.VisibleNodeMask = 1;
D3D12_RESOURCE_DESC desc = {};
desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
desc.Width = _output->texWidth;
desc.Height = _output->texHeight;
desc.Width = _output->tex_width;
desc.Height = _output->tex_height;
desc.DepthOrArraySize = 1;
desc.MipLevels = 1;
desc.Format = DXGI_FORMAT_R16G16B16A16_FLOAT;
Expand Down Expand Up @@ -893,8 +893,8 @@ void kinc_raytrace_dispatch_rays(kinc_g5_command_list_t *command_list) {
dispatchDesc.RayGenerationShaderRecord.StartAddress = pipeline->impl.raygen_shader_table->lpVtbl->GetGPUVirtualAddress(pipeline->impl.raygen_shader_table);
pipeline->impl.raygen_shader_table->lpVtbl->GetDesc(pipeline->impl.raygen_shader_table, &desc);
dispatchDesc.RayGenerationShaderRecord.SizeInBytes = desc.Width;
dispatchDesc.Width = output->texWidth;
dispatchDesc.Height = output->texHeight;
dispatchDesc.Width = output->tex_width;
dispatchDesc.Height = output->tex_height;
dispatchDesc.Depth = 1;
dxrCommandList->lpVtbl->SetPipelineState1(dxrCommandList, pipeline->impl.dxr_state);
dxrCommandList->lpVtbl->DispatchRays(dxrCommandList, &dispatchDesc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ static DXGI_FORMAT convertFormat(kinc_g5_render_target_format_t format) {
void kinc_memory_emergency();

static void render_target_init(kinc_g5_render_target_t *render_target, int width, int height, kinc_g5_render_target_format_t format, int depthBufferBits, int framebuffer_index) {
render_target->texWidth = render_target->width = width;
render_target->texHeight = render_target->height = height;
render_target->tex_width = render_target->width = width;
render_target->tex_height = render_target->height = height;
render_target->impl.stage = 0;
render_target->impl.stage_depth = -1;
render_target->impl.renderTargetReadback = NULL;
Expand All @@ -71,8 +71,8 @@ static void render_target_init(kinc_g5_render_target_t *render_target, int width
D3D12_RESOURCE_DESC texResourceDesc;
texResourceDesc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
texResourceDesc.Alignment = 0;
texResourceDesc.Width = render_target->texWidth;
texResourceDesc.Height = render_target->texHeight;
texResourceDesc.Width = render_target->tex_width;
texResourceDesc.Height = render_target->tex_height;
texResourceDesc.DepthOrArraySize = 1;
texResourceDesc.MipLevels = 1;
texResourceDesc.Format = dxgiFormat;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,10 @@ void kinc_g5_texture_init_from_image(kinc_g5_texture_t *texture, kinc_image_t *i
memset(&texture->impl, 0, sizeof(texture->impl));
texture->impl.stage = 0;
texture->impl.mipmap = true;
texture->texWidth = image->width;
texture->texHeight = image->height;
texture->tex_width = image->width;
texture->tex_height = image->height;
texture->_uploaded = false;
texture->format = image->format;

DXGI_FORMAT d3dformat = convertImageFormat(image->format);
int formatSize = formatByteSize(image->format);
Expand All @@ -182,8 +184,8 @@ void kinc_g5_texture_init_from_image(kinc_g5_texture_t *texture, kinc_image_t *i
D3D12_RESOURCE_DESC resourceDescTex;
resourceDescTex.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
resourceDescTex.Alignment = 0;
resourceDescTex.Width = texture->texWidth;
resourceDescTex.Height = texture->texHeight;
resourceDescTex.Width = texture->tex_width;
resourceDescTex.Height = texture->tex_height;
resourceDescTex.DepthOrArraySize = 1;
resourceDescTex.MipLevels = 1;
resourceDescTex.Format = d3dformat;
Expand Down Expand Up @@ -248,8 +250,8 @@ void kinc_g5_texture_init_from_image(kinc_g5_texture_t *texture, kinc_image_t *i
BYTE *pixel;
texture->impl.uploadImage->lpVtbl->Map(texture->impl.uploadImage, 0, NULL, (void **)&pixel);
int pitch = kinc_g5_texture_stride(texture);
for (int y = 0; y < texture->texHeight; ++y) {
memcpy(&pixel[y * pitch], &((uint8_t *)image->data)[y * texture->texWidth * formatSize], texture->texWidth * formatSize);
for (int y = 0; y < texture->tex_height; ++y) {
memcpy(&pixel[y * pitch], &((uint8_t *)image->data)[y * texture->tex_width * formatSize], texture->tex_width * formatSize);
}
texture->impl.uploadImage->lpVtbl->Unmap(texture->impl.uploadImage, 0, NULL);

Expand Down Expand Up @@ -281,8 +283,8 @@ void create_texture(struct kinc_g5_texture *texture, int width, int height, kinc
memset(&texture->impl, 0, sizeof(texture->impl));
texture->impl.stage = 0;
texture->impl.mipmap = true;
texture->texWidth = width;
texture->texHeight = height;
texture->tex_width = width;
texture->tex_height = height;

DXGI_FORMAT d3dformat = convertImageFormat(format);

Expand All @@ -296,8 +298,8 @@ void create_texture(struct kinc_g5_texture *texture, int width, int height, kinc
D3D12_RESOURCE_DESC resourceDescTex;
resourceDescTex.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
resourceDescTex.Alignment = 0;
resourceDescTex.Width = texture->texWidth;
resourceDescTex.Height = texture->texHeight;
resourceDescTex.Width = texture->tex_width;
resourceDescTex.Height = texture->tex_height;
resourceDescTex.DepthOrArraySize = 1;
resourceDescTex.MipLevels = 1;
resourceDescTex.Format = d3dformat;
Expand Down Expand Up @@ -385,6 +387,8 @@ void create_texture(struct kinc_g5_texture *texture, int width, int height, kinc

void kinc_g5_texture_init(struct kinc_g5_texture *texture, int width, int height, kinc_image_format_t format) {
create_texture(texture, width, height, format, D3D12_RESOURCE_FLAG_NONE);
texture->_uploaded = true;
texture->format = format;
}

void kinc_g5_texture_init_non_sampled_access(struct kinc_g5_texture *texture, int width, int height, kinc_image_format_t format) {
Expand Down Expand Up @@ -425,6 +429,7 @@ uint8_t *kinc_g5_texture_lock(struct kinc_g5_texture *texture) {

void kinc_g5_texture_unlock(struct kinc_g5_texture *texture) {
texture->impl.uploadImage->lpVtbl->Unmap(texture->impl.uploadImage, 0, NULL);
texture->_uploaded = false;
}

int kinc_g5_texture_stride(struct kinc_g5_texture *texture) {
Expand Down
2 changes: 1 addition & 1 deletion armorcore/sources/backends/linux/kinc/backend/video.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ int kinc_video_height(kinc_video_t *video) {
return 256;
}

kinc_g4_texture_t *kinc_video_current_image(kinc_video_t *video) {
kinc_g5_texture_t *kinc_video_current_image(kinc_video_t *video) {
return NULL;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ void kinc_g5_command_list_scissor(kinc_g5_command_list_t *list, int x, int y, in
int target_w = -1;
int target_h = -1;
if (lastRenderTargets[0] != NULL) {
target_w = lastRenderTargets[0]->texWidth;
target_h = lastRenderTargets[0]->texHeight;
target_w = lastRenderTargets[0]->tex_width;
target_h = lastRenderTargets[0]->tex_height;
}
else {
target_w = kinc_window_width();
Expand All @@ -115,8 +115,8 @@ void kinc_g5_command_list_disable_scissor(kinc_g5_command_list_t *list) {
scissor.x = 0;
scissor.y = 0;
if (lastRenderTargets[0] != NULL) {
scissor.width = lastRenderTargets[0]->texWidth;
scissor.height = lastRenderTargets[0]->texHeight;
scissor.width = lastRenderTargets[0]->tex_width;
scissor.height = lastRenderTargets[0]->tex_height;
}
else {
scissor.width = kinc_window_width();
Expand Down Expand Up @@ -167,8 +167,8 @@ void kinc_g5_command_list_get_render_target_pixels(kinc_g5_command_list_t *list,
id<MTLDevice> device = getMetalDevice();
MTLTextureDescriptor *descriptor = [MTLTextureDescriptor new];
descriptor.textureType = MTLTextureType2D;
descriptor.width = render_target->texWidth;
descriptor.height = render_target->texHeight;
descriptor.width = render_target->tex_width;
descriptor.height = render_target->tex_height;
descriptor.depth = 1;
descriptor.pixelFormat = [(__bridge id<MTLTexture>)render_target->impl._tex pixelFormat];
descriptor.arrayLength = 1;
Expand All @@ -186,7 +186,7 @@ void kinc_g5_command_list_get_render_target_pixels(kinc_g5_command_list_t *list,
sourceSlice:0
sourceLevel:0
sourceOrigin:MTLOriginMake(0, 0, 0)
sourceSize:MTLSizeMake(render_target->texWidth, render_target->texHeight, 1)
sourceSize:MTLSizeMake(render_target->tex_width, render_target->tex_height, 1)
toTexture:(__bridge id<MTLTexture>)render_target->impl._texReadback
destinationSlice:0
destinationLevel:0
Expand All @@ -198,8 +198,8 @@ void kinc_g5_command_list_get_render_target_pixels(kinc_g5_command_list_t *list,
// Read buffer
id<MTLTexture> tex = (__bridge id<MTLTexture>)render_target->impl._texReadback;
int formatByteSize = formatSize([(__bridge id<MTLTexture>)render_target->impl._tex pixelFormat]);
MTLRegion region = MTLRegionMake2D(0, 0, render_target->texWidth, render_target->texHeight);
[tex getBytes:data bytesPerRow:formatByteSize * render_target->texWidth fromRegion:region mipmapLevel:0];
MTLRegion region = MTLRegionMake2D(0, 0, render_target->tex_width, render_target->tex_height);
[tex getBytes:data bytesPerRow:formatByteSize * render_target->tex_width fromRegion:region mipmapLevel:0];
}

void kinc_g5_command_list_execute(kinc_g5_command_list_t *list) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ static MTLPixelFormat convert_render_target_format(kinc_g5_render_target_format_

void kinc_g5_pipeline_init(kinc_g5_pipeline_t *pipeline) {
memset(&pipeline->impl, 0, sizeof(pipeline->impl));
kinc_g5_internal_pipeline_set_defaults(pipeline);
}

void kinc_g5_pipeline_destroy(kinc_g5_pipeline_t *pipeline) {
Expand Down Expand Up @@ -144,8 +145,8 @@ void kinc_g5_pipeline_compile(kinc_g5_pipeline_t *pipeline) {
MTLRenderPipelineDescriptor *renderPipelineDesc = [[MTLRenderPipelineDescriptor alloc] init];
renderPipelineDesc.vertexFunction = (__bridge id<MTLFunction>)pipeline->vertex_shader->impl.mtlFunction;
renderPipelineDesc.fragmentFunction = (__bridge id<MTLFunction>)pipeline->fragment_shader->impl.mtlFunction;
for (int i = 0; i < pipeline->colorAttachmentCount; ++i) {
renderPipelineDesc.colorAttachments[i].pixelFormat = convert_render_target_format(pipeline->colorAttachment[i]);
for (int i = 0; i < pipeline->color_attachment_count; ++i) {
renderPipelineDesc.colorAttachments[i].pixelFormat = convert_render_target_format(pipeline->color_attachment[i]);
renderPipelineDesc.colorAttachments[i].blendingEnabled =
pipeline->blend_source != KINC_G5_BLEND_ONE || pipeline->blend_destination != KINC_G5_BLEND_ZERO ||
pipeline->alpha_blend_source != KINC_G5_BLEND_ONE || pipeline->alpha_blend_destination != KINC_G5_BLEND_ZERO;
Expand All @@ -156,8 +157,10 @@ void kinc_g5_pipeline_compile(kinc_g5_pipeline_t *pipeline) {
renderPipelineDesc.colorAttachments[i].destinationAlphaBlendFactor = convert_blending_factor(pipeline->alpha_blend_destination);
renderPipelineDesc.colorAttachments[i].alphaBlendOperation = convert_blending_operation(pipeline->alpha_blend_operation);
renderPipelineDesc.colorAttachments[i].writeMask =
(pipeline->colorWriteMaskRed[i] ? MTLColorWriteMaskRed : 0) | (pipeline->colorWriteMaskGreen[i] ? MTLColorWriteMaskGreen : 0) |
(pipeline->colorWriteMaskBlue[i] ? MTLColorWriteMaskBlue : 0) | (pipeline->colorWriteMaskAlpha[i] ? MTLColorWriteMaskAlpha : 0);
(pipeline->color_write_mask_red[i] ? MTLColorWriteMaskRed : 0) |
(pipeline->color_write_mask_green[i] ? MTLColorWriteMaskGreen : 0) |
(pipeline->color_write_mask_blue[i] ? MTLColorWriteMaskBlue : 0) |
(pipeline->color_write_mask_alpha[i] ? MTLColorWriteMaskAlpha : 0);
}
renderPipelineDesc.depthAttachmentPixelFormat = MTLPixelFormatInvalid;
renderPipelineDesc.stencilAttachmentPixelFormat = MTLPixelFormatInvalid;
Expand Down Expand Up @@ -331,8 +334,8 @@ void kinc_g5_pipeline_compile(kinc_g5_pipeline_t *pipeline) {
pipeline->impl._reflection = (__bridge_retained void *)reflection;

MTLDepthStencilDescriptor *depthStencilDescriptor = [MTLDepthStencilDescriptor new];
depthStencilDescriptor.depthCompareFunction = convert_compare_mode(pipeline->depthMode);
depthStencilDescriptor.depthWriteEnabled = pipeline->depthWrite;
depthStencilDescriptor.depthCompareFunction = convert_compare_mode(pipeline->depth_mode);
depthStencilDescriptor.depthWriteEnabled = pipeline->depth_write;
pipeline->impl._depthStencil = (__bridge_retained void *)[device newDepthStencilStateWithDescriptor:depthStencilDescriptor];

depthStencilDescriptor.depthCompareFunction = MTLCompareFunctionAlways;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ void kinc_raytrace_dispatch_rays(kinc_g5_command_list_t *command_list) {
dispatch_semaphore_signal(sem);
}];

NSUInteger width = output->texWidth;
NSUInteger height = output->texHeight;
NSUInteger width = output->tex_width;
NSUInteger height = output->tex_height;
MTLSize threads_per_threadgroup = MTLSizeMake(8, 8, 1);
MTLSize threadgroups = MTLSizeMake((width + threads_per_threadgroup.width - 1) / threads_per_threadgroup.width,
(height + threads_per_threadgroup.height - 1) / threads_per_threadgroup.height, 1);
Expand Down
Loading

0 comments on commit fc74872

Please sign in to comment.