├── .github ├── ISSUE_TEMPLATE │ └── bug_report.md └── workflows │ ├── artifacts.yml │ └── test-build-windows.yml ├── .gitmodules ├── LICENSE ├── README.md ├── RELEASE ├── VP_DXVK_requirements.json ├── build-win32.txt ├── build-win64.txt ├── buildenv.h.in ├── dxvk.conf ├── include ├── native │ ├── meson.build │ ├── windows │ │ ├── oaidl.h │ │ ├── objbase.h │ │ ├── ocidl.h │ │ ├── ole2.h │ │ ├── poppack.h │ │ ├── pshpack4.h │ │ ├── rpc.h │ │ ├── rpcndr.h │ │ ├── unknwn.h │ │ ├── windows.h │ │ └── windows_base.h │ └── wsi │ │ ├── native_glfw.h │ │ ├── native_sdl2.h │ │ ├── native_sdl3.h │ │ └── native_wsi.h └── openvr │ ├── LICENSE │ └── openvr.hpp ├── meson.build ├── meson_options.txt ├── package-native.sh ├── package-release.sh ├── src ├── d3d10 │ ├── d3d10_blend.cpp │ ├── d3d10_blend.h │ ├── d3d10_buffer.cpp │ ├── d3d10_buffer.h │ ├── d3d10_core.cpp │ ├── d3d10_depth_stencil.cpp │ ├── d3d10_depth_stencil.h │ ├── d3d10_device.cpp │ ├── d3d10_device.h │ ├── d3d10_include.h │ ├── d3d10_input_layout.cpp │ ├── d3d10_input_layout.h │ ├── d3d10_multithread.cpp │ ├── d3d10_multithread.h │ ├── d3d10_query.cpp │ ├── d3d10_query.h │ ├── d3d10_rasterizer.cpp │ ├── d3d10_rasterizer.h │ ├── d3d10_sampler.cpp │ ├── d3d10_sampler.h │ ├── d3d10_shader.h │ ├── d3d10_texture.cpp │ ├── d3d10_texture.h │ ├── d3d10_util.cpp │ ├── d3d10_util.h │ ├── d3d10_view_dsv.cpp │ ├── d3d10_view_dsv.h │ ├── d3d10_view_rtv.cpp │ ├── d3d10_view_rtv.h │ ├── d3d10_view_srv.cpp │ ├── d3d10_view_srv.h │ ├── d3d10core.def │ ├── d3d10core.sym │ ├── meson.build │ └── version10_core.rc ├── d3d11 │ ├── d3d11.def │ ├── d3d11.sym │ ├── d3d11_annotation.cpp │ ├── d3d11_annotation.h │ ├── d3d11_blend.cpp │ ├── d3d11_blend.h │ ├── d3d11_buffer.cpp │ ├── d3d11_buffer.h │ ├── d3d11_class_linkage.cpp │ ├── d3d11_class_linkage.h │ ├── d3d11_cmd.h │ ├── d3d11_cmdlist.cpp │ ├── d3d11_cmdlist.h │ ├── d3d11_context.cpp │ ├── d3d11_context.h │ ├── d3d11_context_def.cpp │ ├── d3d11_context_def.h │ ├── d3d11_context_ext.cpp │ ├── d3d11_context_ext.h │ ├── d3d11_context_imm.cpp │ ├── d3d11_context_imm.h │ ├── d3d11_context_state.h │ ├── d3d11_cuda.cpp │ ├── d3d11_cuda.h │ ├── d3d11_depth_stencil.cpp │ ├── d3d11_depth_stencil.h │ ├── d3d11_device.cpp │ ├── d3d11_device.h │ ├── d3d11_device_child.h │ ├── d3d11_enums.cpp │ ├── d3d11_enums.h │ ├── d3d11_features.cpp │ ├── d3d11_features.h │ ├── d3d11_fence.cpp │ ├── d3d11_fence.h │ ├── d3d11_gdi.cpp │ ├── d3d11_gdi.h │ ├── d3d11_include.h │ ├── d3d11_initializer.cpp │ ├── d3d11_initializer.h │ ├── d3d11_input_layout.cpp │ ├── d3d11_input_layout.h │ ├── d3d11_interfaces.h │ ├── d3d11_interop.cpp │ ├── d3d11_interop.h │ ├── d3d11_main.cpp │ ├── d3d11_on_12.cpp │ ├── d3d11_on_12.h │ ├── d3d11_on_12_interfaces.h │ ├── d3d11_options.cpp │ ├── d3d11_options.h │ ├── d3d11_query.cpp │ ├── d3d11_query.h │ ├── d3d11_rasterizer.cpp │ ├── d3d11_rasterizer.h │ ├── d3d11_resource.cpp │ ├── d3d11_resource.h │ ├── d3d11_sampler.cpp │ ├── d3d11_sampler.h │ ├── d3d11_shader.cpp │ ├── d3d11_shader.h │ ├── d3d11_state.cpp │ ├── d3d11_state.h │ ├── d3d11_state_object.cpp │ ├── d3d11_state_object.h │ ├── d3d11_swapchain.cpp │ ├── d3d11_swapchain.h │ ├── d3d11_texture.cpp │ ├── d3d11_texture.h │ ├── d3d11_util.cpp │ ├── d3d11_util.h │ ├── d3d11_video.cpp │ ├── d3d11_video.h │ ├── d3d11_view.h │ ├── d3d11_view_dsv.cpp │ ├── d3d11_view_dsv.h │ ├── d3d11_view_rtv.cpp │ ├── d3d11_view_rtv.h │ ├── d3d11_view_srv.cpp │ ├── d3d11_view_srv.h │ ├── d3d11_view_uav.cpp │ ├── d3d11_view_uav.h │ ├── meson.build │ ├── shaders │ │ ├── d3d11_video_blit_frag.frag │ │ └── d3d11_video_blit_vert.vert │ └── version.rc ├── d3d8 │ ├── d3d8.def │ ├── d3d8.sym │ ├── d3d8_batch.h │ ├── d3d8_buffer.cpp │ ├── d3d8_buffer.h │ ├── d3d8_caps.h │ ├── d3d8_d3d9_util.h │ ├── d3d8_device.cpp │ ├── d3d8_device.h │ ├── d3d8_device_child.h │ ├── d3d8_format.h │ ├── d3d8_include.h │ ├── d3d8_interface.cpp │ ├── d3d8_interface.h │ ├── d3d8_main.cpp │ ├── d3d8_multithread.cpp │ ├── d3d8_multithread.h │ ├── d3d8_options.cpp │ ├── d3d8_options.h │ ├── d3d8_resource.h │ ├── d3d8_shader.cpp │ ├── d3d8_shader.h │ ├── d3d8_state_block.cpp │ ├── d3d8_state_block.h │ ├── d3d8_subresource.h │ ├── d3d8_surface.cpp │ ├── d3d8_surface.h │ ├── d3d8_swapchain.cpp │ ├── d3d8_swapchain.h │ ├── d3d8_texture.cpp │ ├── d3d8_texture.h │ ├── d3d8_volume.cpp │ ├── d3d8_volume.h │ ├── d3d8_wrapped_object.h │ ├── meson.build │ └── version.rc ├── d3d9 │ ├── d3d9.def │ ├── d3d9.sym │ ├── d3d9_adapter.cpp │ ├── d3d9_adapter.h │ ├── d3d9_annotation.cpp │ ├── d3d9_annotation.h │ ├── d3d9_bridge.cpp │ ├── d3d9_bridge.h │ ├── d3d9_buffer.cpp │ ├── d3d9_buffer.h │ ├── d3d9_caps.h │ ├── d3d9_common_buffer.cpp │ ├── d3d9_common_buffer.h │ ├── d3d9_common_texture.cpp │ ├── d3d9_common_texture.h │ ├── d3d9_constant_buffer.cpp │ ├── d3d9_constant_buffer.h │ ├── d3d9_constant_layout.h │ ├── d3d9_constant_set.h │ ├── d3d9_cursor.cpp │ ├── d3d9_cursor.h │ ├── d3d9_device.cpp │ ├── d3d9_device.h │ ├── d3d9_device_child.h │ ├── d3d9_fixed_function.cpp │ ├── d3d9_fixed_function.h │ ├── d3d9_format.cpp │ ├── d3d9_format.h │ ├── d3d9_format_helpers.cpp │ ├── d3d9_format_helpers.h │ ├── d3d9_hud.cpp │ ├── d3d9_hud.h │ ├── d3d9_include.h │ ├── d3d9_initializer.cpp │ ├── d3d9_initializer.h │ ├── d3d9_interface.cpp │ ├── d3d9_interface.h │ ├── d3d9_interfaces.h │ ├── d3d9_interop.cpp │ ├── d3d9_interop.h │ ├── d3d9_main.cpp │ ├── d3d9_mem.cpp │ ├── d3d9_mem.h │ ├── d3d9_monitor.cpp │ ├── d3d9_monitor.h │ ├── d3d9_multithread.cpp │ ├── d3d9_multithread.h │ ├── d3d9_names.cpp │ ├── d3d9_names.h │ ├── d3d9_on_12.cpp │ ├── d3d9_on_12.h │ ├── d3d9_options.cpp │ ├── d3d9_options.h │ ├── d3d9_query.cpp │ ├── d3d9_query.h │ ├── d3d9_resource.h │ ├── d3d9_shader.cpp │ ├── d3d9_shader.h │ ├── d3d9_shader_validator.cpp │ ├── d3d9_shader_validator.h │ ├── d3d9_spec_constants.h │ ├── d3d9_state.cpp │ ├── d3d9_state.h │ ├── d3d9_stateblock.cpp │ ├── d3d9_stateblock.h │ ├── d3d9_subresource.h │ ├── d3d9_surface.cpp │ ├── d3d9_surface.h │ ├── d3d9_swapchain.cpp │ ├── d3d9_swapchain.h │ ├── d3d9_swvp_emu.cpp │ ├── d3d9_swvp_emu.h │ ├── d3d9_texture.cpp │ ├── d3d9_texture.h │ ├── d3d9_util.cpp │ ├── d3d9_util.h │ ├── d3d9_vertex_declaration.cpp │ ├── d3d9_vertex_declaration.h │ ├── d3d9_volume.cpp │ ├── d3d9_volume.h │ ├── d3d9_window.cpp │ ├── d3d9_window.h │ ├── meson.build │ ├── shaders │ │ ├── d3d9_convert_a2w10v10u10.comp │ │ ├── d3d9_convert_common.h │ │ ├── d3d9_convert_l6v5u5.comp │ │ ├── d3d9_convert_nv12.comp │ │ ├── d3d9_convert_w11v11u10.comp │ │ ├── d3d9_convert_x8l8v8u8.comp │ │ ├── d3d9_convert_yuy2_uyvy.comp │ │ └── d3d9_convert_yv12.comp │ └── version.rc ├── dxbc │ ├── dxbc_analysis.cpp │ ├── dxbc_analysis.h │ ├── dxbc_chunk_isgn.cpp │ ├── dxbc_chunk_isgn.h │ ├── dxbc_chunk_shex.cpp │ ├── dxbc_chunk_shex.h │ ├── dxbc_common.cpp │ ├── dxbc_common.h │ ├── dxbc_compiler.cpp │ ├── dxbc_compiler.h │ ├── dxbc_decoder.cpp │ ├── dxbc_decoder.h │ ├── dxbc_defs.cpp │ ├── dxbc_defs.h │ ├── dxbc_enums.h │ ├── dxbc_header.cpp │ ├── dxbc_header.h │ ├── dxbc_include.h │ ├── dxbc_modinfo.h │ ├── dxbc_module.cpp │ ├── dxbc_module.h │ ├── dxbc_names.cpp │ ├── dxbc_names.h │ ├── dxbc_options.cpp │ ├── dxbc_options.h │ ├── dxbc_reader.cpp │ ├── dxbc_reader.h │ ├── dxbc_tag.h │ ├── dxbc_util.cpp │ ├── dxbc_util.h │ └── meson.build ├── dxgi │ ├── dxgi.def │ ├── dxgi.sym │ ├── dxgi_adapter.cpp │ ├── dxgi_adapter.h │ ├── dxgi_enums.cpp │ ├── dxgi_enums.h │ ├── dxgi_factory.cpp │ ├── dxgi_factory.h │ ├── dxgi_format.cpp │ ├── dxgi_format.h │ ├── dxgi_include.h │ ├── dxgi_interfaces.h │ ├── dxgi_main.cpp │ ├── dxgi_monitor.cpp │ ├── dxgi_monitor.h │ ├── dxgi_object.h │ ├── dxgi_options.cpp │ ├── dxgi_options.h │ ├── dxgi_output.cpp │ ├── dxgi_output.h │ ├── dxgi_surface.cpp │ ├── dxgi_surface.h │ ├── dxgi_swapchain.cpp │ ├── dxgi_swapchain.h │ ├── dxgi_swapchain_dispatcher.h │ ├── meson.build │ └── version.rc ├── dxso │ ├── dxso_analysis.cpp │ ├── dxso_analysis.h │ ├── dxso_code.cpp │ ├── dxso_code.h │ ├── dxso_common.cpp │ ├── dxso_common.h │ ├── dxso_compiler.cpp │ ├── dxso_compiler.h │ ├── dxso_ctab.cpp │ ├── dxso_ctab.h │ ├── dxso_decoder.cpp │ ├── dxso_decoder.h │ ├── dxso_enums.cpp │ ├── dxso_enums.h │ ├── dxso_header.cpp │ ├── dxso_header.h │ ├── dxso_include.h │ ├── dxso_isgn.h │ ├── dxso_modinfo.h │ ├── dxso_module.cpp │ ├── dxso_module.h │ ├── dxso_options.cpp │ ├── dxso_options.h │ ├── dxso_reader.cpp │ ├── dxso_reader.h │ ├── dxso_tables.cpp │ ├── dxso_tables.h │ ├── dxso_util.cpp │ ├── dxso_util.h │ └── meson.build ├── dxvk │ ├── dxvk_access.cpp │ ├── dxvk_access.h │ ├── dxvk_adapter.cpp │ ├── dxvk_adapter.h │ ├── dxvk_allocator.cpp │ ├── dxvk_allocator.h │ ├── dxvk_annotation.h │ ├── dxvk_barrier.cpp │ ├── dxvk_barrier.h │ ├── dxvk_bind_mask.h │ ├── dxvk_buffer.cpp │ ├── dxvk_buffer.h │ ├── dxvk_cmdlist.cpp │ ├── dxvk_cmdlist.h │ ├── dxvk_compute.cpp │ ├── dxvk_compute.h │ ├── dxvk_constant_state.cpp │ ├── dxvk_constant_state.h │ ├── dxvk_context.cpp │ ├── dxvk_context.h │ ├── dxvk_context_state.h │ ├── dxvk_cs.cpp │ ├── dxvk_cs.h │ ├── dxvk_descriptor.h │ ├── dxvk_descriptor_heap.cpp │ ├── dxvk_descriptor_heap.h │ ├── dxvk_descriptor_info.cpp │ ├── dxvk_descriptor_info.h │ ├── dxvk_descriptor_pool.cpp │ ├── dxvk_descriptor_pool.h │ ├── dxvk_descriptor_worker.cpp │ ├── dxvk_descriptor_worker.h │ ├── dxvk_device.cpp │ ├── dxvk_device.h │ ├── dxvk_device_filter.cpp │ ├── dxvk_device_filter.h │ ├── dxvk_device_info.h │ ├── dxvk_extension_provider.h │ ├── dxvk_extensions.cpp │ ├── dxvk_extensions.h │ ├── dxvk_fence.cpp │ ├── dxvk_fence.h │ ├── dxvk_format.cpp │ ├── dxvk_format.h │ ├── dxvk_framebuffer.cpp │ ├── dxvk_framebuffer.h │ ├── dxvk_gpu_event.cpp │ ├── dxvk_gpu_event.h │ ├── dxvk_gpu_query.cpp │ ├── dxvk_gpu_query.h │ ├── dxvk_graphics.cpp │ ├── dxvk_graphics.h │ ├── dxvk_graphics_state.h │ ├── dxvk_hash.h │ ├── dxvk_image.cpp │ ├── dxvk_image.h │ ├── dxvk_implicit_resolve.cpp │ ├── dxvk_implicit_resolve.h │ ├── dxvk_include.h │ ├── dxvk_instance.cpp │ ├── dxvk_instance.h │ ├── dxvk_latency.h │ ├── dxvk_latency_builtin.cpp │ ├── dxvk_latency_builtin.h │ ├── dxvk_latency_reflex.cpp │ ├── dxvk_latency_reflex.h │ ├── dxvk_limits.h │ ├── dxvk_memory.cpp │ ├── dxvk_memory.h │ ├── dxvk_meta_blit.cpp │ ├── dxvk_meta_blit.h │ ├── dxvk_meta_clear.cpp │ ├── dxvk_meta_clear.h │ ├── dxvk_meta_copy.cpp │ ├── dxvk_meta_copy.h │ ├── dxvk_meta_mipgen.cpp │ ├── dxvk_meta_mipgen.h │ ├── dxvk_meta_resolve.cpp │ ├── dxvk_meta_resolve.h │ ├── dxvk_objects.h │ ├── dxvk_openvr.cpp │ ├── dxvk_openvr.h │ ├── dxvk_openxr.cpp │ ├── dxvk_openxr.h │ ├── dxvk_options.cpp │ ├── dxvk_options.h │ ├── dxvk_pipelayout.cpp │ ├── dxvk_pipelayout.h │ ├── dxvk_pipemanager.cpp │ ├── dxvk_pipemanager.h │ ├── dxvk_platform_exts.cpp │ ├── dxvk_platform_exts.h │ ├── dxvk_presenter.cpp │ ├── dxvk_presenter.h │ ├── dxvk_queue.cpp │ ├── dxvk_queue.h │ ├── dxvk_recycler.h │ ├── dxvk_renderpass.h │ ├── dxvk_sampler.cpp │ ├── dxvk_sampler.h │ ├── dxvk_shader.cpp │ ├── dxvk_shader.h │ ├── dxvk_shader_key.cpp │ ├── dxvk_shader_key.h │ ├── dxvk_signal.cpp │ ├── dxvk_signal.h │ ├── dxvk_sparse.cpp │ ├── dxvk_sparse.h │ ├── dxvk_staging.cpp │ ├── dxvk_staging.h │ ├── dxvk_state_cache.cpp │ ├── dxvk_state_cache.h │ ├── dxvk_state_cache_types.h │ ├── dxvk_stats.cpp │ ├── dxvk_stats.h │ ├── dxvk_swapchain_blitter.cpp │ ├── dxvk_swapchain_blitter.h │ ├── dxvk_unbound.cpp │ ├── dxvk_unbound.h │ ├── dxvk_util.cpp │ ├── dxvk_util.h │ ├── hud │ │ ├── dxvk_hud.cpp │ │ ├── dxvk_hud.h │ │ ├── dxvk_hud_font.cpp │ │ ├── dxvk_hud_font.h │ │ ├── dxvk_hud_item.cpp │ │ ├── dxvk_hud_item.h │ │ ├── dxvk_hud_renderer.cpp │ │ ├── dxvk_hud_renderer.h │ │ └── shaders │ │ │ ├── hud_chunk_frag_background.frag │ │ │ ├── hud_chunk_frag_visualize.frag │ │ │ ├── hud_chunk_vert_background.vert │ │ │ ├── hud_chunk_vert_visualize.vert │ │ │ ├── hud_frag_common.glsl │ │ │ ├── hud_frame_time_eval.comp │ │ │ ├── hud_graph_frag.frag │ │ │ ├── hud_graph_vert.vert │ │ │ ├── hud_text_frag.frag │ │ │ └── hud_text_vert.vert │ ├── meson.build │ └── shaders │ │ ├── dxvk_blit_frag_1d.frag │ │ ├── dxvk_blit_frag_2d.frag │ │ ├── dxvk_blit_frag_3d.frag │ │ ├── dxvk_buffer_to_image_d.frag │ │ ├── dxvk_buffer_to_image_ds_export.frag │ │ ├── dxvk_buffer_to_image_s_discard.frag │ │ ├── dxvk_clear_buffer_f.comp │ │ ├── dxvk_clear_buffer_u.comp │ │ ├── dxvk_clear_image1d_f.comp │ │ ├── dxvk_clear_image1d_u.comp │ │ ├── dxvk_clear_image1darr_f.comp │ │ ├── dxvk_clear_image1darr_u.comp │ │ ├── dxvk_clear_image2d_f.comp │ │ ├── dxvk_clear_image2d_u.comp │ │ ├── dxvk_clear_image2darr_f.comp │ │ ├── dxvk_clear_image2darr_u.comp │ │ ├── dxvk_clear_image3d_f.comp │ │ ├── dxvk_clear_image3d_u.comp │ │ ├── dxvk_color_space.glsl │ │ ├── dxvk_copy_buffer_image.comp │ │ ├── dxvk_copy_color_1d.frag │ │ ├── dxvk_copy_color_2d.frag │ │ ├── dxvk_copy_color_ms.frag │ │ ├── dxvk_copy_depth_stencil_1d.frag │ │ ├── dxvk_copy_depth_stencil_2d.frag │ │ ├── dxvk_copy_depth_stencil_ms.frag │ │ ├── dxvk_cursor_frag.frag │ │ ├── dxvk_cursor_vert.vert │ │ ├── dxvk_dummy_frag.frag │ │ ├── dxvk_formats.glsl │ │ ├── dxvk_fullscreen_geom.geom │ │ ├── dxvk_fullscreen_layer_vert.vert │ │ ├── dxvk_fullscreen_vert.vert │ │ ├── dxvk_image_to_buffer_ds.comp │ │ ├── dxvk_image_to_buffer_f.comp │ │ ├── dxvk_present_common.glsl │ │ ├── dxvk_present_frag.frag │ │ ├── dxvk_present_frag_blit.frag │ │ ├── dxvk_present_frag_ms.frag │ │ ├── dxvk_present_frag_ms_blit.frag │ │ ├── dxvk_present_vert.vert │ │ ├── dxvk_resolve_common.glsl │ │ ├── dxvk_resolve_frag_d.frag │ │ ├── dxvk_resolve_frag_ds.frag │ │ ├── dxvk_resolve_frag_f.frag │ │ ├── dxvk_resolve_frag_i.frag │ │ └── dxvk_resolve_frag_u.frag ├── meson.build ├── spirv │ ├── meson.build │ ├── spirv_code_buffer.cpp │ ├── spirv_code_buffer.h │ ├── spirv_compression.cpp │ ├── spirv_compression.h │ ├── spirv_include.h │ ├── spirv_instruction.h │ ├── spirv_module.cpp │ └── spirv_module.h ├── util │ ├── com │ │ ├── com_destruction_notifier.cpp │ │ ├── com_destruction_notifier.h │ │ ├── com_guid.cpp │ │ ├── com_guid.h │ │ ├── com_include.h │ │ ├── com_object.h │ │ ├── com_pointer.h │ │ ├── com_private_data.cpp │ │ └── com_private_data.h │ ├── config │ │ ├── config.cpp │ │ └── config.h │ ├── log │ │ ├── log.cpp │ │ ├── log.h │ │ ├── log_debug.cpp │ │ └── log_debug.h │ ├── meson.build │ ├── rc │ │ ├── util_rc.h │ │ └── util_rc_ptr.h │ ├── sha1 │ │ ├── sha1.c │ │ ├── sha1.h │ │ ├── sha1_util.cpp │ │ └── sha1_util.h │ ├── sync │ │ ├── sync_list.h │ │ ├── sync_recursive.cpp │ │ ├── sync_recursive.h │ │ ├── sync_signal.h │ │ ├── sync_spinlock.h │ │ └── sync_ticketlock.h │ ├── thread.cpp │ ├── thread.h │ ├── util_bit.h │ ├── util_enum.h │ ├── util_env.cpp │ ├── util_env.h │ ├── util_error.h │ ├── util_flags.h │ ├── util_flush.cpp │ ├── util_flush.h │ ├── util_fps_limiter.cpp │ ├── util_fps_limiter.h │ ├── util_gdi.cpp │ ├── util_gdi.h │ ├── util_lazy.h │ ├── util_likely.h │ ├── util_lru.h │ ├── util_luid.cpp │ ├── util_luid.h │ ├── util_math.h │ ├── util_matrix.cpp │ ├── util_matrix.h │ ├── util_misc.h │ ├── util_ratio.h │ ├── util_shared_res.cpp │ ├── util_shared_res.h │ ├── util_singleton.h │ ├── util_sleep.cpp │ ├── util_sleep.h │ ├── util_small_vector.h │ ├── util_string.cpp │ ├── util_string.h │ ├── util_time.h │ ├── util_vector.h │ ├── util_version.h │ └── util_win32_compat.h ├── vulkan │ ├── meson.build │ ├── vulkan_loader.cpp │ ├── vulkan_loader.h │ ├── vulkan_names.cpp │ ├── vulkan_names.h │ └── vulkan_util.h └── wsi │ ├── glfw │ ├── wsi_monitor_glfw.cpp │ ├── wsi_platform_glfw.cpp │ ├── wsi_platform_glfw.h │ ├── wsi_platform_glfw_funcs.h │ └── wsi_window_glfw.cpp │ ├── meson.build │ ├── sdl2 │ ├── wsi_monitor_sdl2.cpp │ ├── wsi_platform_sdl2.cpp │ ├── wsi_platform_sdl2.h │ ├── wsi_platform_sdl2_funcs.h │ └── wsi_window_sdl2.cpp │ ├── sdl3 │ ├── wsi_monitor_sdl3.cpp │ ├── wsi_platform_sdl3.cpp │ ├── wsi_platform_sdl3.h │ ├── wsi_platform_sdl3_funcs.h │ └── wsi_window_sdl3.cpp │ ├── win32 │ ├── wsi_monitor_win32.cpp │ ├── wsi_platform_win32.cpp │ ├── wsi_platform_win32.h │ └── wsi_window_win32.cpp │ ├── wsi_edid.cpp │ ├── wsi_edid.h │ ├── wsi_monitor.h │ ├── wsi_platform.cpp │ ├── wsi_platform.h │ └── wsi_window.h └── version.h.in /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Report crashes, rendering issues etc. 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | Please describe your issue as accurately as possible. 11 | 12 | If you use Windows, please check the following page: https://github.com/doitsujin/dxvk/wiki/Windows 13 | 14 | ### Software information 15 | Name of the game, settings used etc. 16 | 17 | ### System information 18 | - GPU: 19 | - Driver: 20 | - Wine version: 21 | - DXVK version: 22 | 23 | ### Apitrace file(s) 24 | - Put a link here 25 | 26 | For instructions on how to use apitrace, see: https://github.com/doitsujin/dxvk/wiki/Using-Apitrace 27 | 28 | ### Log files 29 | Please attach Proton or Wine logs as a text file: 30 | - When using Proton, set the Steam launch options for your game to `PROTON_LOG=1 %command%` and attach the corresponding `steam-xxxxx.log` file in your home directory. 31 | - When using regular Wine, use `wine game.exe > game.log 2>&1` and attach the resulting `game.log` file. -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "include/native/directx"] 2 | path = include/native/directx 3 | url = https://github.com/Joshua-Ashton/mingw-directx-headers 4 | [submodule "include/vulkan"] 5 | path = include/vulkan 6 | url = https://github.com/KhronosGroup/Vulkan-Headers 7 | [submodule "include/spirv"] 8 | path = include/spirv 9 | url = https://github.com/KhronosGroup/SPIRV-Headers.git 10 | [submodule "subprojects/libdisplay-info"] 11 | path = subprojects/libdisplay-info 12 | url = https://github.com/doitsujin/libdisplay-info.git 13 | branch = windows 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 Philip Rebohle 2 | Copyright (c) 2019 Joshua Ashton 3 | Copyright (c) 2019 Robin Kertels 4 | Copyright (c) 2023 Jeffrey Ellison 5 | 6 | zlib/libpng license 7 | 8 | This software is provided 'as-is', without any express or implied 9 | warranty. In no event will the authors be held liable for any damages 10 | arising from the use of this software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, 13 | including commercial applications, and to alter it and redistribute it 14 | freely, subject to the following restrictions: 15 | 16 | – The origin of this software must not be misrepresented; you must not 17 | claim that you wrote the original software. If you use this software 18 | in a product, an acknowledgment in the product documentation would be 19 | appreciated but is not required. 20 | 21 | – Altered source versions must be plainly marked as such, and must not 22 | be misrepresented as being the original software. 23 | 24 | – This notice may not be removed or altered from any source distribution. 25 | -------------------------------------------------------------------------------- /RELEASE: -------------------------------------------------------------------------------- 1 | 2.6.1 2 | -------------------------------------------------------------------------------- /build-win32.txt: -------------------------------------------------------------------------------- 1 | [binaries] 2 | c = 'i686-w64-mingw32-gcc' 3 | cpp = 'i686-w64-mingw32-g++' 4 | ar = 'i686-w64-mingw32-ar' 5 | strip = 'i686-w64-mingw32-strip' 6 | windres = 'i686-w64-mingw32-windres' 7 | 8 | [properties] 9 | needs_exe_wrapper = true 10 | 11 | [host_machine] 12 | system = 'windows' 13 | cpu_family = 'x86' 14 | cpu = 'x86' 15 | endian = 'little' 16 | -------------------------------------------------------------------------------- /build-win64.txt: -------------------------------------------------------------------------------- 1 | [binaries] 2 | c = 'x86_64-w64-mingw32-gcc' 3 | cpp = 'x86_64-w64-mingw32-g++' 4 | ar = 'x86_64-w64-mingw32-ar' 5 | strip = 'x86_64-w64-mingw32-strip' 6 | windres = 'x86_64-w64-mingw32-windres' 7 | 8 | [properties] 9 | needs_exe_wrapper = true 10 | 11 | [host_machine] 12 | system = 'windows' 13 | cpu_family = 'x86_64' 14 | cpu = 'x86_64' 15 | endian = 'little' 16 | -------------------------------------------------------------------------------- /buildenv.h.in: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define DXVK_TARGET "@BUILD_TARGET@" 4 | #define DXVK_COMPILER "@BUILD_COMPILER@" 5 | #define DXVK_COMPILER_VERSION "@BUILD_COMPILER_VERSION@" 6 | 7 | -------------------------------------------------------------------------------- /include/native/meson.build: -------------------------------------------------------------------------------- 1 | install_subdir( 2 | 'directx', 3 | install_dir: get_option('includedir') / 'dxvk', 4 | strip_directory: true, 5 | exclude_files: '.git' 6 | ) 7 | 8 | install_subdir( 9 | 'windows', 10 | install_dir: get_option('includedir') / 'dxvk', 11 | strip_directory: true, 12 | ) 13 | 14 | install_headers( 15 | 'wsi/native_wsi.h', 16 | 'wsi/native_sdl3.h', 17 | 'wsi/native_sdl2.h', 18 | 'wsi/native_glfw.h', 19 | subdir: 'dxvk/wsi', 20 | ) 21 | -------------------------------------------------------------------------------- /include/native/windows/oaidl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Don't care. -------------------------------------------------------------------------------- /include/native/windows/objbase.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Don't care. -------------------------------------------------------------------------------- /include/native/windows/ocidl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Don't care. -------------------------------------------------------------------------------- /include/native/windows/ole2.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Don't care. -------------------------------------------------------------------------------- /include/native/windows/poppack.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the mingw-w64 runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package. 5 | */ 6 | #if !(defined(lint) || defined(RC_INVOKED)) 7 | #pragma pack(pop) 8 | #endif 9 | -------------------------------------------------------------------------------- /include/native/windows/pshpack4.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the mingw-w64 runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package. 5 | */ 6 | #if !(defined(lint) || defined(RC_INVOKED)) 7 | #pragma pack(push,4) 8 | #endif 9 | -------------------------------------------------------------------------------- /include/native/windows/rpc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Don't care. -------------------------------------------------------------------------------- /include/native/windows/rpcndr.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Don't care. -------------------------------------------------------------------------------- /include/native/windows/unknwn.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "windows_base.h" 4 | 5 | typedef interface IUnknown IUnknown; 6 | 7 | DEFINE_GUID(IID_IUnknown, 0x00000000,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46) 8 | 9 | #ifdef __cplusplus 10 | struct IUnknown { 11 | 12 | public: 13 | 14 | virtual HRESULT QueryInterface(REFIID riid, void** ppvObject) = 0; 15 | template 16 | HRESULT STDMETHODCALLTYPE QueryInterface(Q **pp) { 17 | return QueryInterface(__uuidof(Q), (void **)pp); 18 | } 19 | 20 | virtual ULONG AddRef() = 0; 21 | virtual ULONG Release() = 0; 22 | 23 | }; 24 | #else 25 | typedef struct IUnknownVtbl 26 | { 27 | BEGIN_INTERFACE 28 | 29 | HRESULT (STDMETHODCALLTYPE *QueryInterface)( 30 | IUnknown *This, 31 | REFIID riid, 32 | void **ppvObject 33 | ); 34 | ULONG (STDMETHODCALLTYPE *AddRef)(IUnknown *This); 35 | ULONG (STDMETHODCALLTYPE *Release)(IUnknown *This); 36 | 37 | END_INTERFACE 38 | } IUnknownVtbl; 39 | 40 | interface IUnknown 41 | { 42 | CONST_VTBL struct IUnknownVtbl *lpVtbl; 43 | }; 44 | 45 | #define IUnknown_AddRef(This) ((This)->lpVtbl->AddRef(This)) 46 | #define IUnknown_Release(This) ((This)->lpVtbl->Release(This)) 47 | 48 | #endif // __cplusplus 49 | 50 | DECLARE_UUIDOF_HELPER(IUnknown, 0x00000000,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46) 51 | 52 | #define IID_PPV_ARGS(ppType) __uuidof(decltype(**(ppType))), [](auto** pp) { (void)static_cast(*pp); return reinterpret_cast(pp); }(ppType) 53 | -------------------------------------------------------------------------------- /include/native/windows/windows.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "windows_base.h" 4 | #include "unknwn.h" -------------------------------------------------------------------------------- /include/native/wsi/native_glfw.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | namespace dxvk::wsi { 6 | 7 | inline GLFWwindow* fromHwnd(HWND hWindow) { 8 | return reinterpret_cast(hWindow); 9 | } 10 | 11 | inline HWND toHwnd(GLFWwindow* pWindow) { 12 | return reinterpret_cast(pWindow); 13 | } 14 | 15 | // Offset so null HMONITORs go to -1 16 | inline int32_t fromHmonitor(HMONITOR hMonitor) { 17 | return static_cast(reinterpret_cast(hMonitor)) - 1; 18 | } 19 | 20 | // Offset so -1 display id goes to 0 == NULL 21 | inline HMONITOR toHmonitor(int32_t displayId) { 22 | return reinterpret_cast(static_cast(displayId + 1)); 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /include/native/wsi/native_sdl2.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | namespace dxvk::wsi { 6 | 7 | inline SDL_Window* fromHwnd(HWND hWindow) { 8 | return reinterpret_cast(hWindow); 9 | } 10 | 11 | inline HWND toHwnd(SDL_Window* pWindow) { 12 | return reinterpret_cast(pWindow); 13 | } 14 | 15 | // Offset so null HMONITORs go to -1 16 | inline int32_t fromHmonitor(HMONITOR hMonitor) { 17 | return static_cast(reinterpret_cast(hMonitor)) - 1; 18 | } 19 | 20 | // Offset so -1 display id goes to 0 == NULL 21 | inline HMONITOR toHmonitor(int32_t displayId) { 22 | return reinterpret_cast(static_cast(displayId + 1)); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /include/native/wsi/native_sdl3.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | namespace dxvk::wsi { 6 | 7 | inline SDL_Window* fromHwnd(HWND hWindow) { 8 | return reinterpret_cast(hWindow); 9 | } 10 | 11 | inline HWND toHwnd(SDL_Window* pWindow) { 12 | return reinterpret_cast(pWindow); 13 | } 14 | 15 | // Offset so null HMONITORs go to -1 16 | inline SDL_DisplayID fromHmonitor(HMONITOR hMonitor) { 17 | return SDL_DisplayID(reinterpret_cast(hMonitor)); 18 | } 19 | 20 | // Offset so -1 display id goes to 0 == NULL 21 | inline HMONITOR toHmonitor(SDL_DisplayID display) { 22 | return reinterpret_cast(uintptr_t(display)); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /include/native/wsi/native_wsi.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef DXVK_WSI_WIN32 4 | #error You shouldnt be using this code path. 5 | #elif DXVK_WSI_SDL3 6 | #include "wsi/native_sdl3.h" 7 | #elif DXVK_WSI_SDL2 8 | #include "wsi/native_sdl2.h" 9 | #elif DXVK_WSI_GLFW 10 | #include "wsi/native_glfw.h" 11 | #else 12 | #error Unknown wsi! 13 | #endif -------------------------------------------------------------------------------- /include/openvr/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Valve Corporation 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation and/or 12 | other materials provided with the distribution. 13 | 14 | 3. Neither the name of the copyright holder nor the names of its contributors 15 | may be used to endorse or promote products derived from this software without 16 | specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /meson_options.txt: -------------------------------------------------------------------------------- 1 | option('enable_dxgi', type : 'boolean', value : true, description: 'Build DXGI') 2 | option('enable_d3d8', type : 'boolean', value : true, description: 'Build D3D8') 3 | option('enable_d3d9', type : 'boolean', value : true, description: 'Build D3D9') 4 | option('enable_d3d10', type : 'boolean', value : true, description: 'Build D3D10') 5 | option('enable_d3d11', type : 'boolean', value : true, description: 'Build D3D11') 6 | option('build_id', type : 'boolean', value : false) 7 | option('native_glfw', type : 'feature', value : 'auto', description: 'Enable GLFW WSI for DXVK Native') 8 | option('native_sdl2', type : 'feature', value : 'auto', description: 'Enable SDL2 WSI for DXVK Native') 9 | option('native_sdl3', type : 'feature', value : 'auto', description: 'Enable SDL3 WSI for DXVK Native') 10 | -------------------------------------------------------------------------------- /src/d3d10/d3d10_blend.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "d3d10_util.h" 4 | 5 | namespace dxvk { 6 | 7 | class D3D11BlendState; 8 | class D3D11Device; 9 | 10 | class D3D10BlendState : public ID3D10BlendState1 { 11 | 12 | public: 13 | 14 | D3D10BlendState(D3D11BlendState* pParent) 15 | : m_d3d11(pParent) { } 16 | 17 | HRESULT STDMETHODCALLTYPE QueryInterface( 18 | REFIID riid, 19 | void** ppvObject); 20 | 21 | ULONG STDMETHODCALLTYPE AddRef(); 22 | 23 | ULONG STDMETHODCALLTYPE Release(); 24 | 25 | void STDMETHODCALLTYPE GetDevice( 26 | ID3D10Device** ppDevice); 27 | 28 | HRESULT STDMETHODCALLTYPE GetPrivateData( 29 | REFGUID guid, 30 | UINT* pDataSize, 31 | void* pData); 32 | 33 | HRESULT STDMETHODCALLTYPE SetPrivateData( 34 | REFGUID guid, 35 | UINT DataSize, 36 | const void* pData); 37 | 38 | HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( 39 | REFGUID guid, 40 | const IUnknown* pData); 41 | 42 | void STDMETHODCALLTYPE GetDesc( 43 | D3D10_BLEND_DESC* pDesc); 44 | 45 | void STDMETHODCALLTYPE GetDesc1( 46 | D3D10_BLEND_DESC1* pDesc); 47 | 48 | D3D11BlendState* GetD3D11Iface() { 49 | return m_d3d11; 50 | } 51 | 52 | private: 53 | 54 | D3D11BlendState* m_d3d11; 55 | 56 | }; 57 | 58 | } -------------------------------------------------------------------------------- /src/d3d10/d3d10_depth_stencil.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "d3d10_util.h" 4 | 5 | namespace dxvk { 6 | 7 | class D3D11DepthStencilState; 8 | class D3D11Device; 9 | 10 | class D3D10DepthStencilState : public ID3D10DepthStencilState { 11 | 12 | public: 13 | 14 | D3D10DepthStencilState(D3D11DepthStencilState* pParent) 15 | : m_d3d11(pParent) { } 16 | 17 | HRESULT STDMETHODCALLTYPE QueryInterface( 18 | REFIID riid, 19 | void** ppvObject); 20 | 21 | ULONG STDMETHODCALLTYPE AddRef(); 22 | 23 | ULONG STDMETHODCALLTYPE Release(); 24 | 25 | void STDMETHODCALLTYPE GetDevice( 26 | ID3D10Device** ppDevice); 27 | 28 | HRESULT STDMETHODCALLTYPE GetPrivateData( 29 | REFGUID guid, 30 | UINT* pDataSize, 31 | void* pData); 32 | 33 | HRESULT STDMETHODCALLTYPE SetPrivateData( 34 | REFGUID guid, 35 | UINT DataSize, 36 | const void* pData); 37 | 38 | HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( 39 | REFGUID guid, 40 | const IUnknown* pData); 41 | 42 | void STDMETHODCALLTYPE GetDesc( 43 | D3D10_DEPTH_STENCIL_DESC* pDesc); 44 | 45 | D3D11DepthStencilState* GetD3D11Iface() { 46 | return m_d3d11; 47 | } 48 | 49 | private: 50 | 51 | D3D11DepthStencilState* m_d3d11; 52 | 53 | }; 54 | 55 | } -------------------------------------------------------------------------------- /src/d3d10/d3d10_include.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../dxgi/dxgi_include.h" 4 | 5 | #include "../util/sync/sync_spinlock.h" 6 | #include "../util/sync/sync_recursive.h" 7 | 8 | #include 9 | #include 10 | -------------------------------------------------------------------------------- /src/d3d10/d3d10_input_layout.cpp: -------------------------------------------------------------------------------- 1 | #include "d3d10_input_layout.h" 2 | 3 | #include "../d3d11/d3d11_device.h" 4 | #include "../d3d11/d3d11_input_layout.h" 5 | 6 | namespace dxvk { 7 | 8 | HRESULT STDMETHODCALLTYPE D3D10InputLayout::QueryInterface( 9 | REFIID riid, 10 | void** ppvObject) { 11 | return m_d3d11->QueryInterface(riid, ppvObject); 12 | } 13 | 14 | 15 | ULONG STDMETHODCALLTYPE D3D10InputLayout::AddRef() { 16 | return m_d3d11->AddRef(); 17 | } 18 | 19 | 20 | ULONG STDMETHODCALLTYPE D3D10InputLayout::Release() { 21 | return m_d3d11->Release(); 22 | } 23 | 24 | 25 | void STDMETHODCALLTYPE D3D10InputLayout::GetDevice( 26 | ID3D10Device** ppDevice) { 27 | GetD3D10Device(m_d3d11, ppDevice); 28 | } 29 | 30 | 31 | HRESULT STDMETHODCALLTYPE D3D10InputLayout::GetPrivateData( 32 | REFGUID guid, 33 | UINT* pDataSize, 34 | void* pData) { 35 | return m_d3d11->GetPrivateData(guid, pDataSize, pData); 36 | } 37 | 38 | 39 | HRESULT STDMETHODCALLTYPE D3D10InputLayout::SetPrivateData( 40 | REFGUID guid, 41 | UINT DataSize, 42 | const void* pData) { 43 | return m_d3d11->SetPrivateData(guid, DataSize, pData); 44 | } 45 | 46 | 47 | HRESULT STDMETHODCALLTYPE D3D10InputLayout::SetPrivateDataInterface( 48 | REFGUID guid, 49 | const IUnknown* pData) { 50 | return m_d3d11->SetPrivateDataInterface(guid, pData); 51 | } 52 | 53 | } -------------------------------------------------------------------------------- /src/d3d10/d3d10_input_layout.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "d3d10_util.h" 4 | 5 | namespace dxvk { 6 | 7 | class D3D11Device; 8 | class D3D11InputLayout; 9 | 10 | class D3D10InputLayout : public ID3D10InputLayout { 11 | 12 | public: 13 | 14 | D3D10InputLayout(D3D11InputLayout* pParent) 15 | : m_d3d11(pParent) { } 16 | 17 | HRESULT STDMETHODCALLTYPE QueryInterface( 18 | REFIID riid, 19 | void** ppvObject); 20 | 21 | ULONG STDMETHODCALLTYPE AddRef(); 22 | 23 | ULONG STDMETHODCALLTYPE Release(); 24 | 25 | void STDMETHODCALLTYPE GetDevice( 26 | ID3D10Device** ppDevice); 27 | 28 | HRESULT STDMETHODCALLTYPE GetPrivateData( 29 | REFGUID guid, 30 | UINT* pDataSize, 31 | void* pData); 32 | 33 | HRESULT STDMETHODCALLTYPE SetPrivateData( 34 | REFGUID guid, 35 | UINT DataSize, 36 | const void* pData); 37 | 38 | HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( 39 | REFGUID guid, 40 | const IUnknown* pData); 41 | 42 | D3D11InputLayout* GetD3D11Iface() { 43 | return m_d3d11; 44 | } 45 | 46 | private: 47 | 48 | D3D11InputLayout* m_d3d11; 49 | 50 | }; 51 | 52 | } -------------------------------------------------------------------------------- /src/d3d10/d3d10_multithread.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "d3d10_device.h" 4 | 5 | namespace dxvk { 6 | 7 | D3D10Multithread::D3D10Multithread( 8 | IUnknown* pParent, 9 | BOOL Protected, 10 | BOOL Force) 11 | : m_parent (pParent), 12 | m_protected (Protected || Force), 13 | m_enabled (Protected), 14 | m_forced (Force) { 15 | 16 | } 17 | 18 | 19 | D3D10Multithread::~D3D10Multithread() { 20 | 21 | } 22 | 23 | 24 | ULONG STDMETHODCALLTYPE D3D10Multithread::AddRef() { 25 | return m_parent->AddRef(); 26 | } 27 | 28 | 29 | ULONG STDMETHODCALLTYPE D3D10Multithread::Release() { 30 | return m_parent->Release(); 31 | } 32 | 33 | 34 | HRESULT STDMETHODCALLTYPE D3D10Multithread::QueryInterface( 35 | REFIID riid, 36 | void** ppvObject) { 37 | return m_parent->QueryInterface(riid, ppvObject); 38 | } 39 | 40 | 41 | void STDMETHODCALLTYPE D3D10Multithread::Enter() { 42 | if (m_protected) 43 | m_mutex.lock(); 44 | } 45 | 46 | 47 | void STDMETHODCALLTYPE D3D10Multithread::Leave() { 48 | if (m_protected) 49 | m_mutex.unlock(); 50 | } 51 | 52 | 53 | BOOL STDMETHODCALLTYPE D3D10Multithread::SetMultithreadProtected( 54 | BOOL bMTProtect) { 55 | BOOL result = m_enabled; 56 | m_enabled = bMTProtect; 57 | 58 | if (!m_forced) 59 | m_protected = m_enabled; 60 | 61 | return result; 62 | } 63 | 64 | 65 | BOOL STDMETHODCALLTYPE D3D10Multithread::GetMultithreadProtected() { 66 | return m_enabled; 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/d3d10/d3d10_rasterizer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "d3d10_util.h" 4 | 5 | namespace dxvk { 6 | 7 | class D3D11RasterizerState; 8 | class D3D11Device; 9 | 10 | class D3D10RasterizerState : public ID3D10RasterizerState { 11 | 12 | public: 13 | 14 | D3D10RasterizerState(D3D11RasterizerState* pParent) 15 | : m_d3d11(pParent) { } 16 | 17 | HRESULT STDMETHODCALLTYPE QueryInterface( 18 | REFIID riid, 19 | void** ppvObject); 20 | 21 | ULONG STDMETHODCALLTYPE AddRef(); 22 | 23 | ULONG STDMETHODCALLTYPE Release(); 24 | 25 | void STDMETHODCALLTYPE GetDevice( 26 | ID3D10Device** ppDevice); 27 | 28 | HRESULT STDMETHODCALLTYPE GetPrivateData( 29 | REFGUID guid, 30 | UINT* pDataSize, 31 | void* pData); 32 | 33 | HRESULT STDMETHODCALLTYPE SetPrivateData( 34 | REFGUID guid, 35 | UINT DataSize, 36 | const void* pData); 37 | 38 | HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( 39 | REFGUID guid, 40 | const IUnknown* pData); 41 | 42 | void STDMETHODCALLTYPE GetDesc( 43 | D3D10_RASTERIZER_DESC* pDesc); 44 | 45 | D3D11RasterizerState* GetD3D11Iface() { 46 | return m_d3d11; 47 | } 48 | 49 | private: 50 | 51 | D3D11RasterizerState* m_d3d11; 52 | 53 | }; 54 | 55 | } -------------------------------------------------------------------------------- /src/d3d10/d3d10_sampler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "d3d10_util.h" 4 | 5 | namespace dxvk { 6 | 7 | class D3D11Device; 8 | class D3D11SamplerState; 9 | 10 | class D3D10SamplerState : public ID3D10SamplerState { 11 | 12 | public: 13 | 14 | D3D10SamplerState(D3D11SamplerState* pParent) 15 | : m_d3d11(pParent) { } 16 | 17 | HRESULT STDMETHODCALLTYPE QueryInterface( 18 | REFIID riid, 19 | void** ppvObject); 20 | 21 | ULONG STDMETHODCALLTYPE AddRef(); 22 | 23 | ULONG STDMETHODCALLTYPE Release(); 24 | 25 | void STDMETHODCALLTYPE GetDevice( 26 | ID3D10Device** ppDevice); 27 | 28 | HRESULT STDMETHODCALLTYPE GetPrivateData( 29 | REFGUID guid, 30 | UINT* pDataSize, 31 | void* pData); 32 | 33 | HRESULT STDMETHODCALLTYPE SetPrivateData( 34 | REFGUID guid, 35 | UINT DataSize, 36 | const void* pData); 37 | 38 | HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( 39 | REFGUID guid, 40 | const IUnknown* pData); 41 | 42 | void STDMETHODCALLTYPE GetDesc( 43 | D3D10_SAMPLER_DESC* pDesc); 44 | 45 | D3D11SamplerState* GetD3D11Iface() { 46 | return m_d3d11; 47 | } 48 | 49 | private: 50 | 51 | D3D11SamplerState* m_d3d11; 52 | 53 | }; 54 | 55 | } -------------------------------------------------------------------------------- /src/d3d10/d3d10_view_dsv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "d3d10_util.h" 4 | 5 | namespace dxvk { 6 | 7 | class D3D11Device; 8 | class D3D11DepthStencilView; 9 | 10 | class D3D10DepthStencilView : public ID3D10DepthStencilView { 11 | 12 | public: 13 | 14 | D3D10DepthStencilView(D3D11DepthStencilView* pParent) 15 | : m_d3d11(pParent) { } 16 | 17 | HRESULT STDMETHODCALLTYPE QueryInterface( 18 | REFIID riid, 19 | void** ppvObject); 20 | 21 | ULONG STDMETHODCALLTYPE AddRef(); 22 | 23 | ULONG STDMETHODCALLTYPE Release(); 24 | 25 | void STDMETHODCALLTYPE GetDevice( 26 | ID3D10Device** ppDevice); 27 | 28 | HRESULT STDMETHODCALLTYPE GetPrivateData( 29 | REFGUID guid, 30 | UINT* pDataSize, 31 | void* pData); 32 | 33 | HRESULT STDMETHODCALLTYPE SetPrivateData( 34 | REFGUID guid, 35 | UINT DataSize, 36 | const void* pData); 37 | 38 | HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( 39 | REFGUID guid, 40 | const IUnknown* pData); 41 | 42 | void STDMETHODCALLTYPE GetResource( 43 | ID3D10Resource** ppResource); 44 | 45 | void STDMETHODCALLTYPE GetDesc( 46 | D3D10_DEPTH_STENCIL_VIEW_DESC* pDesc); 47 | 48 | D3D11DepthStencilView* GetD3D11Iface() { 49 | return m_d3d11; 50 | } 51 | 52 | private: 53 | 54 | D3D11DepthStencilView* m_d3d11; 55 | 56 | }; 57 | 58 | } -------------------------------------------------------------------------------- /src/d3d10/d3d10_view_rtv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "d3d10_util.h" 4 | 5 | namespace dxvk { 6 | 7 | class D3D11Device; 8 | class D3D11RenderTargetView; 9 | 10 | class D3D10RenderTargetView : public ID3D10RenderTargetView { 11 | 12 | public: 13 | 14 | D3D10RenderTargetView(D3D11RenderTargetView* pParent) 15 | : m_d3d11(pParent) { } 16 | 17 | HRESULT STDMETHODCALLTYPE QueryInterface( 18 | REFIID riid, 19 | void** ppvObject); 20 | 21 | ULONG STDMETHODCALLTYPE AddRef(); 22 | 23 | ULONG STDMETHODCALLTYPE Release(); 24 | 25 | void STDMETHODCALLTYPE GetDevice( 26 | ID3D10Device** ppDevice); 27 | 28 | HRESULT STDMETHODCALLTYPE GetPrivateData( 29 | REFGUID guid, 30 | UINT* pDataSize, 31 | void* pData); 32 | 33 | HRESULT STDMETHODCALLTYPE SetPrivateData( 34 | REFGUID guid, 35 | UINT DataSize, 36 | const void* pData); 37 | 38 | HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( 39 | REFGUID guid, 40 | const IUnknown* pData); 41 | 42 | void STDMETHODCALLTYPE GetResource( 43 | ID3D10Resource** ppResource); 44 | 45 | void STDMETHODCALLTYPE GetDesc( 46 | D3D10_RENDER_TARGET_VIEW_DESC* pDesc); 47 | 48 | D3D11RenderTargetView* GetD3D11Iface() { 49 | return m_d3d11; 50 | } 51 | 52 | private: 53 | 54 | D3D11RenderTargetView* m_d3d11; 55 | 56 | }; 57 | 58 | } -------------------------------------------------------------------------------- /src/d3d10/d3d10core.def: -------------------------------------------------------------------------------- 1 | LIBRARY D3D10CORE.DLL 2 | EXPORTS 3 | D3D10CoreCreateDevice 4 | D3D10CoreGetVersion 5 | D3D10CoreRegisterLayers 6 | -------------------------------------------------------------------------------- /src/d3d10/d3d10core.sym: -------------------------------------------------------------------------------- 1 | { 2 | global: 3 | D3D10CoreCreateDevice; 4 | D3D10CoreGetVersion; 5 | D3D10CoreRegisterLayers; 6 | 7 | local: 8 | *; 9 | }; 10 | -------------------------------------------------------------------------------- /src/d3d10/meson.build: -------------------------------------------------------------------------------- 1 | d3d10_core_res = wrc_generator.process('version10_core.rc') 2 | 3 | d3d10_core_src = [ 4 | 'd3d10_core.cpp', 5 | ] 6 | 7 | d3d10_core_ld_args = [] 8 | d3d10_core_link_depends = [] 9 | 10 | if platform == 'windows' 11 | d3d10_d3d11_dep = lib_d3d11 12 | else 13 | d3d10_core_ld_args += [ '-Wl,--version-script', join_paths(meson.current_source_dir(), 'd3d10core.sym') ] 14 | d3d10_core_link_depends += files('d3d10core.sym') 15 | d3d10_d3d11_dep = d3d11_dep 16 | endif 17 | 18 | d3d10_core_dll = shared_library(dxvk_name_prefix+'d3d10core', d3d10_core_src, d3d10_core_res, 19 | dependencies : [ d3d10_d3d11_dep ], 20 | include_directories : dxvk_include_path, 21 | install : true, 22 | vs_module_defs : 'd3d10core'+def_spec_ext, 23 | link_args : d3d10_core_ld_args, 24 | link_depends : [ d3d10_core_link_depends ], 25 | kwargs : dxvk_so_version, 26 | ) 27 | 28 | d3d10_core_dep = declare_dependency( 29 | link_with : [ d3d10_core_dll ], 30 | ) 31 | 32 | if platform != 'windows' 33 | pkg.generate(d3d10_core_dll, 34 | filebase: dxvk_pkg_prefix + 'd3d10core', 35 | subdirs: 'dxvk', 36 | ) 37 | endif 38 | -------------------------------------------------------------------------------- /src/d3d10/version10_core.rc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // DLL version information. 4 | VS_VERSION_INFO VERSIONINFO 5 | FILEVERSION 10,0,17763,1 6 | PRODUCTVERSION 10,0,17763,1 7 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 8 | FILEFLAGS 0 9 | FILEOS VOS_NT_WINDOWS32 10 | FILETYPE VFT_DLL 11 | FILESUBTYPE VFT2_UNKNOWN 12 | BEGIN 13 | BLOCK "StringFileInfo" 14 | BEGIN 15 | BLOCK "080904b0" 16 | BEGIN 17 | VALUE "CompanyName", "DXVK" 18 | VALUE "FileDescription", "Direct3D 10 Runtime" 19 | VALUE "FileVersion", "10.0.17763.1 (WinBuild.160101.0800)" 20 | VALUE "InternalName", "D3D10Core.dll" 21 | VALUE "LegalCopyright", "zlib/libpng license" 22 | VALUE "OriginalFilename", "D3D10Core.dll" 23 | VALUE "ProductName", "DXVK" 24 | VALUE "ProductVersion", "10.0.17763.1" 25 | END 26 | END 27 | BLOCK "VarFileInfo" 28 | BEGIN 29 | VALUE "Translation", 0x0809, 1200 30 | END 31 | END 32 | 33 | -------------------------------------------------------------------------------- /src/d3d11/d3d11.def: -------------------------------------------------------------------------------- 1 | LIBRARY D3D11.DLL 2 | EXPORTS 3 | D3D11CoreCreateDevice @18 4 | D3D11CreateDevice @22 5 | D3D11CreateDeviceAndSwapChain @23 6 | D3D11On12CreateDevice @24 7 | -------------------------------------------------------------------------------- /src/d3d11/d3d11.sym: -------------------------------------------------------------------------------- 1 | { 2 | global: 3 | D3D11CoreCreateDevice; 4 | D3D11CreateDevice; 5 | D3D11CreateDeviceAndSwapChain; 6 | D3D11On12CreateDevice; 7 | 8 | local: 9 | *; 10 | }; 11 | -------------------------------------------------------------------------------- /src/d3d11/d3d11_annotation.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "d3d11_include.h" 6 | 7 | #include "../dxvk/dxvk_annotation.h" 8 | #include "../dxvk/dxvk_device.h" 9 | 10 | namespace dxvk { 11 | 12 | class D3D11DeferredContext; 13 | class D3D11ImmediateContext; 14 | 15 | template 16 | class D3D11UserDefinedAnnotation final : public IDXVKUserDefinedAnnotation { 17 | constexpr static bool IsDeferred = std::is_same_v; 18 | public: 19 | 20 | D3D11UserDefinedAnnotation( 21 | ContextType* container, 22 | const Rc& dxvkDevice); 23 | 24 | ~D3D11UserDefinedAnnotation(); 25 | 26 | D3D11UserDefinedAnnotation (const D3D11UserDefinedAnnotation&) = delete; 27 | D3D11UserDefinedAnnotation& operator = (const D3D11UserDefinedAnnotation&) = delete; 28 | 29 | ULONG STDMETHODCALLTYPE AddRef(); 30 | 31 | ULONG STDMETHODCALLTYPE Release(); 32 | 33 | HRESULT STDMETHODCALLTYPE QueryInterface( 34 | REFIID riid, 35 | void** ppvObject); 36 | 37 | INT STDMETHODCALLTYPE BeginEvent( 38 | D3DCOLOR Color, 39 | LPCWSTR Name); 40 | 41 | INT STDMETHODCALLTYPE EndEvent(); 42 | 43 | void STDMETHODCALLTYPE SetMarker( 44 | D3DCOLOR Color, 45 | LPCWSTR Name); 46 | 47 | BOOL STDMETHODCALLTYPE GetStatus(); 48 | 49 | private: 50 | 51 | ContextType* m_container = nullptr; 52 | int32_t m_eventDepth = 0u; 53 | bool m_annotationsEnabled = false; 54 | 55 | }; 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/d3d11/d3d11_class_linkage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "d3d11_device_child.h" 4 | 5 | namespace dxvk { 6 | 7 | class D3D11Device; 8 | 9 | // TODO implement properly 10 | class D3D11ClassLinkage : public D3D11DeviceChild { 11 | 12 | public: 13 | 14 | D3D11ClassLinkage( 15 | D3D11Device* pDevice); 16 | 17 | ~D3D11ClassLinkage(); 18 | 19 | HRESULT STDMETHODCALLTYPE QueryInterface( 20 | REFIID riid, 21 | void** ppvObject) final; 22 | 23 | HRESULT STDMETHODCALLTYPE CreateClassInstance( 24 | LPCSTR pClassTypeName, 25 | UINT ConstantBufferOffset, 26 | UINT ConstantVectorOffset, 27 | UINT TextureOffset, 28 | UINT SamplerOffset, 29 | ID3D11ClassInstance **ppInstance); 30 | 31 | HRESULT STDMETHODCALLTYPE GetClassInstance( 32 | LPCSTR pClassInstanceName, 33 | UINT InstanceIndex, 34 | ID3D11ClassInstance **ppInstance); 35 | 36 | private: 37 | 38 | D3DDestructionNotifier m_destructionNotifier; 39 | 40 | }; 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/d3d11/d3d11_cmd.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "d3d11_include.h" 4 | 5 | namespace dxvk { 6 | 7 | /** 8 | * \brief D3D11 command type 9 | * 10 | * Used to identify the type of command 11 | * data most recently added to a CS chunk. 12 | */ 13 | enum class D3D11CmdType : uint32_t { 14 | None, 15 | DrawIndirect, 16 | DrawIndirectIndexed, 17 | Draw, 18 | DrawIndexed, 19 | }; 20 | 21 | 22 | /** 23 | * \brief Indirect draw command data 24 | * 25 | * Stores the offset into the draw buffer for 26 | * the first draw, as well as the number of 27 | * draws to execute. 28 | */ 29 | struct D3D11CmdDrawIndirectData { 30 | uint32_t offset; 31 | uint32_t count; 32 | uint32_t stride; 33 | }; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/d3d11/d3d11_enums.cpp: -------------------------------------------------------------------------------- 1 | #include "d3d11_enums.h" 2 | 3 | std::ostream& operator << (std::ostream& os, D3D_FEATURE_LEVEL e) { 4 | switch (e) { 5 | ENUM_NAME(D3D_FEATURE_LEVEL_9_1); 6 | ENUM_NAME(D3D_FEATURE_LEVEL_9_2); 7 | ENUM_NAME(D3D_FEATURE_LEVEL_9_3); 8 | ENUM_NAME(D3D_FEATURE_LEVEL_10_0); 9 | ENUM_NAME(D3D_FEATURE_LEVEL_10_1); 10 | ENUM_NAME(D3D_FEATURE_LEVEL_11_0); 11 | ENUM_NAME(D3D_FEATURE_LEVEL_11_1); 12 | ENUM_NAME(D3D_FEATURE_LEVEL_12_0); 13 | ENUM_NAME(D3D_FEATURE_LEVEL_12_1); 14 | ENUM_DEFAULT(e); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/d3d11/d3d11_enums.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "d3d11_include.h" 6 | 7 | std::ostream& operator << (std::ostream& os, D3D_FEATURE_LEVEL e); -------------------------------------------------------------------------------- /src/d3d11/d3d11_fence.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../dxvk/dxvk_fence.h" 4 | #include "../dxvk/dxvk_gpu_query.h" 5 | 6 | #include "d3d11_device_child.h" 7 | 8 | namespace dxvk { 9 | 10 | class D3D11Fence : public D3D11DeviceChild { 11 | 12 | public: 13 | 14 | D3D11Fence( 15 | D3D11Device* pDevice, 16 | UINT64 InitialValue, 17 | D3D11_FENCE_FLAG Flags, 18 | HANDLE hFence); 19 | 20 | ~D3D11Fence(); 21 | 22 | HRESULT STDMETHODCALLTYPE QueryInterface( 23 | REFIID riid, 24 | void** ppvObject); 25 | 26 | HRESULT STDMETHODCALLTYPE CreateSharedHandle( 27 | const SECURITY_ATTRIBUTES* pAttributes, 28 | DWORD dwAccess, 29 | LPCWSTR lpName, 30 | HANDLE* pHandle); 31 | 32 | HRESULT STDMETHODCALLTYPE SetEventOnCompletion( 33 | UINT64 Value, 34 | HANDLE hEvent); 35 | 36 | UINT64 STDMETHODCALLTYPE GetCompletedValue(); 37 | 38 | Rc GetFence() const { 39 | return m_fence; 40 | } 41 | 42 | private: 43 | 44 | Rc m_fence; 45 | D3D11_FENCE_FLAG m_flags = D3D11_FENCE_FLAG_NONE; 46 | 47 | D3DDestructionNotifier m_destructionNotifier; 48 | 49 | }; 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/d3d11/d3d11_gdi.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "d3d11_include.h" 6 | 7 | namespace dxvk { 8 | 9 | class D3D11GDISurface { 10 | 11 | public: 12 | 13 | D3D11GDISurface( 14 | ID3D11Resource* pResource, 15 | UINT Subresource); 16 | 17 | ~D3D11GDISurface(); 18 | 19 | HRESULT Acquire( 20 | BOOL Discard, 21 | HDC* phdc); 22 | 23 | HRESULT Release( 24 | const RECT* pDirtyRect); 25 | 26 | private: 27 | 28 | ID3D11Resource* m_resource; 29 | uint32_t m_subresource; 30 | ID3D11Resource* m_readback; 31 | HDC m_hdc; 32 | HANDLE m_hbitmap; 33 | bool m_acquired; 34 | 35 | std::vector m_data; 36 | 37 | HRESULT CreateReadbackResource(); 38 | 39 | }; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/d3d11/d3d11_include.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../dxgi/dxgi_include.h" 4 | 5 | #include 6 | -------------------------------------------------------------------------------- /src/d3d11/d3d11_input_layout.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "d3d11_device_child.h" 4 | 5 | #include "../d3d10/d3d10_input_layout.h" 6 | 7 | namespace dxvk { 8 | 9 | class D3D11Device; 10 | 11 | class D3D11InputLayout : public D3D11DeviceChild { 12 | 13 | public: 14 | 15 | D3D11InputLayout( 16 | D3D11Device* pDevice, 17 | uint32_t numAttributes, 18 | const DxvkVertexAttribute* pAttributes, 19 | uint32_t numBindings, 20 | const DxvkVertexBinding* pBindings); 21 | 22 | ~D3D11InputLayout(); 23 | 24 | HRESULT STDMETHODCALLTYPE QueryInterface( 25 | REFIID riid, 26 | void** ppvObject) final; 27 | 28 | uint32_t GetAttributeCount() const { 29 | return m_attributeCount; 30 | } 31 | 32 | uint32_t GetBindingCount() const { 33 | return m_bindingCount; 34 | } 35 | 36 | DxvkVertexInput GetInput(uint32_t Index) const { 37 | return m_inputs[Index]; 38 | } 39 | 40 | bool Compare( 41 | const D3D11InputLayout* pOther) const; 42 | 43 | D3D10InputLayout* GetD3D10Iface() { 44 | return &m_d3d10; 45 | } 46 | 47 | private: 48 | 49 | uint32_t m_attributeCount = 0; 50 | uint32_t m_bindingCount = 0; 51 | 52 | std::array m_inputs = { }; 53 | 54 | D3D10InputLayout m_d3d10; 55 | 56 | D3DDestructionNotifier m_destructionNotifier; 57 | 58 | }; 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/d3d11/d3d11_sampler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../dxvk/dxvk_device.h" 4 | 5 | #include "../d3d10/d3d10_sampler.h" 6 | 7 | #include "d3d11_device_child.h" 8 | 9 | namespace dxvk { 10 | 11 | class D3D11Device; 12 | 13 | class D3D11SamplerState : public D3D11StateObject { 14 | 15 | public: 16 | 17 | using DescType = D3D11_SAMPLER_DESC; 18 | 19 | D3D11SamplerState( 20 | D3D11Device* device, 21 | const D3D11_SAMPLER_DESC& desc); 22 | ~D3D11SamplerState(); 23 | 24 | HRESULT STDMETHODCALLTYPE QueryInterface( 25 | REFIID riid, 26 | void** ppvObject) final; 27 | 28 | void STDMETHODCALLTYPE GetDesc( 29 | D3D11_SAMPLER_DESC* pDesc) final; 30 | 31 | Rc GetDXVKSampler() const { 32 | return m_sampler; 33 | } 34 | 35 | D3D10SamplerState* GetD3D10Iface() { 36 | return &m_d3d10; 37 | } 38 | 39 | static HRESULT NormalizeDesc( 40 | D3D11_SAMPLER_DESC* pDesc); 41 | 42 | private: 43 | 44 | D3D11_SAMPLER_DESC m_desc; 45 | Rc m_sampler; 46 | D3D10SamplerState m_d3d10; 47 | 48 | std::atomic m_refCount = { 0u }; 49 | 50 | D3DDestructionNotifier m_destructionNotifier; 51 | 52 | static bool ValidateAddressMode( 53 | D3D11_TEXTURE_ADDRESS_MODE Mode); 54 | 55 | static bool ValidateComparisonFunc( 56 | D3D11_COMPARISON_FUNC Comparison); 57 | 58 | }; 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/d3d11/d3d11_state_object.cpp: -------------------------------------------------------------------------------- 1 | #include "d3d11_state_object.h" 2 | 3 | namespace dxvk { 4 | 5 | D3D11DeviceContextState::D3D11DeviceContextState( 6 | D3D11Device* pDevice) 7 | : D3D11DeviceChild(pDevice), 8 | m_destructionNotifier(this) { 9 | 10 | } 11 | 12 | 13 | D3D11DeviceContextState::~D3D11DeviceContextState() { 14 | 15 | } 16 | 17 | 18 | HRESULT STDMETHODCALLTYPE D3D11DeviceContextState::QueryInterface( 19 | REFIID riid, 20 | void** ppvObject) { 21 | if (ppvObject == nullptr) 22 | return E_POINTER; 23 | 24 | *ppvObject = nullptr; 25 | 26 | if (riid == __uuidof(IUnknown) 27 | || riid == __uuidof(ID3D11DeviceChild) 28 | || riid == __uuidof(ID3DDeviceContextState)) { 29 | *ppvObject = ref(this); 30 | return S_OK; 31 | } 32 | 33 | if (riid == __uuidof(ID3DDestructionNotifier)) { 34 | *ppvObject = ref(&m_destructionNotifier); 35 | return S_OK; 36 | } 37 | 38 | if (logQueryInterfaceError(__uuidof(ID3DDeviceContextState), riid)) { 39 | Logger::warn("D3D11DeviceContextState::QueryInterface: Unknown interface query"); 40 | Logger::warn(str::format(riid)); 41 | } 42 | 43 | return E_NOINTERFACE; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/d3d11/d3d11_state_object.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "d3d11_device.h" 4 | #include "d3d11_context_state.h" 5 | #include "d3d11_device_child.h" 6 | 7 | namespace dxvk { 8 | 9 | /** 10 | * \brief Device context state implementation 11 | * 12 | * This is an opaque interface in D3D11, and we only 13 | * implement the state block-like functionality, not 14 | * the methods to disable certain context and device 15 | * interfaces based on the emulated device IID. 16 | */ 17 | class D3D11DeviceContextState : public D3D11DeviceChild { 18 | 19 | public: 20 | 21 | D3D11DeviceContextState( 22 | D3D11Device* pDevice); 23 | 24 | ~D3D11DeviceContextState(); 25 | 26 | HRESULT STDMETHODCALLTYPE QueryInterface( 27 | REFIID riid, 28 | void** ppvObject); 29 | 30 | void SetState(const D3D11ContextState& State) { 31 | m_state = State; 32 | } 33 | 34 | void GetState(D3D11ContextState& State) const { 35 | State = m_state; 36 | } 37 | 38 | private: 39 | 40 | D3D11ContextState m_state; 41 | 42 | D3DDestructionNotifier m_destructionNotifier; 43 | 44 | }; 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/d3d11/shaders/d3d11_video_blit_vert.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) out vec2 o_texcoord; 4 | 5 | void main() { 6 | vec2 coord = vec2( 7 | float(gl_VertexIndex & 1) * 2.0f, 8 | float(gl_VertexIndex & 2)); 9 | 10 | o_texcoord = coord; 11 | gl_Position = vec4(-1.0f + 2.0f * coord, 0.0f, 1.0f); 12 | } 13 | -------------------------------------------------------------------------------- /src/d3d11/version.rc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // DLL version information. 4 | VS_VERSION_INFO VERSIONINFO 5 | FILEVERSION 10,0,17763,1 6 | PRODUCTVERSION 10,0,17763,1 7 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 8 | FILEFLAGS 0 9 | FILEOS VOS_NT_WINDOWS32 10 | FILETYPE VFT_DLL 11 | FILESUBTYPE VFT2_UNKNOWN 12 | BEGIN 13 | BLOCK "StringFileInfo" 14 | BEGIN 15 | BLOCK "080904b0" 16 | BEGIN 17 | VALUE "CompanyName", "DXVK" 18 | VALUE "FileDescription", "Direct3D 11 Runtime" 19 | VALUE "FileVersion", "10.0.17763.1 (WinBuild.160101.0800)" 20 | VALUE "InternalName", "D3D11.dll" 21 | VALUE "LegalCopyright", "zlib/libpng license" 22 | VALUE "OriginalFilename", "D3D11.dll" 23 | VALUE "ProductName", "DXVK" 24 | VALUE "ProductVersion", "10.0.17763.1" 25 | END 26 | END 27 | BLOCK "VarFileInfo" 28 | BEGIN 29 | VALUE "Translation", 0x0809, 1200 30 | END 31 | END 32 | 33 | -------------------------------------------------------------------------------- /src/d3d8/d3d8.def: -------------------------------------------------------------------------------- 1 | LIBRARY D3D8.DLL 2 | EXPORTS 3 | ValidatePixelShader @ 2 4 | ValidateVertexShader @ 3 5 | DebugSetMute @ 4 6 | Direct3DCreate8 @ 5 7 | -------------------------------------------------------------------------------- /src/d3d8/d3d8.sym: -------------------------------------------------------------------------------- 1 | { 2 | global: 3 | ValidatePixelShader; 4 | ValidateVertexShader; 5 | DebugSetMute; 6 | Direct3DCreate8; 7 | 8 | local: 9 | *; 10 | }; 11 | -------------------------------------------------------------------------------- /src/d3d8/d3d8_buffer.cpp: -------------------------------------------------------------------------------- 1 | #include "d3d8_buffer.h" 2 | #include "d3d8_device.h" 3 | 4 | namespace dxvk { 5 | 6 | // D3D8VertexBuffer 7 | 8 | D3D8VertexBuffer::D3D8VertexBuffer( 9 | D3D8Device* pDevice, 10 | Com&& pBuffer, 11 | D3DPOOL Pool, 12 | DWORD Usage) 13 | : D3D8VertexBufferBase(pDevice, std::move(pBuffer), Pool, Usage) { 14 | } 15 | 16 | D3DRESOURCETYPE STDMETHODCALLTYPE D3D8VertexBuffer::GetType() { return D3DRTYPE_VERTEXBUFFER; } 17 | 18 | HRESULT STDMETHODCALLTYPE D3D8VertexBuffer::GetDesc(D3DVERTEXBUFFER_DESC* pDesc) { 19 | return GetD3D9()->GetDesc(reinterpret_cast(pDesc)); 20 | } 21 | 22 | // D3D8IndexBuffer 23 | 24 | D3D8IndexBuffer::D3D8IndexBuffer( 25 | D3D8Device* pDevice, 26 | Com&& pBuffer, 27 | D3DPOOL Pool, 28 | DWORD Usage) 29 | : D3D8IndexBufferBase(pDevice, std::move(pBuffer), Pool, Usage) { 30 | } 31 | 32 | D3DRESOURCETYPE STDMETHODCALLTYPE D3D8IndexBuffer::GetType() { return D3DRTYPE_INDEXBUFFER; } 33 | 34 | HRESULT STDMETHODCALLTYPE D3D8IndexBuffer::GetDesc(D3DINDEXBUFFER_DESC* pDesc) { 35 | return GetD3D9()->GetDesc(reinterpret_cast(pDesc)); 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /src/d3d8/d3d8_caps.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace dxvk::d8caps { 4 | 5 | inline constexpr uint32_t MAX_TEXTURE_STAGES = 8; 6 | inline constexpr uint32_t MAX_STREAMS = 16; 7 | 8 | } -------------------------------------------------------------------------------- /src/d3d8/d3d8_multithread.cpp: -------------------------------------------------------------------------------- 1 | #include "d3d8_device.h" 2 | 3 | namespace dxvk { 4 | 5 | D3D8Multithread::D3D8Multithread( 6 | BOOL Protected) 7 | : m_protected( Protected ) { } 8 | 9 | } -------------------------------------------------------------------------------- /src/d3d8/d3d8_multithread.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "d3d8_include.h" 4 | 5 | namespace dxvk { 6 | 7 | /** 8 | * \brief Device lock 9 | * 10 | * Lightweight RAII wrapper that implements 11 | * a subset of the functionality provided by 12 | * \c std::unique_lock, with the goal of being 13 | * cheaper to construct and destroy. 14 | */ 15 | class D3D8DeviceLock { 16 | 17 | public: 18 | 19 | D3D8DeviceLock() 20 | : m_mutex(nullptr) { } 21 | 22 | D3D8DeviceLock(sync::RecursiveSpinlock& mutex) 23 | : m_mutex(&mutex) { 24 | mutex.lock(); 25 | } 26 | 27 | D3D8DeviceLock(D3D8DeviceLock&& other) 28 | : m_mutex(other.m_mutex) { 29 | other.m_mutex = nullptr; 30 | } 31 | 32 | D3D8DeviceLock& operator = (D3D8DeviceLock&& other) { 33 | if (m_mutex) 34 | m_mutex->unlock(); 35 | 36 | m_mutex = other.m_mutex; 37 | other.m_mutex = nullptr; 38 | return *this; 39 | } 40 | 41 | ~D3D8DeviceLock() { 42 | if (m_mutex != nullptr) 43 | m_mutex->unlock(); 44 | } 45 | 46 | private: 47 | 48 | sync::RecursiveSpinlock* m_mutex; 49 | 50 | }; 51 | 52 | 53 | /** 54 | * \brief D3D8 context lock 55 | */ 56 | class D3D8Multithread { 57 | 58 | public: 59 | 60 | D3D8Multithread( 61 | BOOL Protected); 62 | 63 | D3D8DeviceLock AcquireLock() { 64 | return m_protected 65 | ? D3D8DeviceLock(m_mutex) 66 | : D3D8DeviceLock(); 67 | } 68 | 69 | private: 70 | 71 | BOOL m_protected; 72 | 73 | sync::RecursiveSpinlock m_mutex; 74 | 75 | }; 76 | 77 | } -------------------------------------------------------------------------------- /src/d3d8/d3d8_options.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "d3d8_include.h" 4 | #include "../d3d9/d3d9_bridge.h" 5 | #include "../util/config/config.h" 6 | 7 | namespace dxvk { 8 | 9 | struct D3D8Options { 10 | 11 | /// Override application vertex shader declarations. 12 | std::vector> forceVsDecl; 13 | 14 | /// Enable/disable the drawcall batcher. 15 | bool batching; 16 | 17 | /// Place all P8 textures in D3DPOOL_SCRATCH. 18 | bool placeP8InScratch; 19 | 20 | /// Ignore D3DLOCK_DISCARD for everything except D3DUSAGE_DYNAMIC + D3DUSAGE_WRITEONLY buffers. 21 | bool forceLegacyDiscard; 22 | 23 | /// Force D3DTTFF_PROJECTED for the necessary stages when a depth texture is bound to slot 0. 24 | bool shadowPerspectiveDivide; 25 | 26 | D3D8Options() {} 27 | 28 | D3D8Options(const Config& config) { 29 | auto forceVsDeclStr = config.getOption("d3d8.forceVsDecl", ""); 30 | batching = config.getOption ("d3d8.batching", false); 31 | placeP8InScratch = config.getOption ("d3d8.placeP8InScratch", false); 32 | forceLegacyDiscard = config.getOption ("d3d8.forceLegacyDiscard", false); 33 | shadowPerspectiveDivide = config.getOption ("d3d8.shadowPerspectiveDivide", false); 34 | 35 | parseVsDecl(forceVsDeclStr); 36 | } 37 | 38 | void parseVsDecl(const std::string& decl); 39 | }; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/d3d8/d3d8_shader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "d3d8_include.h" 4 | #include "d3d8_options.h" 5 | 6 | namespace dxvk { 7 | 8 | struct D3D9VertexShaderCode { 9 | d3d9::D3DVERTEXELEMENT9 declaration[MAXD3DDECLLENGTH + 1]; 10 | std::vector function; 11 | }; 12 | 13 | HRESULT TranslateVertexShader8( 14 | const DWORD* pDeclaration, 15 | const DWORD* pFunction, 16 | const D3D8Options& overrides, 17 | D3D9VertexShaderCode& pTranslatedVS); 18 | 19 | } -------------------------------------------------------------------------------- /src/d3d8/d3d8_surface.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "d3d8_include.h" 4 | #include "d3d8_subresource.h" 5 | 6 | namespace dxvk { 7 | 8 | // Note: IDirect3DSurface8 does not actually inherit from IDirect3DResource8, 9 | // however it does expose serveral of the methods typically found part of 10 | // IDirect3DResource8, such as Set/Get/FreePrivateData, so model it as such. 11 | using D3D8SurfaceBase = D3D8Subresource; 12 | class D3D8Surface final : public D3D8SurfaceBase { 13 | 14 | public: 15 | 16 | D3D8Surface( 17 | D3D8Device* pDevice, 18 | const D3DPOOL Pool, 19 | IDirect3DBaseTexture8* pTexture, 20 | Com&& pSurface); 21 | 22 | D3D8Surface( 23 | D3D8Device* pDevice, 24 | const D3DPOOL Pool, 25 | Com&& pSurface); 26 | 27 | HRESULT STDMETHODCALLTYPE GetDesc(D3DSURFACE_DESC* pDesc) final; 28 | 29 | HRESULT STDMETHODCALLTYPE LockRect( 30 | D3DLOCKED_RECT* pLockedRect, 31 | CONST RECT* pRect, 32 | DWORD Flags) final; 33 | 34 | HRESULT STDMETHODCALLTYPE UnlockRect() final; 35 | 36 | /** 37 | * \brief Allocate or reuse an image of the same size 38 | * as this texture for performing blit into system mem. 39 | */ 40 | Com GetBlitImage(); 41 | 42 | private: 43 | 44 | Com CreateBlitImage(); 45 | 46 | Com m_blitImage; 47 | 48 | }; 49 | 50 | } -------------------------------------------------------------------------------- /src/d3d8/d3d8_swapchain.cpp: -------------------------------------------------------------------------------- 1 | #include "d3d8_swapchain.h" 2 | 3 | namespace dxvk { 4 | 5 | D3D8SwapChain::D3D8SwapChain( 6 | D3D8Device* pDevice, 7 | D3DPRESENT_PARAMETERS* pPresentationParameters, 8 | Com&& pSwapChain) 9 | : D3D8SwapChainBase(pDevice, std::move(pSwapChain)) { 10 | m_backBuffers.resize(pPresentationParameters->BackBufferCount); 11 | } 12 | 13 | HRESULT STDMETHODCALLTYPE D3D8SwapChain::Present(const RECT *src, const RECT *dst, HWND hWnd, const RGNDATA *dirtyRegion) { 14 | return GetD3D9()->Present(src, dst, hWnd, dirtyRegion, 0); 15 | } 16 | 17 | HRESULT STDMETHODCALLTYPE D3D8SwapChain::GetBackBuffer( 18 | UINT BackBuffer, 19 | D3DBACKBUFFER_TYPE Type, 20 | IDirect3DSurface8** ppBackBuffer) { 21 | if (unlikely(ppBackBuffer == nullptr)) 22 | return D3DERR_INVALIDCALL; 23 | 24 | // Same logic as in D3D8Device::GetBackBuffer 25 | if (BackBuffer >= m_backBuffers.size() || m_backBuffers[BackBuffer] == nullptr) { 26 | Com pSurface9; 27 | HRESULT res = GetD3D9()->GetBackBuffer(BackBuffer, (d3d9::D3DBACKBUFFER_TYPE)Type, &pSurface9); 28 | 29 | if (likely(SUCCEEDED(res))) { 30 | m_backBuffers[BackBuffer] = new D3D8Surface(GetParent(), D3DPOOL_DEFAULT, std::move(pSurface9)); 31 | *ppBackBuffer = m_backBuffers[BackBuffer].ref(); 32 | } 33 | 34 | return res; 35 | } 36 | 37 | *ppBackBuffer = m_backBuffers[BackBuffer].ref(); 38 | return D3D_OK; 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /src/d3d8/d3d8_swapchain.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "d3d8_device_child.h" 4 | #include "d3d8_surface.h" 5 | 6 | namespace dxvk { 7 | 8 | using D3D8SwapChainBase = D3D8DeviceChild; 9 | class D3D8SwapChain final : public D3D8SwapChainBase { 10 | 11 | public: 12 | 13 | D3D8SwapChain( 14 | D3D8Device* pDevice, 15 | D3DPRESENT_PARAMETERS* pPresentationParameters, 16 | Com&& pSwapChain); 17 | 18 | HRESULT STDMETHODCALLTYPE Present(const RECT *src, const RECT *dst, HWND hWnd, const RGNDATA *dirtyRegion) final; 19 | 20 | HRESULT STDMETHODCALLTYPE GetBackBuffer( 21 | UINT BackBuffer, 22 | D3DBACKBUFFER_TYPE Type, 23 | IDirect3DSurface8** ppBackBuffer) final; 24 | 25 | private: 26 | 27 | std::vector> m_backBuffers; 28 | 29 | }; 30 | 31 | } -------------------------------------------------------------------------------- /src/d3d8/d3d8_volume.cpp: -------------------------------------------------------------------------------- 1 | #include "d3d8_volume.h" 2 | 3 | #include "d3d8_d3d9_util.h" 4 | 5 | namespace dxvk { 6 | 7 | D3D8Volume::D3D8Volume( 8 | D3D8Device* pDevice, 9 | const D3DPOOL Pool, 10 | IDirect3DVolumeTexture8* pTexture, 11 | Com&& pVolume) 12 | : D3D8VolumeBase(pDevice, Pool, std::move(pVolume), pTexture) { 13 | } 14 | 15 | HRESULT STDMETHODCALLTYPE D3D8Volume::GetDesc(D3DVOLUME_DESC* pDesc) { 16 | if (unlikely(pDesc == nullptr)) 17 | return D3DERR_INVALIDCALL; 18 | 19 | d3d9::D3DVOLUME_DESC desc; 20 | HRESULT res = GetD3D9()->GetDesc(&desc); 21 | 22 | if (likely(SUCCEEDED(res))) 23 | ConvertVolumeDesc8(&desc, pDesc); 24 | 25 | return res; 26 | } 27 | 28 | HRESULT STDMETHODCALLTYPE D3D8Volume::LockBox(D3DLOCKED_BOX* pLockedBox, CONST D3DBOX* pBox, DWORD Flags) { 29 | return GetD3D9()->LockBox( 30 | reinterpret_cast(pLockedBox), 31 | reinterpret_cast(pBox), 32 | Flags 33 | ); 34 | } 35 | 36 | HRESULT STDMETHODCALLTYPE D3D8Volume::UnlockBox() { 37 | return GetD3D9()->UnlockBox(); 38 | } 39 | 40 | } -------------------------------------------------------------------------------- /src/d3d8/d3d8_volume.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "d3d8_subresource.h" 4 | 5 | namespace dxvk { 6 | 7 | using D3D8VolumeBase = D3D8Subresource; 8 | class D3D8Volume final : public D3D8VolumeBase { 9 | 10 | public: 11 | 12 | D3D8Volume( 13 | D3D8Device* pDevice, 14 | const D3DPOOL Pool, 15 | IDirect3DVolumeTexture8* pTexture, 16 | Com&& pVolume); 17 | 18 | HRESULT STDMETHODCALLTYPE GetDesc(D3DVOLUME_DESC* pDesc); 19 | 20 | HRESULT STDMETHODCALLTYPE LockBox(D3DLOCKED_BOX* pLockedBox, CONST D3DBOX* pBox, DWORD Flags) final; 21 | 22 | HRESULT STDMETHODCALLTYPE UnlockBox() final; 23 | 24 | }; 25 | 26 | } -------------------------------------------------------------------------------- /src/d3d8/d3d8_wrapped_object.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "d3d8_include.h" 4 | 5 | namespace dxvk { 6 | 7 | template 8 | class D3D8WrappedObject : public ComObjectClamp { 9 | 10 | public: 11 | 12 | using D3D9 = D3D9Type; 13 | using D3D8 = D3D8Type; 14 | 15 | D3D8WrappedObject(Com&& object) 16 | : m_d3d9(std::move(object)) { 17 | } 18 | 19 | D3D9* GetD3D9() { 20 | return m_d3d9.ptr(); 21 | } 22 | 23 | // For cases where the object may be null. 24 | static D3D9* GetD3D9Nullable(D3D8WrappedObject* self) { 25 | if (unlikely(self == NULL)) { 26 | return NULL; 27 | } 28 | return self->m_d3d9.ptr(); 29 | } 30 | 31 | template 32 | static D3D9* GetD3D9Nullable(Com& self) { 33 | return GetD3D9Nullable(self.ptr()); 34 | } 35 | 36 | virtual IUnknown* GetInterface(REFIID riid) { 37 | if (riid == __uuidof(IUnknown)) 38 | return this; 39 | if (riid == __uuidof(D3D8)) 40 | return this; 41 | 42 | throw DxvkError("D3D8WrappedObject::QueryInterface: Unknown interface query"); 43 | } 44 | 45 | HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject) final { 46 | if (ppvObject == nullptr) 47 | return E_POINTER; 48 | 49 | *ppvObject = nullptr; 50 | 51 | try { 52 | *ppvObject = ref(this->GetInterface(riid)); 53 | return S_OK; 54 | } catch (const DxvkError& e) { 55 | Logger::warn(e.message()); 56 | Logger::warn(str::format(riid)); 57 | return E_NOINTERFACE; 58 | } 59 | } 60 | 61 | private: 62 | 63 | Com m_d3d9; 64 | 65 | }; 66 | 67 | } -------------------------------------------------------------------------------- /src/d3d8/meson.build: -------------------------------------------------------------------------------- 1 | d3d8_res = wrc_generator.process('version.rc') 2 | 3 | d3d8_src = [ 4 | 'd3d8_buffer.cpp', 5 | 'd3d8_device.cpp', 6 | 'd3d8_interface.cpp', 7 | 'd3d8_main.cpp', 8 | 'd3d8_multithread.cpp', 9 | 'd3d8_options.cpp', 10 | 'd3d8_shader.cpp', 11 | 'd3d8_state_block.cpp', 12 | 'd3d8_surface.cpp', 13 | 'd3d8_swapchain.cpp', 14 | 'd3d8_texture.cpp', 15 | 'd3d8_volume.cpp' 16 | ] 17 | 18 | d3d8_ld_args = [] 19 | d3d8_link_depends = [] 20 | 21 | if platform != 'windows' 22 | lib_d3d9 = d3d9_dep 23 | d3d8_ld_args += [ '-Wl,--version-script', join_paths(meson.current_source_dir(), 'd3d8.sym') ] 24 | d3d8_link_depends += files('d3d8.sym') 25 | endif 26 | 27 | d3d8_dll = shared_library(dxvk_name_prefix+'d3d8', d3d8_src, d3d8_res, 28 | dependencies : [ lib_d3d9, util_dep, dxso_dep, dxvk_dep ], 29 | include_directories : dxvk_include_path, 30 | install : true, 31 | vs_module_defs : 'd3d8'+def_spec_ext, 32 | link_args : d3d8_ld_args, 33 | link_depends : [ d3d8_link_depends ], 34 | kwargs : dxvk_so_version, 35 | ) 36 | 37 | d3d8_dep = declare_dependency( 38 | link_with : [ d3d8_dll ], 39 | include_directories : [ dxvk_include_path ], 40 | ) 41 | 42 | if platform != 'windows' 43 | pkg.generate(d3d8_dll, 44 | filebase: dxvk_pkg_prefix + 'd3d8', 45 | subdirs: 'dxvk', 46 | ) 47 | endif 48 | -------------------------------------------------------------------------------- /src/d3d8/version.rc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // DLL version information. 4 | VS_VERSION_INFO VERSIONINFO 5 | FILEVERSION 10,0,17763,1 6 | PRODUCTVERSION 10,0,17763,1 7 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 8 | FILEFLAGS 0 9 | FILEOS VOS_NT_WINDOWS32 10 | FILETYPE VFT_DLL 11 | FILESUBTYPE VFT2_UNKNOWN 12 | BEGIN 13 | BLOCK "StringFileInfo" 14 | BEGIN 15 | BLOCK "080904b0" 16 | BEGIN 17 | VALUE "CompanyName", "DXVK" 18 | VALUE "FileDescription", "Direct3D 8 Runtime" 19 | VALUE "FileVersion", "10.0.17763.1 (WinBuild.160101.0800)" 20 | VALUE "InternalName", "D3D8.dll" 21 | VALUE "LegalCopyright", "zlib/libpng license" 22 | VALUE "OriginalFilename", "D3D8.dll" 23 | VALUE "ProductName", "DXVK" 24 | VALUE "ProductVersion", "10.0.17763.1" 25 | END 26 | END 27 | BLOCK "VarFileInfo" 28 | BEGIN 29 | VALUE "Translation", 0x0809, 1200 30 | END 31 | END 32 | -------------------------------------------------------------------------------- /src/d3d9/d3d9.def: -------------------------------------------------------------------------------- 1 | LIBRARY D3D9.DLL 2 | EXPORTS 3 | Direct3DShaderValidatorCreate9 @24 4 | 5 | PSGPError @25 6 | PSGPSampleTexture @26 7 | 8 | D3DPERF_BeginEvent @27 9 | D3DPERF_EndEvent @28 10 | D3DPERF_GetStatus @29 11 | D3DPERF_QueryRepeatFrame @30 12 | D3DPERF_SetMarker @31 13 | D3DPERF_SetOptions @32 14 | D3DPERF_SetRegion @33 15 | 16 | DebugSetLevel @34 17 | DebugSetMute @35 18 | 19 | Direct3D9EnableMaximizedWindowedModeShim @36 20 | 21 | Direct3DCreate9 @37 22 | Direct3DCreate9Ex @38 23 | 24 | DXVK_RegisterAnnotation @28257 NONAME 25 | DXVK_UnRegisterAnnotation @28258 NONAME 26 | 27 | Direct3D9ForceHybridEnumeration @16 NONAME PRIVATE 28 | 29 | Direct3DCreate9On12 @20 30 | Direct3DCreate9On12Ex @21 31 | -------------------------------------------------------------------------------- /src/d3d9/d3d9.sym: -------------------------------------------------------------------------------- 1 | { 2 | global: 3 | Direct3DCreate9; 4 | Direct3DCreate9Ex; 5 | D3DPERF_BeginEvent; 6 | D3DPERF_EndEvent; 7 | D3DPERF_SetMarker; 8 | D3DPERF_SetRegion; 9 | D3DPERF_QueryRepeatFrame; 10 | D3DPERF_SetOptions; 11 | D3DPERF_GetStatus; 12 | DebugSetMute; 13 | DebugSetLevel; 14 | PSGPError; 15 | PSGPSampleTexture; 16 | Direct3DShaderValidatorCreate9; 17 | Direct3D9EnableMaximizedWindowedModeShim; 18 | DXVK_RegisterAnnotation; 19 | DXVK_UnRegisterAnnotation; 20 | Direct3D9ForceHybridEnumeration; 21 | Direct3DCreate9On12; 22 | Direct3DCreate9On12Ex; 23 | 24 | local: 25 | *; 26 | }; 27 | -------------------------------------------------------------------------------- /src/d3d9/d3d9_caps.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "d3d9_include.h" 4 | 5 | namespace dxvk::caps { 6 | 7 | constexpr uint32_t MaxClipPlanes = 6; 8 | constexpr uint32_t MaxSamplers = 16; 9 | constexpr uint32_t MaxStreams = 16; 10 | constexpr uint32_t MaxSimultaneousTextures = 8; 11 | constexpr uint32_t MaxTextureBlendStages = MaxSimultaneousTextures; 12 | constexpr uint32_t MaxSimultaneousRenderTargets = D3D_MAX_SIMULTANEOUS_RENDERTARGETS; 13 | 14 | constexpr uint32_t MaxFloatConstantsVS = 256; 15 | constexpr uint32_t MaxFloatConstantsPS = 224; 16 | constexpr uint32_t MaxOtherConstants = 16; 17 | constexpr uint32_t MaxFloatConstantsSoftware = 8192; 18 | constexpr uint32_t MaxOtherConstantsSoftware = 2048; 19 | 20 | constexpr uint32_t InputRegisterCount = 16; 21 | 22 | constexpr uint32_t MaxTextureDimension = 16384; 23 | constexpr uint32_t MaxMipLevels = 15; 24 | constexpr uint32_t MaxSubresources = 15 * 6; 25 | 26 | constexpr uint32_t MaxTransforms = 10 + 256; 27 | 28 | constexpr uint32_t TextureStageCount = MaxSimultaneousTextures; 29 | 30 | constexpr uint32_t MaxEnabledLights = 8; 31 | 32 | constexpr uint32_t MaxTexturesVS = 4; 33 | constexpr uint32_t MaxTexturesPS = 16; 34 | 35 | } -------------------------------------------------------------------------------- /src/d3d9/d3d9_constant_layout.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "d3d9_caps.h" 6 | 7 | namespace dxvk { 8 | 9 | struct D3D9ConstantLayout { 10 | uint32_t floatCount; 11 | uint32_t intCount; 12 | uint32_t boolCount; 13 | uint32_t bitmaskCount; 14 | 15 | uint32_t floatSize() const { return floatCount * 4 * sizeof(float); } 16 | uint32_t intSize() const { return intCount * 4 * sizeof(int); } 17 | uint32_t bitmaskSize() const { 18 | // Account for SWVP (non SWVP uses a spec constant) 19 | return bitmaskCount != 1 20 | ? bitmaskCount * 1 * sizeof(uint32_t) 21 | : 0; 22 | } 23 | 24 | uint32_t intOffset() const { return 0; } 25 | uint32_t floatOffset() const { return intOffset() + intSize(); } 26 | uint32_t bitmaskOffset() const { return floatOffset() + floatSize(); } 27 | 28 | uint32_t totalSize() const { return floatSize() + intSize() + bitmaskSize(); } 29 | }; 30 | 31 | } -------------------------------------------------------------------------------- /src/d3d9/d3d9_constant_set.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "d3d9_caps.h" 4 | #include "d3d9_constant_buffer.h" 5 | #include "d3d9_constant_layout.h" 6 | 7 | 8 | #include "../dxso/dxso_isgn.h" 9 | 10 | #include "../util/util_vector.h" 11 | 12 | #include 13 | 14 | namespace dxvk { 15 | 16 | enum class D3D9ConstantType { 17 | Float, 18 | Int, 19 | Bool 20 | }; 21 | 22 | // We make an assumption later based on the packing of this struct for copying. 23 | struct D3D9ShaderConstantsVSSoftware { 24 | Vector4i iConsts[caps::MaxOtherConstantsSoftware]; 25 | Vector4 fConsts[caps::MaxFloatConstantsSoftware]; 26 | uint32_t bConsts[caps::MaxOtherConstantsSoftware / 32]; 27 | }; 28 | 29 | struct D3D9ShaderConstantsVSHardware { 30 | Vector4i iConsts[caps::MaxOtherConstants]; 31 | Vector4 fConsts[caps::MaxFloatConstantsVS]; 32 | uint32_t bConsts[1]; 33 | }; 34 | 35 | struct D3D9ShaderConstantsPS { 36 | Vector4i iConsts[caps::MaxOtherConstants]; 37 | Vector4 fConsts[caps::MaxFloatConstantsPS]; 38 | uint32_t bConsts[1]; 39 | }; 40 | 41 | struct D3D9SwvpConstantBuffers { 42 | D3D9ConstantBuffer intBuffer; 43 | D3D9ConstantBuffer boolBuffer; 44 | }; 45 | 46 | struct D3D9ConstantSets { 47 | D3D9ConstantLayout layout; 48 | D3D9SwvpConstantBuffers swvp; 49 | D3D9ConstantBuffer buffer; 50 | DxsoShaderMetaInfo meta = {}; 51 | bool dirty = true; 52 | uint32_t maxChangedConstF = 0; 53 | uint32_t maxChangedConstI = 0; 54 | uint32_t maxChangedConstB = 0; 55 | }; 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/d3d9/d3d9_format_helpers.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "d3d9_include.h" 4 | #include "d3d9_format.h" 5 | #include "../dxvk/dxvk_device.h" 6 | #include "../dxvk/dxvk_context.h" 7 | 8 | namespace dxvk { 9 | 10 | class D3D9FormatHelper { 11 | 12 | public: 13 | 14 | D3D9FormatHelper(const Rc& device); 15 | 16 | ~D3D9FormatHelper(); 17 | 18 | void Flush(); 19 | 20 | void ConvertFormat( 21 | const Rc& ctx, 22 | D3D9_CONVERSION_FORMAT_INFO conversionFormat, 23 | const Rc& dstImage, 24 | VkImageSubresourceLayers dstSubresource, 25 | const DxvkBufferSlice& srcSlice); 26 | 27 | private: 28 | 29 | void ConvertGenericFormat( 30 | const Rc& ctx, 31 | D3D9_CONVERSION_FORMAT_INFO videoFormat, 32 | const Rc& dstImage, 33 | VkImageSubresourceLayers dstSubresource, 34 | const DxvkBufferSlice& srcSlice, 35 | VkFormat bufferFormat, 36 | VkExtent2D macroPixelRun); 37 | 38 | enum BindingIds : uint32_t { 39 | Image = 0, 40 | Buffer = 1, 41 | }; 42 | 43 | void InitPipelines(); 44 | 45 | const DxvkPipelineLayout* CreatePipelineLayout(); 46 | 47 | VkPipeline CreatePipeline(size_t size, const uint32_t* code, uint32_t specConstant); 48 | 49 | Rc m_device; 50 | 51 | const DxvkPipelineLayout* m_layout = nullptr; 52 | 53 | std::array m_pipelines = { }; 54 | 55 | }; 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/d3d9/d3d9_multithread.cpp: -------------------------------------------------------------------------------- 1 | #include "d3d9_device.h" 2 | 3 | namespace dxvk { 4 | 5 | D3D9Multithread::D3D9Multithread( 6 | BOOL Protected) 7 | : m_protected( Protected ) { } 8 | 9 | } -------------------------------------------------------------------------------- /src/d3d9/d3d9_multithread.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "d3d9_include.h" 4 | 5 | namespace dxvk { 6 | 7 | /** 8 | * \brief Device lock 9 | * 10 | * Lightweight RAII wrapper that implements 11 | * a subset of the functionality provided by 12 | * \c std::unique_lock, with the goal of being 13 | * cheaper to construct and destroy. 14 | */ 15 | class D3D9DeviceLock { 16 | 17 | public: 18 | 19 | D3D9DeviceLock() 20 | : m_mutex(nullptr) { } 21 | 22 | D3D9DeviceLock(sync::RecursiveSpinlock& mutex) 23 | : m_mutex(&mutex) { 24 | mutex.lock(); 25 | } 26 | 27 | D3D9DeviceLock(D3D9DeviceLock&& other) 28 | : m_mutex(other.m_mutex) { 29 | other.m_mutex = nullptr; 30 | } 31 | 32 | D3D9DeviceLock& operator = (D3D9DeviceLock&& other) { 33 | if (m_mutex) 34 | m_mutex->unlock(); 35 | 36 | m_mutex = other.m_mutex; 37 | other.m_mutex = nullptr; 38 | return *this; 39 | } 40 | 41 | ~D3D9DeviceLock() { 42 | if (m_mutex != nullptr) 43 | m_mutex->unlock(); 44 | } 45 | 46 | private: 47 | 48 | sync::RecursiveSpinlock* m_mutex; 49 | 50 | }; 51 | 52 | 53 | /** 54 | * \brief D3D9 context lock 55 | */ 56 | class D3D9Multithread { 57 | 58 | public: 59 | 60 | D3D9Multithread( 61 | BOOL Protected); 62 | 63 | D3D9DeviceLock AcquireLock() { 64 | return m_protected 65 | ? D3D9DeviceLock(m_mutex) 66 | : D3D9DeviceLock(); 67 | } 68 | 69 | private: 70 | 71 | BOOL m_protected; 72 | 73 | sync::RecursiveSpinlock m_mutex; 74 | 75 | }; 76 | 77 | } -------------------------------------------------------------------------------- /src/d3d9/d3d9_names.h: -------------------------------------------------------------------------------- 1 | #include "d3d9_include.h" 2 | 3 | namespace dxvk { 4 | 5 | std::ostream& operator << (std::ostream& os, D3DRENDERSTATETYPE e); 6 | 7 | } -------------------------------------------------------------------------------- /src/d3d9/d3d9_on_12.cpp: -------------------------------------------------------------------------------- 1 | #include "d3d9_on_12.h" 2 | 3 | #include "d3d9_device.h" 4 | 5 | namespace dxvk { 6 | 7 | D3D9On12::D3D9On12(D3D9DeviceEx* device) 8 | : m_device(device) { 9 | 10 | } 11 | 12 | HRESULT STDMETHODCALLTYPE D3D9On12::QueryInterface(REFIID riid, void** object) { 13 | return m_device->QueryInterface(riid, object); 14 | } 15 | ULONG STDMETHODCALLTYPE D3D9On12::AddRef() { 16 | return m_device->AddRef(); 17 | } 18 | ULONG STDMETHODCALLTYPE D3D9On12::Release() { 19 | return m_device->Release(); 20 | } 21 | 22 | HRESULT STDMETHODCALLTYPE D3D9On12::GetD3D12Device(REFIID riid, void** object) { 23 | InitReturnPtr(object); 24 | 25 | Logger::err("D3D9On12::GetD3D12Device: Stub"); 26 | return E_NOINTERFACE; 27 | } 28 | HRESULT STDMETHODCALLTYPE D3D9On12::UnwrapUnderlyingResource(IDirect3DResource9* resource, ID3D12CommandQueue* command_queue, REFIID riid, void** object) { 29 | Logger::err("D3D9On12::GetD3D12Device: UnwrapUnderlyingResource: Stub"); 30 | return E_NOINTERFACE; 31 | } 32 | HRESULT STDMETHODCALLTYPE D3D9On12::ReturnUnderlyingResource(IDirect3DResource9* resource, UINT num_sync, UINT64* signal_values, ID3D12Fence** fences) { 33 | if (num_sync) 34 | Logger::err("D3D9On12::GetD3D12Device: ReturnUnderlyingResource: Stub"); 35 | 36 | m_device->FlushAndSync9On12(); 37 | return S_OK; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/d3d9/d3d9_on_12.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "d3d9_include.h" 4 | 5 | namespace dxvk { 6 | 7 | class D3D9DeviceEx; 8 | 9 | class D3D9On12 final : public IDirect3DDevice9On12 { 10 | 11 | public: 12 | 13 | D3D9On12(D3D9DeviceEx* device); 14 | 15 | HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** object); 16 | ULONG STDMETHODCALLTYPE AddRef(); 17 | ULONG STDMETHODCALLTYPE Release(); 18 | 19 | HRESULT STDMETHODCALLTYPE GetD3D12Device(REFIID riid, void** object); 20 | HRESULT STDMETHODCALLTYPE UnwrapUnderlyingResource(IDirect3DResource9* resource, ID3D12CommandQueue* command_queue, REFIID riid, void** object); 21 | HRESULT STDMETHODCALLTYPE ReturnUnderlyingResource(IDirect3DResource9* resource, UINT num_sync, UINT64* signal_values, ID3D12Fence** fences); 22 | 23 | private: 24 | 25 | D3D9DeviceEx* m_device; 26 | 27 | }; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/d3d9/d3d9_state.cpp: -------------------------------------------------------------------------------- 1 | #include "d3d9_state.h" 2 | 3 | #include "d3d9_texture.h" 4 | 5 | namespace dxvk { 6 | 7 | template