mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
Reduce left indentation for nested structs
This commit is contained in:
parent
b2c58c7791
commit
5322f3c610
5
.clang-format
Normal file
5
.clang-format
Normal file
@ -0,0 +1,5 @@
|
||||
IndentWidth: 4
|
||||
|
||||
# Reduce left indentation for nested structs
|
||||
AlignOperands: false
|
||||
AlignAfterOpenBracket: DontAlign
|
@ -43,26 +43,27 @@ WGPUByteArray read_file(const char *name) {
|
||||
int main() {
|
||||
WGPUInstanceId instance = wgpu_create_instance();
|
||||
|
||||
WGPUAdapterId adapter = wgpu_instance_get_adapter(
|
||||
instance, &(WGPUAdapterDescriptor){
|
||||
WGPUAdapterId adapter = wgpu_instance_get_adapter(instance,
|
||||
&(WGPUAdapterDescriptor){
|
||||
.power_preference = WGPUPowerPreference_LowPower,
|
||||
});
|
||||
|
||||
WGPUDeviceId device = wgpu_adapter_create_device(
|
||||
adapter, &(WGPUDeviceDescriptor){
|
||||
WGPUDeviceId device = wgpu_adapter_create_device(adapter,
|
||||
&(WGPUDeviceDescriptor){
|
||||
.extensions =
|
||||
{
|
||||
.anisotropic_filtering = false,
|
||||
},
|
||||
});
|
||||
|
||||
WGPUShaderModuleId vertex_shader = wgpu_device_create_shader_module(
|
||||
device, &(WGPUShaderModuleDescriptor){
|
||||
WGPUShaderModuleId vertex_shader = wgpu_device_create_shader_module(device,
|
||||
&(WGPUShaderModuleDescriptor){
|
||||
.code = read_file("./../../data/hello_triangle.vert.spv"),
|
||||
});
|
||||
|
||||
WGPUShaderModuleId fragment_shader = wgpu_device_create_shader_module(
|
||||
device, &(WGPUShaderModuleDescriptor){
|
||||
WGPUShaderModuleId fragment_shader =
|
||||
wgpu_device_create_shader_module(device,
|
||||
&(WGPUShaderModuleDescriptor){
|
||||
.code = read_file("./../../data/hello_triangle.frag.spv"),
|
||||
});
|
||||
|
||||
@ -75,14 +76,16 @@ int main() {
|
||||
WGPUBindGroupLayoutId bind_group_layouts[BIND_GROUP_LAYOUTS_LENGTH] = {
|
||||
bind_group_layout};
|
||||
|
||||
WGPUPipelineLayoutId pipeline_layout = wgpu_device_create_pipeline_layout(
|
||||
device, &(WGPUPipelineLayoutDescriptor){
|
||||
WGPUPipelineLayoutId pipeline_layout =
|
||||
wgpu_device_create_pipeline_layout(device,
|
||||
&(WGPUPipelineLayoutDescriptor){
|
||||
.bind_group_layouts = bind_group_layouts,
|
||||
.bind_group_layouts_length = BIND_GROUP_LAYOUTS_LENGTH,
|
||||
});
|
||||
|
||||
WGPURenderPipelineId render_pipeline = wgpu_device_create_render_pipeline(
|
||||
device, &(WGPURenderPipelineDescriptor){
|
||||
WGPURenderPipelineId render_pipeline =
|
||||
wgpu_device_create_render_pipeline(device,
|
||||
&(WGPURenderPipelineDescriptor){
|
||||
.layout = pipeline_layout,
|
||||
.vertex_stage =
|
||||
(WGPUPipelineStageDescriptor){
|
||||
@ -137,7 +140,8 @@ int main() {
|
||||
}
|
||||
|
||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
||||
GLFWwindow *window = glfwCreateWindow(640, 480, "wgpu with glfw", NULL, NULL);
|
||||
GLFWwindow *window =
|
||||
glfwCreateWindow(640, 480, "wgpu with glfw", NULL, NULL);
|
||||
|
||||
if (!window) {
|
||||
printf("Cannot create window");
|
||||
@ -154,8 +158,8 @@ int main() {
|
||||
[ns_window.contentView setWantsLayer:YES];
|
||||
metal_layer = [CAMetalLayer layer];
|
||||
[ns_window.contentView setLayer:metal_layer];
|
||||
surface =
|
||||
wgpu_instance_create_surface_from_macos_layer(instance, metal_layer);
|
||||
surface = wgpu_instance_create_surface_from_macos_layer(
|
||||
instance, metal_layer);
|
||||
}
|
||||
#elif WGPU_TARGET == WGPU_TARGET_LINUX
|
||||
{
|
||||
@ -168,13 +172,12 @@ int main() {
|
||||
{
|
||||
HWND hwnd = glfwGetWin32Window(window);
|
||||
HINSTANCE hinstance = GetModuleHandle(NULL);
|
||||
surface = wgpu_instance_create_surface_from_windows_hwnd(instance,
|
||||
hinstance, hwnd);
|
||||
surface = wgpu_instance_create_surface_from_windows_hwnd(
|
||||
instance, hinstance, hwnd);
|
||||
}
|
||||
#endif
|
||||
|
||||
WGPUSwapChainId swap_chain = wgpu_device_create_swap_chain(
|
||||
device, surface,
|
||||
WGPUSwapChainId swap_chain = wgpu_device_create_swap_chain(device, surface,
|
||||
&(WGPUSwapChainDescriptor){
|
||||
.usage = WGPUTextureUsageFlags_OUTPUT_ATTACHMENT,
|
||||
.format = WGPUTextureFormat_Bgra8Unorm,
|
||||
@ -199,8 +202,8 @@ int main() {
|
||||
},
|
||||
};
|
||||
|
||||
WGPURenderPassId rpass = wgpu_command_encoder_begin_render_pass(
|
||||
cmd_encoder,
|
||||
WGPURenderPassId rpass =
|
||||
wgpu_command_encoder_begin_render_pass(cmd_encoder,
|
||||
(WGPURenderPassDescriptor){
|
||||
.color_attachments = color_attachments,
|
||||
.color_attachments_length = RENDER_PASS_ATTACHMENTS_LENGTH,
|
||||
|
Loading…
Reference in New Issue
Block a user