mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 02:41:49 -05:00
fix: clang-format
This commit is contained in:
parent
1efdd483b7
commit
86b1f41de6
7 changed files with 133 additions and 128 deletions
|
@ -146,7 +146,8 @@ inline size_t GetTextureBytesPerRow(VideoCore::Surface::PixelFormat pixel_format
|
||||||
format_info.bytes_per_block;
|
format_info.bytes_per_block;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline MTL::VertexFormat VertexFormat(Maxwell::VertexAttribute::Type type, Maxwell::VertexAttribute::Size size) {
|
inline MTL::VertexFormat VertexFormat(Maxwell::VertexAttribute::Type type,
|
||||||
|
Maxwell::VertexAttribute::Size size) {
|
||||||
const MTL::VertexFormat format{([&]() {
|
const MTL::VertexFormat format{([&]() {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Maxwell::VertexAttribute::Type::UnusedEnumDoNotUseBecauseItWillGoAway:
|
case Maxwell::VertexAttribute::Type::UnusedEnumDoNotUseBecauseItWillGoAway:
|
||||||
|
|
|
@ -83,8 +83,8 @@ void BufferCacheRuntime::CopyBuffer(MTL::Buffer* dst_buffer, MTL::Buffer* src_bu
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferCacheRuntime::ClearBuffer(MTL::Buffer* dest_buffer, u32 offset, size_t size, u32 value) {
|
void BufferCacheRuntime::ClearBuffer(MTL::Buffer* dest_buffer, u32 offset, size_t size, u32 value) {
|
||||||
LOG_DEBUG(Render_Metal, "called (buffer: {}, offset: {}, size: {}, value: {})", (void*)dest_buffer,
|
LOG_DEBUG(Render_Metal, "called (buffer: {}, offset: {}, size: {}, value: {})",
|
||||||
offset, size, value);
|
(void*)dest_buffer, offset, size, value);
|
||||||
// TODO: clear buffer
|
// TODO: clear buffer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,8 +110,7 @@ public:
|
||||||
|
|
||||||
void BindQuadIndexBuffer(PrimitiveTopology topology, u32 first, u32 count);
|
void BindQuadIndexBuffer(PrimitiveTopology topology, u32 first, u32 count);
|
||||||
|
|
||||||
void BindVertexBuffer(u32 index, MTL::Buffer* buffer, u32 offset, u32 size,
|
void BindVertexBuffer(u32 index, MTL::Buffer* buffer, u32 offset, u32 size, u32 stride);
|
||||||
u32 stride);
|
|
||||||
|
|
||||||
void BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bindings);
|
void BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bindings);
|
||||||
|
|
||||||
|
|
|
@ -13,12 +13,12 @@
|
||||||
#include "common/bit_field.h"
|
#include "common/bit_field.h"
|
||||||
#include "video_core/buffer_cache/buffer_cache_base.h"
|
#include "video_core/buffer_cache/buffer_cache_base.h"
|
||||||
#include "video_core/engines/maxwell_3d.h"
|
#include "video_core/engines/maxwell_3d.h"
|
||||||
|
#include "video_core/renderer_metal/maxwell_to_mtl.h"
|
||||||
#include "video_core/renderer_metal/mtl_command_recorder.h"
|
#include "video_core/renderer_metal/mtl_command_recorder.h"
|
||||||
#include "video_core/renderer_metal/mtl_device.h"
|
#include "video_core/renderer_metal/mtl_device.h"
|
||||||
#include "video_core/shader_notify.h"
|
#include "video_core/shader_notify.h"
|
||||||
#include "video_core/texture_cache/texture_cache.h"
|
#include "video_core/texture_cache/texture_cache.h"
|
||||||
#include "video_core/texture_cache/texture_cache_base.h"
|
#include "video_core/texture_cache/texture_cache_base.h"
|
||||||
#include "video_core/renderer_metal/maxwell_to_mtl.h"
|
|
||||||
|
|
||||||
namespace Metal {
|
namespace Metal {
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -211,8 +211,7 @@ void GraphicsPipeline::MakePipeline(MTL::RenderPassDescriptor* render_pass) {
|
||||||
const auto& regs{maxwell3d->regs};
|
const auto& regs{maxwell3d->regs};
|
||||||
|
|
||||||
// Shader stages
|
// Shader stages
|
||||||
MTL::RenderPipelineDescriptor* desc =
|
MTL::RenderPipelineDescriptor* desc = MTL::RenderPipelineDescriptor::alloc()->init();
|
||||||
MTL::RenderPipelineDescriptor::alloc()->init();
|
|
||||||
desc->setVertexFunction(functions[0]);
|
desc->setVertexFunction(functions[0]);
|
||||||
desc->setFragmentFunction(functions[4]);
|
desc->setFragmentFunction(functions[4]);
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,8 @@ RasterizerMetal::RasterizerMetal(Tegra::GPU& gpu_,
|
||||||
texture_cache_runtime(device, command_recorder, staging_buffer_pool),
|
texture_cache_runtime(device, command_recorder, staging_buffer_pool),
|
||||||
texture_cache(texture_cache_runtime, device_memory),
|
texture_cache(texture_cache_runtime, device_memory),
|
||||||
pipeline_cache(device_memory, device, command_recorder, buffer_cache, texture_cache,
|
pipeline_cache(device_memory, device, command_recorder, buffer_cache, texture_cache,
|
||||||
gpu.ShaderNotify()), accelerate_dma(buffer_cache) {}
|
gpu.ShaderNotify()),
|
||||||
|
accelerate_dma(buffer_cache) {}
|
||||||
RasterizerMetal::~RasterizerMetal() = default;
|
RasterizerMetal::~RasterizerMetal() = default;
|
||||||
|
|
||||||
void RasterizerMetal::Draw(bool is_indexed, u32 instance_count) {
|
void RasterizerMetal::Draw(bool is_indexed, u32 instance_count) {
|
||||||
|
@ -98,19 +99,24 @@ void RasterizerMetal::Draw(bool is_indexed, u32 instance_count) {
|
||||||
const DrawParams draw_params{MakeDrawParams(draw_state, instance_count, is_indexed)};
|
const DrawParams draw_params{MakeDrawParams(draw_state, instance_count, is_indexed)};
|
||||||
|
|
||||||
// TODO: get the primitive type
|
// TODO: get the primitive type
|
||||||
MTL::PrimitiveType primitiveType = MTL::PrimitiveTypeTriangle;//MaxwellToMTL::PrimitiveType(draw_state.topology);
|
MTL::PrimitiveType primitiveType =
|
||||||
|
MTL::PrimitiveTypeTriangle; // MaxwellToMTL::PrimitiveType(draw_state.topology);
|
||||||
|
|
||||||
if (is_indexed) {
|
if (is_indexed) {
|
||||||
auto& index_buffer = command_recorder.GetBoundIndexBuffer();
|
auto& index_buffer = command_recorder.GetBoundIndexBuffer();
|
||||||
size_t index_buffer_offset = index_buffer.offset + draw_params.first_index * index_buffer.index_size;
|
size_t index_buffer_offset =
|
||||||
|
index_buffer.offset + draw_params.first_index * index_buffer.index_size;
|
||||||
|
|
||||||
ASSERT(index_buffer_offset % 4 == 0);
|
ASSERT(index_buffer_offset % 4 == 0);
|
||||||
|
|
||||||
command_recorder.GetRenderCommandEncoder()->drawIndexedPrimitives(primitiveType, draw_params.num_vertices, index_buffer.index_type, index_buffer.buffer, index_buffer_offset, draw_params.num_instances,
|
command_recorder.GetRenderCommandEncoder()->drawIndexedPrimitives(
|
||||||
draw_params.base_vertex, draw_params.base_instance);
|
primitiveType, draw_params.num_vertices, index_buffer.index_type, index_buffer.buffer,
|
||||||
|
index_buffer_offset, draw_params.num_instances, draw_params.base_vertex,
|
||||||
|
draw_params.base_instance);
|
||||||
} else {
|
} else {
|
||||||
command_recorder.GetRenderCommandEncoder()->drawPrimitives(primitiveType,
|
command_recorder.GetRenderCommandEncoder()->drawPrimitives(
|
||||||
draw_params.base_vertex, draw_params.num_vertices, draw_params.num_instances, draw_params.base_instance);
|
primitiveType, draw_params.base_vertex, draw_params.num_vertices,
|
||||||
|
draw_params.num_instances, draw_params.base_instance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue