diff --git a/gfx/drivers/d3d11.c b/gfx/drivers/d3d11.c index e4375a05ef..a63251f304 100644 --- a/gfx/drivers/d3d11.c +++ b/gfx/drivers/d3d11.c @@ -37,9 +37,10 @@ static void d3d11_set_filtering(void* data, unsigned index, bool smooth) { + unsigned i; d3d11_video_t* d3d11 = (d3d11_video_t*)data; - for (int i = 0; i < RARCH_WRAP_MAX; i++) + for (i = 0; i < RARCH_WRAP_MAX; i++) { if (smooth) d3d11->samplers[RARCH_FILTER_UNSPEC][i] = d3d11->samplers[RARCH_FILTER_LINEAR][i]; @@ -93,11 +94,14 @@ static void d3d11_update_viewport(void* data, bool force_full) static void d3d11_free_shader_preset(d3d11_video_t* d3d11) { + unsigned i; if (!d3d11->shader_preset) return; - for (int i = 0; i < d3d11->shader_preset->passes; i++) + for (i = 0; i < d3d11->shader_preset->passes; i++) { + unsigned j; + free(d3d11->shader_preset->pass[i].source.string.vertex); free(d3d11->shader_preset->pass[i].source.string.fragment); free(d3d11->pass[i].semantics.textures); @@ -105,7 +109,7 @@ static void d3d11_free_shader_preset(d3d11_video_t* d3d11) d3d11_release_texture(&d3d11->pass[i].rt); d3d11_release_texture(&d3d11->pass[i].feedback); - for (int j = 0; j < SLANG_CBUFFER_MAX; j++) + for (j = 0; j < SLANG_CBUFFER_MAX; j++) { free(d3d11->pass[i].semantics.cbuffers[j].uniforms); Release(d3d11->pass[i].buffers[j]); @@ -114,7 +118,7 @@ static void d3d11_free_shader_preset(d3d11_video_t* d3d11) memset(d3d11->pass, 0, sizeof(d3d11->pass)); - for (int i = 0; i < d3d11->shader_preset->luts; i++) + for (i = 0; i < d3d11->shader_preset->luts; i++) d3d11_release_texture(&d3d11->luts[i]); memset(d3d11->luts, 0, sizeof(d3d11->luts)); @@ -125,7 +129,10 @@ static void d3d11_free_shader_preset(d3d11_video_t* d3d11) static bool d3d11_gfx_set_shader(void* data, enum rarch_shader_type type, const char* path) { - d3d11_video_t* d3d11 = (d3d11_video_t*)data; + unsigned i, j; + config_file_t *conf = NULL; + d3d11_texture_t *source = NULL; + d3d11_video_t *d3d11 = (d3d11_video_t*)data; if (!d3d11) return false; @@ -144,7 +151,7 @@ static bool d3d11_gfx_set_shader(void* data, enum rarch_shader_type type, const return false; } - config_file_t* conf = config_file_new(path); + conf = config_file_new(path); if (!conf) return false; @@ -156,75 +163,74 @@ static bool d3d11_gfx_set_shader(void* data, enum rarch_shader_type type, const video_shader_resolve_relative(d3d11->shader_preset, path); - d3d11_texture_t* source = &d3d11->frame.texture; - for (int i = 0; i < d3d11->shader_preset->passes; i++) + source = &d3d11->frame.texture; + + for (i = 0; i < d3d11->shader_preset->passes; i++) { + /* no history support yet */ + texture_map_t texture_map[3 + GFX_MAX_SHADERS * 2 + GFX_MAX_TEXTURES + 1] = { + SL_TEXTURE_MAP( + SLANG_TEXTURE_SEMANTIC_ORIGINAL, d3d11->frame.texture.view, + d3d11->pass[i].sampler, d3d11->frame.texture.size_data), + SL_TEXTURE_MAP( + SLANG_TEXTURE_SEMANTIC_SOURCE, source->view, d3d11->pass[i].sampler, + source->size_data), + SL_TEXTURE_MAP( + SLANG_TEXTURE_SEMANTIC_ORIGINAL_HISTORY, d3d11->frame.texture.view, + d3d11->pass[i].sampler, d3d11->frame.texture.size_data), + }; + { - /* no history support yet */ - texture_map_t texture_map[3 + GFX_MAX_SHADERS * 2 + GFX_MAX_TEXTURES + 1] = { - SL_TEXTURE_MAP( - SLANG_TEXTURE_SEMANTIC_ORIGINAL, d3d11->frame.texture.view, - d3d11->pass[i].sampler, d3d11->frame.texture.size_data), - SL_TEXTURE_MAP( - SLANG_TEXTURE_SEMANTIC_SOURCE, source->view, d3d11->pass[i].sampler, - source->size_data), - SL_TEXTURE_MAP( - SLANG_TEXTURE_SEMANTIC_ORIGINAL_HISTORY, d3d11->frame.texture.view, - d3d11->pass[i].sampler, d3d11->frame.texture.size_data), - }; + texture_map_t* ptr = texture_map; + while (ptr->texture_data) + ptr++; + for (j = 0; j < i; j++) { - texture_map_t* ptr = texture_map; - while (ptr->texture_data) - ptr++; - - for (int j = 0; j < i; j++) - { - *ptr = (texture_map_t)SL_TEXTURE_MAP_ARRAY( - SLANG_TEXTURE_SEMANTIC_PASS_OUTPUT, j, d3d11->pass[j].rt.view, - d3d11->pass[i].sampler, d3d11->pass[j].rt.size_data); - ptr++; - } - - for (int j = 0; j < GFX_MAX_SHADERS; j++) - { - *ptr = (texture_map_t)SL_TEXTURE_MAP_ARRAY( - SLANG_TEXTURE_SEMANTIC_PASS_FEEDBACK, j, d3d11->pass[j].feedback.view, - d3d11->pass[i].sampler, d3d11->pass[j].rt.size_data); - ptr++; - } - - for (int j = 0; j < d3d11->shader_preset->luts; j++) - { - *ptr = (texture_map_t)SL_TEXTURE_MAP_ARRAY( - SLANG_TEXTURE_SEMANTIC_USER, j, d3d11->luts[j].view, d3d11->luts[j].sampler, - d3d11->luts[j].size_data); - ptr++; - } + *ptr = (texture_map_t)SL_TEXTURE_MAP_ARRAY( + SLANG_TEXTURE_SEMANTIC_PASS_OUTPUT, j, d3d11->pass[j].rt.view, + d3d11->pass[i].sampler, d3d11->pass[j].rt.size_data); + ptr++; } - uniform_map_t uniform_map[] = { - SL_UNIFORM_MAP(SLANG_SEMANTIC_MVP, d3d11->mvp), - SL_UNIFORM_MAP(SLANG_SEMANTIC_OUTPUT, d3d11->pass[i].rt.size_data), - SL_UNIFORM_MAP(SLANG_SEMANTIC_FRAME_COUNT, d3d11->pass[i].frame_count), - SL_UNIFORM_MAP(SLANG_SEMANTIC_FINAL_VIEWPORT, d3d11->frame.output_size), - { 0 } - }; + for (j = 0; j < GFX_MAX_SHADERS; j++) + { + *ptr = (texture_map_t)SL_TEXTURE_MAP_ARRAY( + SLANG_TEXTURE_SEMANTIC_PASS_FEEDBACK, j, d3d11->pass[j].feedback.view, + d3d11->pass[i].sampler, d3d11->pass[j].rt.size_data); + ptr++; + } - semantics_map_t semantics_map = { texture_map, uniform_map }; - - if (!slang_process( - d3d11->shader_preset, i, RARCH_SHADER_HLSL, 50, &semantics_map, - &d3d11->pass[i].semantics)) - goto error; + for (j = 0; j < d3d11->shader_preset->luts; j++) + { + *ptr = (texture_map_t)SL_TEXTURE_MAP_ARRAY( + SLANG_TEXTURE_SEMANTIC_USER, j, d3d11->luts[j].view, d3d11->luts[j].sampler, + d3d11->luts[j].size_data); + ptr++; + } } + uniform_map_t uniform_map[] = { + SL_UNIFORM_MAP(SLANG_SEMANTIC_MVP, d3d11->mvp), + SL_UNIFORM_MAP(SLANG_SEMANTIC_OUTPUT, d3d11->pass[i].rt.size_data), + SL_UNIFORM_MAP(SLANG_SEMANTIC_FRAME_COUNT, d3d11->pass[i].frame_count), + SL_UNIFORM_MAP(SLANG_SEMANTIC_FINAL_VIEWPORT, d3d11->frame.output_size), + { 0 } + }; + + semantics_map_t semantics_map = { texture_map, uniform_map }; + + if (!slang_process( + d3d11->shader_preset, i, RARCH_SHADER_HLSL, 50, &semantics_map, + &d3d11->pass[i].semantics)) + goto error; + { static const D3D11_INPUT_ELEMENT_DESC desc[] = { { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d11_vertex_t, position), - D3D11_INPUT_PER_VERTEX_DATA, 0 }, + D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "TEXCOORD", 1, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d11_vertex_t, texcoord), - D3D11_INPUT_PER_VERTEX_DATA, 0 }, + D3D11_INPUT_PER_VERTEX_DATA, 0 }, }; #ifdef DEBUG bool save_hlsl = true; @@ -249,13 +255,13 @@ static bool d3d11_gfx_set_shader(void* data, enum rarch_shader_type type, const strncpy(ps_path + base_len, ps_ext, sizeof(ps_ext)); if (!d3d11_init_shader( - d3d11->device, vs_src, 0, vs_path, "main", NULL, NULL, desc, countof(desc), - &d3d11->pass[i].shader)) + d3d11->device, vs_src, 0, vs_path, "main", NULL, NULL, desc, countof(desc), + &d3d11->pass[i].shader)) save_hlsl = true; if (!d3d11_init_shader( - d3d11->device, ps_src, 0, ps_path, NULL, "main", NULL, NULL, 0, - &d3d11->pass[i].shader)) + d3d11->device, ps_src, 0, ps_path, NULL, "main", NULL, NULL, 0, + &d3d11->pass[i].shader)) save_hlsl = true; if (save_hlsl) @@ -279,7 +285,7 @@ static bool d3d11_gfx_set_shader(void* data, enum rarch_shader_type type, const goto error; } - for (int j = 0; j < SLANG_CBUFFER_MAX; j++) + for (j = 0; j < SLANG_CBUFFER_MAX; j++) { D3D11_BUFFER_DESC desc = { .ByteWidth = d3d11->pass[i].semantics.cbuffers[j].size, @@ -291,13 +297,14 @@ static bool d3d11_gfx_set_shader(void* data, enum rarch_shader_type type, const if (!desc.ByteWidth) continue; - D3D11CreateBuffer(d3d11->device, &desc, NULL, &d3d11->pass[i].buffers[j]); + D3D11CreateBuffer(d3d11->device, &desc, NULL, + &d3d11->pass[i].buffers[j]); } source = &d3d11->pass[i].rt; } - for (int i = 0; i < d3d11->shader_preset->luts; i++) + for (i = 0; i < d3d11->shader_preset->luts; i++) { struct texture_image image = { 0 }; image.supports_rgba = true; @@ -314,13 +321,15 @@ static bool d3d11_gfx_set_shader(void* data, enum rarch_shader_type type, const d3d11_init_texture(d3d11->device, &d3d11->luts[i]); d3d11_update_texture( - d3d11->ctx, image.width, image.height, 0, DXGI_FORMAT_R8G8B8A8_UNORM, image.pixels, + d3d11->ctx, image.width, image.height, 0, + DXGI_FORMAT_R8G8B8A8_UNORM, image.pixels, &d3d11->luts[i]); image_texture_free(&image); d3d11->luts[i].sampler = - d3d11->samplers[d3d11->shader_preset->lut[i].filter][d3d11->shader_preset->lut[i].wrap]; + d3d11->samplers[d3d11->shader_preset->lut[i].filter] + [d3d11->shader_preset->lut[i].wrap]; } video_shader_resolve_current_parameters(conf, d3d11->shader_preset); @@ -335,6 +344,7 @@ error: static void d3d11_gfx_free(void* data) { + unsigned i; d3d11_video_t* d3d11 = (d3d11_video_t*)data; if (!d3d11) @@ -369,7 +379,7 @@ static void d3d11_gfx_free(void* data) Release(d3d11->blend_enable); Release(d3d11->blend_disable); - for (int i = 0; i < RARCH_WRAP_MAX; i++) + for (i = 0; i < RARCH_WRAP_MAX; i++) { Release(d3d11->samplers[RARCH_FILTER_LINEAR][i]); Release(d3d11->samplers[RARCH_FILTER_NEAREST][i]); @@ -389,12 +399,13 @@ static void d3d11_gfx_free(void* data) free(d3d11); } -static void* -d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** input_data) +static void *d3d11_gfx_init(const video_info_t* video, + const input_driver_t **input, void **input_data) { - WNDCLASSEX wndclass = { 0 }; + unsigned i; MONITORINFOEX current_mon; HMONITOR hm_to_use; + WNDCLASSEX wndclass = { 0 }; settings_t* settings = config_get_ptr(); d3d11_video_t* d3d11 = (d3d11_video_t*)calloc(1, sizeof(*d3d11)); @@ -452,8 +463,10 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i #endif D3D11CreateDeviceAndSwapChain( - NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, flags, &requested_feature_level, 1, - D3D11_SDK_VERSION, &desc, (IDXGISwapChain**)&d3d11->swapChain, &d3d11->device, + NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, flags, + &requested_feature_level, 1, + D3D11_SDK_VERSION, &desc, + (IDXGISwapChain**)&d3d11->swapChain, &d3d11->device, &d3d11->supportedFeatureLevel, &d3d11->ctx); } @@ -472,7 +485,8 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i d3d11->viewport.Height = d3d11->vp.full_height; d3d11->resize_viewport = true; d3d11->vsync = video->vsync; - d3d11->format = video->rgb32 ? DXGI_FORMAT_B8G8R8X8_UNORM : DXGI_FORMAT_B5G6R5_UNORM; + d3d11->format = video->rgb32 ? + DXGI_FORMAT_B8G8R8X8_UNORM : DXGI_FORMAT_B5G6R5_UNORM; d3d11->frame.texture.desc.Format = d3d11->format; d3d11->frame.texture.desc.Usage = D3D11_USAGE_DEFAULT; @@ -505,8 +519,9 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i .MinLOD = -D3D11_FLOAT32_MAX, .MaxLOD = D3D11_FLOAT32_MAX, }; + /* Initialize samplers */ - for (int i = 0; i < RARCH_WRAP_MAX; i++) + for (i = 0; i < RARCH_WRAP_MAX; i++) { switch (i) { @@ -530,10 +545,12 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i desc.AddressW = desc.AddressU; desc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR; - D3D11CreateSamplerState(d3d11->device, &desc, &d3d11->samplers[RARCH_FILTER_LINEAR][i]); + D3D11CreateSamplerState(d3d11->device, &desc, + &d3d11->samplers[RARCH_FILTER_LINEAR][i]); desc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT; - D3D11CreateSamplerState(d3d11->device, &desc, &d3d11->samplers[RARCH_FILTER_NEAREST][i]); + D3D11CreateSamplerState(d3d11->device, &desc, + &d3d11->samplers[RARCH_FILTER_NEAREST][i]); } } @@ -546,23 +563,21 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i { { 1.0f, 0.0f }, { 1.0f, 1.0f }, { 1.0f, 1.0f, 1.0f, 1.0f } }, { { 1.0f, 1.0f }, { 1.0f, 0.0f }, { 1.0f, 1.0f, 1.0f, 1.0f } }, }; + D3D11_BUFFER_DESC desc = { + .Usage = D3D11_USAGE_IMMUTABLE, + .ByteWidth = sizeof(vertices), + .BindFlags = D3D11_BIND_VERTEX_BUFFER, + }; + D3D11_SUBRESOURCE_DATA vertexData = { vertices }; - { - D3D11_BUFFER_DESC desc = { - .Usage = D3D11_USAGE_IMMUTABLE, - .ByteWidth = sizeof(vertices), - .BindFlags = D3D11_BIND_VERTEX_BUFFER, - }; - D3D11_SUBRESOURCE_DATA vertexData = { vertices }; - D3D11CreateBuffer(d3d11->device, &desc, &vertexData, &d3d11->frame.vbo); - desc.Usage = D3D11_USAGE_DYNAMIC; - desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; - D3D11CreateBuffer(d3d11->device, &desc, &vertexData, &d3d11->menu.vbo); + D3D11CreateBuffer(d3d11->device, &desc, &vertexData, &d3d11->frame.vbo); + desc.Usage = D3D11_USAGE_DYNAMIC; + desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + D3D11CreateBuffer(d3d11->device, &desc, &vertexData, &d3d11->menu.vbo); - d3d11->sprites.capacity = 4096; - desc.ByteWidth = sizeof(d3d11_sprite_t) * d3d11->sprites.capacity; - D3D11CreateBuffer(d3d11->device, &desc, NULL, &d3d11->sprites.vbo); - } + d3d11->sprites.capacity = 4096; + desc.ByteWidth = sizeof(d3d11_sprite_t) * d3d11->sprites.capacity; + D3D11CreateBuffer(d3d11->device, &desc, NULL, &d3d11->sprites.vbo); } { @@ -697,14 +712,17 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i D3D11_COLOR_WRITE_ENABLE_ALL, }, }; - D3D11CreateBlendState(d3d11->device, &blend_desc, &d3d11->blend_enable); + D3D11CreateBlendState(d3d11->device, &blend_desc, + &d3d11->blend_enable); blend_desc.RenderTarget[0].SrcBlend = D3D11_BLEND_ONE; blend_desc.RenderTarget[0].DestBlend = D3D11_BLEND_ONE; - D3D11CreateBlendState(d3d11->device, &blend_desc, &d3d11->blend_pipeline); + D3D11CreateBlendState(d3d11->device, &blend_desc, + &d3d11->blend_pipeline); blend_desc.RenderTarget[0].BlendEnable = FALSE; - D3D11CreateBlendState(d3d11->device, &blend_desc, &d3d11->blend_disable); + D3D11CreateBlendState(d3d11->device, &blend_desc, + &d3d11->blend_disable); } { D3D11_RASTERIZER_DESC desc = { @@ -715,14 +733,16 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i } D3D11SetState(d3d11->ctx, d3d11->state); - font_driver_init_osd(d3d11, false, video->is_threaded, FONT_DRIVER_RENDER_D3D11_API); + font_driver_init_osd(d3d11, false, video->is_threaded, + FONT_DRIVER_RENDER_D3D11_API); if (settings->bools.video_shader_enable) { const char* ext = path_get_extension(settings->paths.path_shader); if (ext && !strncmp(ext, "slang", 5)) - d3d11_gfx_set_shader(d3d11, RARCH_SHADER_SLANG, settings->paths.path_shader); + d3d11_gfx_set_shader(d3d11, RARCH_SHADER_SLANG, + settings->paths.path_shader); } return d3d11; @@ -731,11 +751,15 @@ error: d3d11_gfx_free(d3d11); return NULL; } -static bool d3d11_init_frame_textures(d3d11_video_t* d3d11, unsigned width, unsigned height) + +static bool d3d11_init_frame_textures(d3d11_video_t *d3d11, + unsigned width, unsigned height) { + unsigned i; + if (d3d11->shader_preset) { - for (int i = 0; i < d3d11->shader_preset->passes; i++) + for (i = 0; i < d3d11->shader_preset->passes; i++) { d3d11_release_texture(&d3d11->pass[i].rt); memset(&d3d11->pass[i].rt, 0x00, sizeof(d3d11->pass[i].rt)); @@ -748,7 +772,7 @@ static bool d3d11_init_frame_textures(d3d11_video_t* d3d11, unsigned width, unsi if (d3d11->shader_preset) { - for (int i = 0; i < d3d11->shader_preset->passes; i++) + for (i = 0; i < d3d11->shader_preset->passes; i++) { struct video_shader_pass* pass = &d3d11->shader_preset->pass[i]; @@ -803,14 +827,17 @@ static bool d3d11_init_frame_textures(d3d11_video_t* d3d11, unsigned width, unsi height = d3d11->vp.height; } - RARCH_LOG("[D3D11]: Updating framebuffer size %u x %u.\n", width, height); + RARCH_LOG("[D3D11]: Updating framebuffer size %u x %u.\n", + width, height); /* TODO: maybe use double buffering and grap the swapchain view * instead when pass->feedback == true for the last pass ? * (unless last pass is invalid anyway as a feedback source) */ - if ((i != (d3d11->shader_preset->passes - 1)) || (width != d3d11->vp.width) || - (height != d3d11->vp.height) || pass->feedback) + if ( (i != (d3d11->shader_preset->passes - 1)) || + (width != d3d11->vp.width) || + (height != d3d11->vp.height) || + pass->feedback) { d3d11->pass[i].viewport.Width = width; d3d11->pass[i].viewport.Height = height; @@ -818,7 +845,8 @@ static bool d3d11_init_frame_textures(d3d11_video_t* d3d11, unsigned width, unsi d3d11->pass[i].rt.desc.Width = width; d3d11->pass[i].rt.desc.Height = height; d3d11->pass[i].rt.desc.BindFlags = D3D11_BIND_RENDER_TARGET; - d3d11->pass[i].rt.desc.Format = glslang_format_to_dxgi(d3d11->pass[i].semantics.format); + d3d11->pass[i].rt.desc.Format = glslang_format_to_dxgi( + d3d11->pass[i].semantics.format); d3d11_init_texture(d3d11->device, &d3d11->pass[i].rt); if (pass->feedback) @@ -859,6 +887,7 @@ static bool d3d11_gfx_frame( const char* msg, video_frame_info_t* video_info) { + unsigned i; d3d11_video_t* d3d11 = (d3d11_video_t*)data; if (d3d11->resize_chain) @@ -888,33 +917,40 @@ static bool d3d11_gfx_frame( PERF_START(); -#if 0 /* custom viewport doesn't call apply_state_changes, so we can't rely on this for now */ + /* custom viewport doesn't call apply_state_changes, + * so we can't rely on this for now */ +#if 0 if (d3d11->resize_viewport) #endif d3d11_update_viewport(d3d11, false); - D3D11SetPrimitiveTopology(d3d11->ctx, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); + D3D11SetPrimitiveTopology(d3d11->ctx, + D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); if (frame && width && height) { - if (d3d11->frame.texture.desc.Width != width || d3d11->frame.texture.desc.Height != height) + if ( d3d11->frame.texture.desc.Width != width || + d3d11->frame.texture.desc.Height != height) d3d11->resize_fbos = true; if (d3d11->resize_fbos) d3d11_init_frame_textures(d3d11, width, height); d3d11_update_texture( - d3d11->ctx, width, height, pitch, d3d11->format, frame, &d3d11->frame.texture); + d3d11->ctx, width, height, pitch, d3d11->format, + frame, &d3d11->frame.texture); } - D3D11SetVertexBuffer(d3d11->ctx, 0, d3d11->frame.vbo, sizeof(d3d11_vertex_t), 0); - D3D11SetBlendState(d3d11->ctx, d3d11->blend_disable, NULL, D3D11_DEFAULT_SAMPLE_MASK); + D3D11SetVertexBuffer(d3d11->ctx, 0, d3d11->frame.vbo, + sizeof(d3d11_vertex_t), 0); + D3D11SetBlendState(d3d11->ctx, d3d11->blend_disable, NULL, + D3D11_DEFAULT_SAMPLE_MASK); d3d11_texture_t* texture = &d3d11->frame.texture; if (d3d11->shader_preset) { - for (int i = 0; i < d3d11->shader_preset->passes; i++) + for (i = 0; i < d3d11->shader_preset->passes; i++) { if (d3d11->shader_preset->pass[i].feedback) { @@ -924,21 +960,22 @@ static bool d3d11_gfx_frame( } } - for (int i = 0; i < d3d11->shader_preset->passes; i++) + for (i = 0; i < d3d11->shader_preset->passes; i++) { + unsigned j; + texture_sem_t* texture_sem = d3d11->pass[i].semantics.textures; + + while (texture_sem->stage_mask) { - texture_sem_t* texture_sem = d3d11->pass[i].semantics.textures; + D3D11ShaderResourceView view = *(D3D11ShaderResourceView*) + texture_sem->texture_data; + D3D11SamplerStateRef sampler = *(D3D11SamplerStateRef*) + texture_sem->sampler_data; - while (texture_sem->stage_mask) - { - D3D11ShaderResourceView view = *(D3D11ShaderResourceView*)texture_sem->texture_data; - D3D11SamplerStateRef sampler = *(D3D11SamplerStateRef*)texture_sem->sampler_data; + d3d11->pass[i].textures[texture_sem->binding] = view; + d3d11->pass[i].samplers[texture_sem->binding] = sampler; - d3d11->pass[i].textures[texture_sem->binding] = view; - d3d11->pass[i].samplers[texture_sem->binding] = sampler; - - texture_sem++; - } + texture_sem++; } if (d3d11->shader_preset->pass[i].frame_count_mod) @@ -947,7 +984,7 @@ static bool d3d11_gfx_frame( else d3d11->pass[i].frame_count = frame_count; - for (int j = 0; j < SLANG_CBUFFER_MAX; j++) + for (j = 0; j < SLANG_CBUFFER_MAX; j++) { D3D11Buffer buffer = d3d11->pass[i].buffers[j]; cbuffer_sem_t* buffer_sem = &d3d11->pass[i].semantics.cbuffers[j]; @@ -957,20 +994,25 @@ static bool d3d11_gfx_frame( D3D11_MAPPED_SUBRESOURCE res; uniform_sem_t* uniform = buffer_sem->uniforms; - D3D11MapBuffer(d3d11->ctx, buffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + D3D11MapBuffer(d3d11->ctx, buffer, 0, + D3D11_MAP_WRITE_DISCARD, 0, &res); + while (uniform->size) { if (uniform->data) - memcpy((uint8_t*)res.pData + uniform->offset, uniform->data, uniform->size); + memcpy((uint8_t*)res.pData + uniform->offset, + uniform->data, uniform->size); uniform++; } D3D11UnmapBuffer(d3d11->ctx, buffer, 0); if (buffer_sem->stage_mask & SLANG_STAGE_VERTEX_MASK) - D3D11SetVShaderConstantBuffers(d3d11->ctx, buffer_sem->binding, 1, &buffer); + D3D11SetVShaderConstantBuffers(d3d11->ctx, + buffer_sem->binding, 1, &buffer); if (buffer_sem->stage_mask & SLANG_STAGE_FRAGMENT_MASK) - D3D11SetPShaderConstantBuffers(d3d11->ctx, buffer_sem->binding, 1, &buffer); + D3D11SetPShaderConstantBuffers(d3d11->ctx, + buffer_sem->binding, 1, &buffer); } } @@ -978,13 +1020,17 @@ static bool d3d11_gfx_frame( D3D11RenderTargetView null_rt = NULL; D3D11SetRenderTargets(d3d11->ctx, 1, &null_rt, NULL); - D3D11SetPShaderResources(d3d11->ctx, 0, SLANG_NUM_BINDINGS, d3d11->pass[i].textures); - D3D11SetPShaderSamplers(d3d11->ctx, 0, SLANG_NUM_BINDINGS, d3d11->pass[i].samplers); + D3D11SetPShaderResources(d3d11->ctx, 0, SLANG_NUM_BINDINGS, + (ID3D11ShaderResourceView * const*)d3d11->pass[i].textures); + D3D11SetPShaderSamplers(d3d11->ctx, 0, SLANG_NUM_BINDINGS, + d3d11->pass[i].samplers); if (d3d11->pass[i].rt.handle) { - D3D11SetRenderTargets(d3d11->ctx, 1, &d3d11->pass[i].rt.rt_view, NULL); - D3D11ClearRenderTargetView(d3d11->ctx, d3d11->pass[i].rt.rt_view, d3d11->clearcolor); + D3D11SetRenderTargets(d3d11->ctx, 1, + &d3d11->pass[i].rt.rt_view, NULL); + D3D11ClearRenderTargetView(d3d11->ctx, + d3d11->pass[i].rt.rt_view, d3d11->clearcolor); D3D11SetViewports(d3d11->ctx, 1, &d3d11->pass[i].viewport); D3D11Draw(d3d11->ctx, 4, 0); @@ -1004,24 +1050,30 @@ static bool d3d11_gfx_frame( d3d11_set_shader(d3d11->ctx, &d3d11->shaders[VIDEO_SHADER_STOCK_BLEND]); D3D11SetPShaderResources(d3d11->ctx, 0, 1, &texture->view); D3D11SetPShaderSamplers( - d3d11->ctx, 0, 1, &d3d11->samplers[RARCH_FILTER_UNSPEC][RARCH_WRAP_DEFAULT]); + d3d11->ctx, 0, 1, + (const ID3D11SamplerState**) + &d3d11->samplers[RARCH_FILTER_UNSPEC][RARCH_WRAP_DEFAULT]); D3D11SetVShaderConstantBuffers(d3d11->ctx, 0, 1, &d3d11->frame.ubo); } - D3D11ClearRenderTargetView(d3d11->ctx, d3d11->renderTargetView, d3d11->clearcolor); + D3D11ClearRenderTargetView(d3d11->ctx, + d3d11->renderTargetView, d3d11->clearcolor); D3D11SetViewports(d3d11->ctx, 1, &d3d11->frame.viewport); D3D11Draw(d3d11->ctx, 4, 0); - D3D11SetBlendState(d3d11->ctx, d3d11->blend_enable, NULL, D3D11_DEFAULT_SAMPLE_MASK); + D3D11SetBlendState(d3d11->ctx, d3d11->blend_enable, + NULL, D3D11_DEFAULT_SAMPLE_MASK); if (d3d11->menu.enabled && d3d11->menu.texture.handle) { if (d3d11->menu.fullscreen) D3D11SetViewports(d3d11->ctx, 1, &d3d11->viewport); - d3d11_set_shader(d3d11->ctx, &d3d11->shaders[VIDEO_SHADER_STOCK_BLEND]); - D3D11SetVertexBuffer(d3d11->ctx, 0, d3d11->menu.vbo, sizeof(d3d11_vertex_t), 0); + d3d11_set_shader(d3d11->ctx, + &d3d11->shaders[VIDEO_SHADER_STOCK_BLEND]); + D3D11SetVertexBuffer(d3d11->ctx, 0, + d3d11->menu.vbo, sizeof(d3d11_vertex_t), 0); D3D11SetVShaderConstantBuffers(d3d11->ctx, 0, 1, &d3d11->ubo); d3d11_set_texture_and_sampler(d3d11->ctx, 0, &d3d11->menu.texture); D3D11Draw(d3d11->ctx, 4, 0); @@ -1030,8 +1082,10 @@ static bool d3d11_gfx_frame( D3D11SetViewports(d3d11->ctx, 1, &d3d11->viewport); d3d11_set_shader(d3d11->ctx, &d3d11->sprites.shader); - D3D11SetPrimitiveTopology(d3d11->ctx, D3D11_PRIMITIVE_TOPOLOGY_POINTLIST); - D3D11SetVertexBuffer(d3d11->ctx, 0, d3d11->sprites.vbo, sizeof(d3d11_sprite_t), 0); + D3D11SetPrimitiveTopology(d3d11->ctx, + D3D11_PRIMITIVE_TOPOLOGY_POINTLIST); + D3D11SetVertexBuffer(d3d11->ctx, 0, d3d11->sprites.vbo, + sizeof(d3d11_sprite_t), 0); D3D11SetVShaderConstantBuffer(d3d11->ctx, 0, d3d11->ubo); D3D11SetPShaderConstantBuffer(d3d11->ctx, 0, d3d11->ubo); @@ -1068,15 +1122,22 @@ static bool d3d11_gfx_alive(void* data) bool quit; d3d11_video_t* d3d11 = (d3d11_video_t*)data; - win32_check_window(&quit, &d3d11->resize_chain, &d3d11->vp.full_width, &d3d11->vp.full_height); + win32_check_window(&quit, &d3d11->resize_chain, + &d3d11->vp.full_width, &d3d11->vp.full_height); - if (d3d11->resize_chain && d3d11->vp.full_width != 0 && d3d11->vp.full_height != 0) + if ( d3d11->resize_chain && + (d3d11->vp.full_width != 0) && + (d3d11->vp.full_height != 0) + ) video_driver_set_size(&d3d11->vp.full_width, &d3d11->vp.full_height); return !quit; } -static bool d3d11_gfx_focus(void* data) { return win32_has_focus(); } +static bool d3d11_gfx_focus(void* data) +{ + return win32_has_focus(); +} static bool d3d11_gfx_suppress_screensaver(void* data, bool enable) { @@ -1108,7 +1169,8 @@ static void d3d11_gfx_viewport_info(void* data, struct video_viewport* vp) *vp = d3d11->vp; } -static bool d3d11_gfx_read_viewport(void* data, uint8_t* buffer, bool is_idle) +static bool d3d11_gfx_read_viewport(void* data, + uint8_t* buffer, bool is_idle) { (void)data; (void)buffer; @@ -1117,12 +1179,16 @@ static bool d3d11_gfx_read_viewport(void* data, uint8_t* buffer, bool is_idle) } static void d3d11_set_menu_texture_frame( - void* data, const void* frame, bool rgb32, unsigned width, unsigned height, float alpha) + void* data, const void* frame, bool rgb32, + unsigned width, unsigned height, float alpha) { d3d11_video_t* d3d11 = (d3d11_video_t*)data; - DXGI_FORMAT format = rgb32 ? DXGI_FORMAT_B8G8R8A8_UNORM : DXGI_FORMAT_EX_A4R4G4B4_UNORM; + DXGI_FORMAT format = rgb32 ? + DXGI_FORMAT_B8G8R8A8_UNORM : DXGI_FORMAT_EX_A4R4G4B4_UNORM; - if (d3d11->menu.texture.desc.Width != width || d3d11->menu.texture.desc.Height != height) + if ( + d3d11->menu.texture.desc.Width != width || + d3d11->menu.texture.desc.Height != height) { d3d11->menu.texture.desc.Format = format; d3d11->menu.texture.desc.Width = width; @@ -1130,14 +1196,16 @@ static void d3d11_set_menu_texture_frame( d3d11_init_texture(d3d11->device, &d3d11->menu.texture); } - d3d11_update_texture(d3d11->ctx, width, height, 0, format, frame, &d3d11->menu.texture); + d3d11_update_texture(d3d11->ctx, width, height, 0, format, frame, + &d3d11->menu.texture); d3d11->menu.texture.sampler = d3d11->samplers - [config_get_ptr()->bools.menu_linear_filter - ? RARCH_FILTER_LINEAR - : RARCH_FILTER_NEAREST][RARCH_WRAP_DEFAULT]; + [config_get_ptr()->bools.menu_linear_filter + ? RARCH_FILTER_LINEAR + : RARCH_FILTER_NEAREST][RARCH_WRAP_DEFAULT]; } -static void d3d11_set_menu_texture_enable(void* data, bool state, bool full_screen) +static void d3d11_set_menu_texture_enable(void* data, bool state, + bool full_screen) { d3d11_video_t* d3d11 = (d3d11_video_t*)data; @@ -1148,7 +1216,8 @@ static void d3d11_set_menu_texture_enable(void* data, bool state, bool full_scre d3d11->menu.fullscreen = full_screen; } -static void d3d11_gfx_set_aspect_ratio(void* data, unsigned aspect_ratio_idx) +static void d3d11_gfx_set_aspect_ratio(void* data, + unsigned aspect_ratio_idx) { d3d11_video_t* d3d11 = (d3d11_video_t*)data; @@ -1168,7 +1237,8 @@ static void d3d11_gfx_apply_state_changes(void* data) } static void d3d11_gfx_set_osd_msg( - void* data, video_frame_info_t* video_info, const char* msg, const void* params, void* font) + void* data, video_frame_info_t* video_info, + const char* msg, const void* params, void* font) { d3d11_video_t* d3d11 = (d3d11_video_t*)data; @@ -1181,7 +1251,8 @@ static void d3d11_gfx_set_osd_msg( } } static uintptr_t d3d11_gfx_load_texture( - void* video_data, void* data, bool threaded, enum texture_filter_type filter_type) + void* video_data, void* data, bool threaded, + enum texture_filter_type filter_type) { d3d11_texture_t* texture = NULL; d3d11_video_t* d3d11 = (d3d11_video_t*)video_data; @@ -1198,13 +1269,15 @@ static uintptr_t d3d11_gfx_load_texture( texture->desc.MiscFlags = D3D11_RESOURCE_MISC_GENERATE_MIPS; /* fallthrough */ case TEXTURE_FILTER_LINEAR: - texture->sampler = d3d11->samplers[RARCH_FILTER_LINEAR][RARCH_WRAP_DEFAULT]; + texture->sampler = d3d11->samplers[ + RARCH_FILTER_LINEAR][RARCH_WRAP_DEFAULT]; break; case TEXTURE_FILTER_MIPMAP_NEAREST: texture->desc.MiscFlags = D3D11_RESOURCE_MISC_GENERATE_MIPS; /* fallthrough */ case TEXTURE_FILTER_NEAREST: - texture->sampler = d3d11->samplers[RARCH_FILTER_NEAREST][RARCH_WRAP_DEFAULT]; + texture->sampler = d3d11->samplers[ + RARCH_FILTER_NEAREST][RARCH_WRAP_DEFAULT]; break; } @@ -1215,7 +1288,8 @@ static uintptr_t d3d11_gfx_load_texture( d3d11_init_texture(d3d11->device, texture); d3d11_update_texture( - d3d11->ctx, image->width, image->height, 0, DXGI_FORMAT_B8G8R8A8_UNORM, image->pixels, + d3d11->ctx, image->width, image->height, 0, + DXGI_FORMAT_B8G8R8A8_UNORM, image->pixels, texture); return (uintptr_t)texture; @@ -1257,7 +1331,8 @@ static const video_poke_interface_t d3d11_poke_interface = { NULL, /* get_hw_render_interface */ }; -static void d3d11_gfx_get_poke_interface(void* data, const video_poke_interface_t** iface) +static void d3d11_gfx_get_poke_interface(void* data, + const video_poke_interface_t **iface) { *iface = &d3d11_poke_interface; } diff --git a/gfx/include/Cg/cgD3D9.h b/gfx/include/Cg/cgD3D9.h index 465f26e3ea..646a2cf6fd 100644 --- a/gfx/include/Cg/cgD3D9.h +++ b/gfx/include/Cg/cgD3D9.h @@ -90,11 +90,11 @@ enum cgD3D9Errors cgD3D9DebugTrace = 1001 }; -/*--------------------------------------------------------------------------- -// HRESULTs specific to cgD3D9. When the CGerror is set to cgD3D9Failed -// cgD3D9GetLastError will return an HRESULT that could be one these. -// Use cgD3D9TranslateHRESULT() to translate these errors into strings. ----------------------------------------------------------------------------*/ +/* + * HRESULTs specific to cgD3D9. When the CGerror is set to cgD3D9Failed + * cgD3D9GetLastError will return an HRESULT that could be one these. + * Use cgD3D9TranslateHRESULT() to translate these errors into strings. +*/ static const HRESULT CGD3D9ERR_NOTLOADED = MAKE_HRESULT(1, 0x877, 1); static const HRESULT CGD3D9ERR_NODEVICE = MAKE_HRESULT(1, 0x877, 2); @@ -106,9 +106,9 @@ static const HRESULT CGD3D9ERR_NOTUNIFORM = MAKE_HRESULT(1, 0x877, 7); static const HRESULT CGD3D9ERR_NOTMATRIX = MAKE_HRESULT(1, 0x877, 8); static const HRESULT CGD3D9ERR_INVALIDPARAM = MAKE_HRESULT(1, 0x877, 9); -/*--------------------------------------------------------------------------- -// Other error return values ----------------------------------------------------------------------------*/ +/* + * Other error return values +*/ static const DWORD CGD3D9_INVALID_USAGE = 0xFF; diff --git a/gfx/include/d3d9/d3dx9math.h b/gfx/include/d3d9/d3dx9math.h index e8593c0f1e..914d9536f0 100644 --- a/gfx/include/d3d9/d3dx9math.h +++ b/gfx/include/d3d9/d3dx9math.h @@ -462,19 +462,19 @@ public: D3DXPLANE( CONST D3DXFLOAT16* ); D3DXPLANE( FLOAT a, FLOAT b, FLOAT c, FLOAT d ); - // casting + /* casting */ operator FLOAT* (); operator CONST FLOAT* () const; - // assignment operators + /* assignment operators */ D3DXPLANE& operator *= ( FLOAT ); D3DXPLANE& operator /= ( FLOAT ); - // unary operators + /* unary operators */ D3DXPLANE operator + () const; D3DXPLANE operator - () const; - // binary operators + /* binary operators */ D3DXPLANE operator * ( FLOAT ) const; D3DXPLANE operator / ( FLOAT ) const; @@ -483,16 +483,16 @@ public: BOOL operator == ( CONST D3DXPLANE& ) const; BOOL operator != ( CONST D3DXPLANE& ) const; -#endif //__cplusplus +#endif /*__cplusplus */ FLOAT a, b, c, d; } D3DXPLANE, *LPD3DXPLANE; -//=========================================================================== -// -// Colors -// -//=========================================================================== +/* + * + * Colors + * + */ typedef struct D3DXCOLOR { @@ -505,7 +505,7 @@ public: D3DXCOLOR( CONST D3DCOLORVALUE& ); D3DXCOLOR( FLOAT r, FLOAT g, FLOAT b, FLOAT a ); - // casting + /* casting */ operator DWORD () const; operator FLOAT* (); @@ -517,17 +517,17 @@ public: operator D3DCOLORVALUE& (); operator CONST D3DCOLORVALUE& () const; - // assignment operators + /* assignment operators */ D3DXCOLOR& operator += ( CONST D3DXCOLOR& ); D3DXCOLOR& operator -= ( CONST D3DXCOLOR& ); D3DXCOLOR& operator *= ( FLOAT ); D3DXCOLOR& operator /= ( FLOAT ); - // unary operators + /* unary operators */ D3DXCOLOR operator + () const; D3DXCOLOR operator - () const; - // binary operators + /* binary operators */ D3DXCOLOR operator + ( CONST D3DXCOLOR& ) const; D3DXCOLOR operator - ( CONST D3DXCOLOR& ) const; D3DXCOLOR operator * ( FLOAT ) const; @@ -538,38 +538,35 @@ public: BOOL operator == ( CONST D3DXCOLOR& ) const; BOOL operator != ( CONST D3DXCOLOR& ) const; -#endif //__cplusplus +#endif /* __cplusplus */ FLOAT r, g, b, a; } D3DXCOLOR, *LPD3DXCOLOR; +/* + * + * D3DX math functions: + * + * NOTE: + * * All these functions can take the same object as in and out parameters. + * + * * Out parameters are typically also returned as return values, so that + * the output of one function may be used as a parameter to another. + */ +/* + * Float16 + */ -//=========================================================================== -// -// D3DX math functions: -// -// NOTE: -// * All these functions can take the same object as in and out parameters. -// -// * Out parameters are typically also returned as return values, so that -// the output of one function may be used as a parameter to another. -// -//=========================================================================== - -//-------------------------- -// Float16 -//-------------------------- - -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif -// Converts an array 32-bit floats to 16-bit floats +/* Converts an array 32-bit floats to 16-bit floats */ D3DXFLOAT16* WINAPI D3DXFloat32To16Array ( D3DXFLOAT16 *pOut, CONST FLOAT *pIn, UINT n ); -// Converts an array 16-bit floats to 32-bit floats +/* Converts an array 16-bit floats to 32-bit floats */ FLOAT* WINAPI D3DXFloat16To32Array ( FLOAT *pOut, CONST D3DXFLOAT16 *pIn, UINT n ); @@ -577,12 +574,11 @@ FLOAT* WINAPI D3DXFloat16To32Array } #endif +/* + * 2D Vector + */ -//-------------------------- -// 2D Vector -//-------------------------- - -// inline +/* inline */ FLOAT D3DXVec2Length ( CONST D3DXVECTOR2 *pV ); @@ -593,7 +589,7 @@ FLOAT D3DXVec2LengthSq FLOAT D3DXVec2Dot ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); -// Z component of ((x1,y1,0) cross (x2,y2,0)) +/* Z component of ((x1,y1,0) cross (x2,y2,0)) */ FLOAT D3DXVec2CCW ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); @@ -603,23 +599,23 @@ D3DXVECTOR2* D3DXVec2Add D3DXVECTOR2* D3DXVec2Subtract ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); -// Minimize each component. x = min(x1, x2), y = min(y1, y2) +/* Minimize each component. x = min(x1, x2), y = min(y1, y2) */ D3DXVECTOR2* D3DXVec2Minimize ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); -// Maximize each component. x = max(x1, x2), y = max(y1, y2) +/* Maximize each component. x = max(x1, x2), y = max(y1, y2) */ D3DXVECTOR2* D3DXVec2Maximize ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); D3DXVECTOR2* D3DXVec2Scale ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, FLOAT s ); -// Linear interpolation. V1 + s(V2-V1) +/* Linear interpolation. V1 + s(V2-V1) */ D3DXVECTOR2* D3DXVec2Lerp ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, FLOAT s ); -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif @@ -627,43 +623,43 @@ extern "C" { D3DXVECTOR2* WINAPI D3DXVec2Normalize ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV ); -// Hermite interpolation between position V1, tangent T1 (when s == 0) -// and position V2, tangent T2 (when s == 1). +/* Hermite interpolation between position V1, tangent T1 (when s == 0) + * and position V2, tangent T2 (when s == 1). */ D3DXVECTOR2* WINAPI D3DXVec2Hermite ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pT1, CONST D3DXVECTOR2 *pV2, CONST D3DXVECTOR2 *pT2, FLOAT s ); -// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +/* CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) */ D3DXVECTOR2* WINAPI D3DXVec2CatmullRom ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV0, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, CONST D3DXVECTOR2 *pV3, FLOAT s ); -// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +/* Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) */ D3DXVECTOR2* WINAPI D3DXVec2BaryCentric ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, CONST D3DXVECTOR2 *pV3, FLOAT f, FLOAT g); -// Transform (x, y, 0, 1) by matrix. +/* Transform (x, y, 0, 1) by matrix. */ D3DXVECTOR4* WINAPI D3DXVec2Transform ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); -// Transform (x, y, 0, 1) by matrix, project result back into w=1. +/* Transform (x, y, 0, 1) by matrix, project result back into w=1. */ D3DXVECTOR2* WINAPI D3DXVec2TransformCoord ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); -// Transform (x, y, 0, 0) by matrix. +/* Transform (x, y, 0, 0) by matrix. */ D3DXVECTOR2* WINAPI D3DXVec2TransformNormal ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); -// Transform Array (x, y, 0, 1) by matrix. +/* Transform Array (x, y, 0, 1) by matrix. */ D3DXVECTOR4* WINAPI D3DXVec2TransformArray ( D3DXVECTOR4 *pOut, UINT OutStride, CONST D3DXVECTOR2 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n); -// Transform Array (x, y, 0, 1) by matrix, project result back into w=1. +/* Transform Array (x, y, 0, 1) by matrix, project result back into w=1. */ D3DXVECTOR2* WINAPI D3DXVec2TransformCoordArray ( D3DXVECTOR2 *pOut, UINT OutStride, CONST D3DXVECTOR2 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); -// Transform Array (x, y, 0, 0) by matrix. +/* Transform Array (x, y, 0, 0) by matrix. */ D3DXVECTOR2* WINAPI D3DXVec2TransformNormalArray ( D3DXVECTOR2 *pOut, UINT OutStride, CONST D3DXVECTOR2 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); @@ -673,12 +669,11 @@ D3DXVECTOR2* WINAPI D3DXVec2TransformNormalArray } #endif +/* + * 3D Vector + */ -//-------------------------- -// 3D Vector -//-------------------------- - -// inline +/* inline */ FLOAT D3DXVec3Length ( CONST D3DXVECTOR3 *pV ); @@ -698,23 +693,23 @@ D3DXVECTOR3* D3DXVec3Add D3DXVECTOR3* D3DXVec3Subtract ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); -// Minimize each component. x = min(x1, x2), y = min(y1, y2), ... +/* Minimize each component. x = min(x1, x2), y = min(y1, y2), ... */ D3DXVECTOR3* D3DXVec3Minimize ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); -// Maximize each component. x = max(x1, x2), y = max(y1, y2), ... +/* Maximize each component. x = max(x1, x2), y = max(y1, y2), ... */ D3DXVECTOR3* D3DXVec3Maximize ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); D3DXVECTOR3* D3DXVec3Scale ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, FLOAT s); -// Linear interpolation. V1 + s(V2-V1) +/* Linear interpolation. V1 + s(V2-V1) */ D3DXVECTOR3* D3DXVec3Lerp ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, FLOAT s ); -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif @@ -722,67 +717,69 @@ extern "C" { D3DXVECTOR3* WINAPI D3DXVec3Normalize ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV ); -// Hermite interpolation between position V1, tangent T1 (when s == 0) -// and position V2, tangent T2 (when s == 1). +/* Hermite interpolation between position V1, tangent T1 (when s == 0) + * and position V2, tangent T2 (when s == 1). */ D3DXVECTOR3* WINAPI D3DXVec3Hermite ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pT1, CONST D3DXVECTOR3 *pV2, CONST D3DXVECTOR3 *pT2, FLOAT s ); -// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +/* CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) */ D3DXVECTOR3* WINAPI D3DXVec3CatmullRom ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV0, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, CONST D3DXVECTOR3 *pV3, FLOAT s ); -// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +/* Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) */ D3DXVECTOR3* WINAPI D3DXVec3BaryCentric ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, CONST D3DXVECTOR3 *pV3, FLOAT f, FLOAT g); -// Transform (x, y, z, 1) by matrix. +/* Transform (x, y, z, 1) by matrix. */ D3DXVECTOR4* WINAPI D3DXVec3Transform ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); -// Transform (x, y, z, 1) by matrix, project result back into w=1. +/* Transform (x, y, z, 1) by matrix, project result back into w=1. */ D3DXVECTOR3* WINAPI D3DXVec3TransformCoord ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); -// Transform (x, y, z, 0) by matrix. If you transforming a normal by a -// non-affine matrix, the matrix you pass to this function should be the -// transpose of the inverse of the matrix you would use to transform a coord. +/* Transform (x, y, z, 0) by matrix. If you transforming a normal by a + * non-affine matrix, the matrix you pass to this function should be the + * transpose of the inverse of the matrix you would use to transform a coord. + */ D3DXVECTOR3* WINAPI D3DXVec3TransformNormal ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); -// Transform Array (x, y, z, 1) by matrix. +/* Transform Array (x, y, z, 1) by matrix. */ D3DXVECTOR4* WINAPI D3DXVec3TransformArray ( D3DXVECTOR4 *pOut, UINT OutStride, CONST D3DXVECTOR3 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); -// Transform Array (x, y, z, 1) by matrix, project result back into w=1. +/* Transform Array (x, y, z, 1) by matrix, project result back into w=1. */ D3DXVECTOR3* WINAPI D3DXVec3TransformCoordArray ( D3DXVECTOR3 *pOut, UINT OutStride, CONST D3DXVECTOR3 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); -// Transform (x, y, z, 0) by matrix. If you transforming a normal by a -// non-affine matrix, the matrix you pass to this function should be the -// transpose of the inverse of the matrix you would use to transform a coord. +/* Transform (x, y, z, 0) by matrix. If you transforming a normal by a + * non-affine matrix, the matrix you pass to this function should be the + * transpose of the inverse of the matrix you would use to transform a coord. + */ D3DXVECTOR3* WINAPI D3DXVec3TransformNormalArray ( D3DXVECTOR3 *pOut, UINT OutStride, CONST D3DXVECTOR3 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); -// Project vector from object space into screen space +/* Project vector from object space into screen space */ D3DXVECTOR3* WINAPI D3DXVec3Project ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DVIEWPORT9 *pViewport, CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld); -// Project vector from screen space into object space +/* Project vector from screen space into object space */ D3DXVECTOR3* WINAPI D3DXVec3Unproject ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DVIEWPORT9 *pViewport, CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld); -// Project vector Array from object space into screen space +/* Project vector Array from object space into screen space */ D3DXVECTOR3* WINAPI D3DXVec3ProjectArray ( D3DXVECTOR3 *pOut, UINT OutStride,CONST D3DXVECTOR3 *pV, UINT VStride,CONST D3DVIEWPORT9 *pViewport, CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld, UINT n); -// Project vector Array from screen space into object space +/* Project vector Array from screen space into object space */ D3DXVECTOR3* WINAPI D3DXVec3UnprojectArray ( D3DXVECTOR3 *pOut, UINT OutStride, CONST D3DXVECTOR3 *pV, UINT VStride, CONST D3DVIEWPORT9 *pViewport, CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld, UINT n); @@ -792,13 +789,11 @@ D3DXVECTOR3* WINAPI D3DXVec3UnprojectArray } #endif +/* + * 4D Vector + */ - -//-------------------------- -// 4D Vector -//-------------------------- - -// inline +/* inline */ FLOAT D3DXVec4Length ( CONST D3DXVECTOR4 *pV ); @@ -815,28 +810,28 @@ D3DXVECTOR4* D3DXVec4Add D3DXVECTOR4* D3DXVec4Subtract ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); -// Minimize each component. x = min(x1, x2), y = min(y1, y2), ... +/* Minimize each component. x = min(x1, x2), y = min(y1, y2), ... */ D3DXVECTOR4* D3DXVec4Minimize ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); -// Maximize each component. x = max(x1, x2), y = max(y1, y2), ... +/* Maximize each component. x = max(x1, x2), y = max(y1, y2), ... */ D3DXVECTOR4* D3DXVec4Maximize ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); D3DXVECTOR4* D3DXVec4Scale ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV, FLOAT s); -// Linear interpolation. V1 + s(V2-V1) +/* Linear interpolation. V1 + s(V2-V1) */ D3DXVECTOR4* D3DXVec4Lerp ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, FLOAT s ); -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif -// Cross-product in 4 dimensions. +/* Cross-product in 4 dimensions. */ D3DXVECTOR4* WINAPI D3DXVec4Cross ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, CONST D3DXVECTOR4 *pV3); @@ -844,27 +839,27 @@ D3DXVECTOR4* WINAPI D3DXVec4Cross D3DXVECTOR4* WINAPI D3DXVec4Normalize ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV ); -// Hermite interpolation between position V1, tangent T1 (when s == 0) -// and position V2, tangent T2 (when s == 1). +/* Hermite interpolation between position V1, tangent T1 (when s == 0) + * and position V2, tangent T2 (when s == 1). */ D3DXVECTOR4* WINAPI D3DXVec4Hermite ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pT1, CONST D3DXVECTOR4 *pV2, CONST D3DXVECTOR4 *pT2, FLOAT s ); -// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +/* CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) */ D3DXVECTOR4* WINAPI D3DXVec4CatmullRom ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV0, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, CONST D3DXVECTOR4 *pV3, FLOAT s ); -// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +/* Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) */ D3DXVECTOR4* WINAPI D3DXVec4BaryCentric ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, CONST D3DXVECTOR4 *pV3, FLOAT f, FLOAT g); -// Transform vector by matrix. +/* Transform vector by matrix. */ D3DXVECTOR4* WINAPI D3DXVec4Transform ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV, CONST D3DXMATRIX *pM ); -// Transform vector array by matrix. +/* Transform vector array by matrix. */ D3DXVECTOR4* WINAPI D3DXVec4TransformArray ( D3DXVECTOR4 *pOut, UINT OutStride, CONST D3DXVECTOR4 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); @@ -873,11 +868,11 @@ D3DXVECTOR4* WINAPI D3DXVec4TransformArray #endif -//-------------------------- -// 4D Matrix -//-------------------------- +/* + * 4D Matrix + */ -// inline +/* inline */ D3DXMATRIX* D3DXMatrixIdentity ( D3DXMATRIX *pOut ); @@ -901,143 +896,143 @@ HRESULT WINAPI D3DXMatrixDecompose D3DXMATRIX* WINAPI D3DXMatrixTranspose ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM ); -// Matrix multiplication. The result represents the transformation M2 -// followed by the transformation M1. (Out = M1 * M2) +/* Matrix multiplication. The result represents the transformation M2 + * followed by the transformation M1. (Out = M1 * M2) */ D3DXMATRIX* WINAPI D3DXMatrixMultiply ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM1, CONST D3DXMATRIX *pM2 ); -// Matrix multiplication, followed by a transpose. (Out = T(M1 * M2)) +/* Matrix multiplication, followed by a transpose. (Out = T(M1 * M2)) */ D3DXMATRIX* WINAPI D3DXMatrixMultiplyTranspose ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM1, CONST D3DXMATRIX *pM2 ); -// Calculate inverse of matrix. Inversion my fail, in which case NULL will -// be returned. The determinant of pM is also returned it pfDeterminant -// is non-NULL. +/* Calculate inverse of matrix. Inversion my fail, in which case NULL will + * be returned. The determinant of pM is also returned it pfDeterminant + * is non-NULL. */ D3DXMATRIX* WINAPI D3DXMatrixInverse ( D3DXMATRIX *pOut, FLOAT *pDeterminant, CONST D3DXMATRIX *pM ); -// Build a matrix which scales by (sx, sy, sz) +/* Build a matrix which scales by (sx, sy, sz) */ D3DXMATRIX* WINAPI D3DXMatrixScaling ( D3DXMATRIX *pOut, FLOAT sx, FLOAT sy, FLOAT sz ); -// Build a matrix which translates by (x, y, z) +/* Build a matrix which translates by (x, y, z) */ D3DXMATRIX* WINAPI D3DXMatrixTranslation ( D3DXMATRIX *pOut, FLOAT x, FLOAT y, FLOAT z ); -// Build a matrix which rotates around the X axis +/* Build a matrix which rotates around the X axis */ D3DXMATRIX* WINAPI D3DXMatrixRotationX ( D3DXMATRIX *pOut, FLOAT Angle ); -// Build a matrix which rotates around the Y axis +/* Build a matrix which rotates around the Y axis */ D3DXMATRIX* WINAPI D3DXMatrixRotationY ( D3DXMATRIX *pOut, FLOAT Angle ); -// Build a matrix which rotates around the Z axis +/* Build a matrix which rotates around the Z axis */ D3DXMATRIX* WINAPI D3DXMatrixRotationZ ( D3DXMATRIX *pOut, FLOAT Angle ); -// Build a matrix which rotates around an arbitrary axis +/* Build a matrix which rotates around an arbitrary axis */ D3DXMATRIX* WINAPI D3DXMatrixRotationAxis ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pV, FLOAT Angle ); -// Build a matrix from a quaternion +/* Build a matrix from a quaternion */ D3DXMATRIX* WINAPI D3DXMatrixRotationQuaternion ( D3DXMATRIX *pOut, CONST D3DXQUATERNION *pQ); -// Yaw around the Y axis, a pitch around the X axis, -// and a roll around the Z axis. +/* Yaw around the Y axis, a pitch around the X axis, + * and a roll around the Z axis. */ D3DXMATRIX* WINAPI D3DXMatrixRotationYawPitchRoll ( D3DXMATRIX *pOut, FLOAT Yaw, FLOAT Pitch, FLOAT Roll ); -// Build transformation matrix. NULL arguments are treated as identity. -// Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt +/* Build transformation matrix. NULL arguments are treated as identity. + * Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt */ D3DXMATRIX* WINAPI D3DXMatrixTransformation ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pScalingCenter, CONST D3DXQUATERNION *pScalingRotation, CONST D3DXVECTOR3 *pScaling, CONST D3DXVECTOR3 *pRotationCenter, CONST D3DXQUATERNION *pRotation, CONST D3DXVECTOR3 *pTranslation); -// Build 2D transformation matrix in XY plane. NULL arguments are treated as identity. -// Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt +/* Build 2D transformation matrix in XY plane. NULL arguments are treated as identity. + * Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt */ D3DXMATRIX* WINAPI D3DXMatrixTransformation2D ( D3DXMATRIX *pOut, CONST D3DXVECTOR2* pScalingCenter, FLOAT ScalingRotation, CONST D3DXVECTOR2* pScaling, CONST D3DXVECTOR2* pRotationCenter, FLOAT Rotation, CONST D3DXVECTOR2* pTranslation); -// Build affine transformation matrix. NULL arguments are treated as identity. -// Mout = Ms * Mrc-1 * Mr * Mrc * Mt +/* Build affine transformation matrix. NULL arguments are treated as identity. + * Mout = Ms * Mrc-1 * Mr * Mrc * Mt */ D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation ( D3DXMATRIX *pOut, FLOAT Scaling, CONST D3DXVECTOR3 *pRotationCenter, CONST D3DXQUATERNION *pRotation, CONST D3DXVECTOR3 *pTranslation); -// Build 2D affine transformation matrix in XY plane. NULL arguments are treated as identity. -// Mout = Ms * Mrc-1 * Mr * Mrc * Mt +/* Build 2D affine transformation matrix in XY plane. NULL arguments are treated as identity. + * Mout = Ms * Mrc-1 * Mr * Mrc * Mt */ D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation2D ( D3DXMATRIX *pOut, FLOAT Scaling, CONST D3DXVECTOR2* pRotationCenter, FLOAT Rotation, CONST D3DXVECTOR2* pTranslation); -// Build a lookat matrix. (right-handed) +/* Build a lookat matrix. (right-handed) */ D3DXMATRIX* WINAPI D3DXMatrixLookAtRH ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pEye, CONST D3DXVECTOR3 *pAt, CONST D3DXVECTOR3 *pUp ); -// Build a lookat matrix. (left-handed) +/* Build a lookat matrix. (left-handed) */ D3DXMATRIX* WINAPI D3DXMatrixLookAtLH ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pEye, CONST D3DXVECTOR3 *pAt, CONST D3DXVECTOR3 *pUp ); -// Build a perspective projection matrix. (right-handed) +/* Build a perspective projection matrix. (right-handed) */ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveRH ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); -// Build a perspective projection matrix. (left-handed) +/* Build a perspective projection matrix. (left-handed) */ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveLH ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); -// Build a perspective projection matrix. (right-handed) +/* Build a perspective projection matrix. (right-handed) */ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovRH ( D3DXMATRIX *pOut, FLOAT fovy, FLOAT Aspect, FLOAT zn, FLOAT zf ); -// Build a perspective projection matrix. (left-handed) +/* Build a perspective projection matrix. (left-handed) */ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovLH ( D3DXMATRIX *pOut, FLOAT fovy, FLOAT Aspect, FLOAT zn, FLOAT zf ); -// Build a perspective projection matrix. (right-handed) +/* Build a perspective projection matrix. (right-handed) */ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterRH ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf ); -// Build a perspective projection matrix. (left-handed) +/* Build a perspective projection matrix. (left-handed) */ D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterLH ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf ); -// Build an ortho projection matrix. (right-handed) +/* Build an ortho projection matrix. (right-handed) */ D3DXMATRIX* WINAPI D3DXMatrixOrthoRH ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); -// Build an ortho projection matrix. (left-handed) +/* Build an ortho projection matrix. (left-handed) */ D3DXMATRIX* WINAPI D3DXMatrixOrthoLH ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); -// Build an ortho projection matrix. (right-handed) +/* Build an ortho projection matrix. (right-handed) */ D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterRH ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf ); -// Build an ortho projection matrix. (left-handed) +/* Build an ortho projection matrix. (left-handed) */ D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterLH ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf ); -// Build a matrix which flattens geometry into a plane, as if casting -// a shadow from a light. +/* Build a matrix which flattens geometry into a plane, as if casting + * a shadow from a light. */ D3DXMATRIX* WINAPI D3DXMatrixShadow ( D3DXMATRIX *pOut, CONST D3DXVECTOR4 *pLight, CONST D3DXPLANE *pPlane ); -// Build a matrix which reflects the coordinate system about a plane +/* Build a matrix which reflects the coordinate system about a plane */ D3DXMATRIX* WINAPI D3DXMatrixReflect ( D3DXMATRIX *pOut, CONST D3DXPLANE *pPlane ); @@ -1045,10 +1040,9 @@ D3DXMATRIX* WINAPI D3DXMatrixReflect } #endif - -//-------------------------- -// Quaternion -//-------------------------- +/* + * Quaternion + */ /* inline */ @@ -1069,35 +1063,34 @@ D3DXQUATERNION* D3DXQuaternionIdentity BOOL D3DXQuaternionIsIdentity ( CONST D3DXQUATERNION *pQ ); -// (-x, -y, -z, w) +/* (-x, -y, -z, w) */ D3DXQUATERNION* D3DXQuaternionConjugate ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); - -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif -// Compute a quaternin's axis and angle of rotation. Expects unit quaternions. +/* Compute a quaternin's axis and angle of rotation. Expects unit quaternions. */ void WINAPI D3DXQuaternionToAxisAngle ( CONST D3DXQUATERNION *pQ, D3DXVECTOR3 *pAxis, FLOAT *pAngle ); -// Build a quaternion from a rotation matrix. +/* Build a quaternion from a rotation matrix. */ D3DXQUATERNION* WINAPI D3DXQuaternionRotationMatrix ( D3DXQUATERNION *pOut, CONST D3DXMATRIX *pM); -// Rotation about arbitrary axis. +/* Rotation about arbitrary axis. */ D3DXQUATERNION* WINAPI D3DXQuaternionRotationAxis ( D3DXQUATERNION *pOut, CONST D3DXVECTOR3 *pV, FLOAT Angle ); -// Yaw around the Y axis, a pitch around the X axis, -// and a roll around the Z axis. +/* Yaw around the Y axis, a pitch around the X axis, + * and a roll around the Z axis. */ D3DXQUATERNION* WINAPI D3DXQuaternionRotationYawPitchRoll ( D3DXQUATERNION *pOut, FLOAT Yaw, FLOAT Pitch, FLOAT Roll ); -// Quaternion multiplication. The result represents the rotation Q2 -// followed by the rotation Q1. (Out = Q2 * Q1) +/* Quaternion multiplication. The result represents the rotation Q2 + * followed by the rotation Q1. (Out = Q2 * Q1) */ D3DXQUATERNION* WINAPI D3DXQuaternionMultiply ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2 ); @@ -1105,43 +1098,43 @@ D3DXQUATERNION* WINAPI D3DXQuaternionMultiply D3DXQUATERNION* WINAPI D3DXQuaternionNormalize ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); -// Conjugate and re-norm +/* Conjugate and re-norm */ D3DXQUATERNION* WINAPI D3DXQuaternionInverse ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); -// Expects unit quaternions. -// if q = (cos(theta), sin(theta) * v); ln(q) = (0, theta * v) +/* Expects unit quaternions. + * if q = (cos(theta), sin(theta) * v); ln(q) = (0, theta * v) */ D3DXQUATERNION* WINAPI D3DXQuaternionLn ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); -// Expects pure quaternions. (w == 0) w is ignored in calculation. -// if q = (0, theta * v); exp(q) = (cos(theta), sin(theta) * v) +/* Expects pure quaternions. (w == 0) w is ignored in calculation. + * if q = (0, theta * v); exp(q) = (cos(theta), sin(theta) * v) */ D3DXQUATERNION* WINAPI D3DXQuaternionExp ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); -// Spherical linear interpolation between Q1 (t == 0) and Q2 (t == 1). -// Expects unit quaternions. +/* Spherical linear interpolation between Q1 (t == 0) and Q2 (t == 1). + * Expects unit quaternions. */ D3DXQUATERNION* WINAPI D3DXQuaternionSlerp ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2, FLOAT t ); -// Spherical quadrangle interpolation. -// Slerp(Slerp(Q1, C, t), Slerp(A, B, t), 2t(1-t)) +/* Spherical quadrangle interpolation. + * Slerp(Slerp(Q1, C, t), Slerp(A, B, t), 2t(1-t)) */ D3DXQUATERNION* WINAPI D3DXQuaternionSquad ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pA, CONST D3DXQUATERNION *pB, CONST D3DXQUATERNION *pC, FLOAT t ); -// Setup control points for spherical quadrangle interpolation -// from Q1 to Q2. The control points are chosen in such a way -// to ensure the continuity of tangents with adjacent segments. +/* Setup control points for spherical quadrangle interpolation + * from Q1 to Q2. The control points are chosen in such a way + * to ensure the continuity of tangents with adjacent segments. */ void WINAPI D3DXQuaternionSquadSetup ( D3DXQUATERNION *pAOut, D3DXQUATERNION *pBOut, D3DXQUATERNION *pCOut, CONST D3DXQUATERNION *pQ0, CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2, CONST D3DXQUATERNION *pQ3 ); -// Barycentric interpolation. -// Slerp(Slerp(Q1, Q2, f+g), Slerp(Q1, Q3, f+g), g/(f+g)) +/* Barycentric interpolation. + * Slerp(Slerp(Q1, Q2, f+g), Slerp(Q1, Q3, f+g), g/(f+g)) */ D3DXQUATERNION* WINAPI D3DXQuaternionBaryCentric ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2, CONST D3DXQUATERNION *pQ3, @@ -1152,58 +1145,58 @@ D3DXQUATERNION* WINAPI D3DXQuaternionBaryCentric #endif -//-------------------------- -// Plane -//-------------------------- +/* + * Plane +*/ -// inline +/* inline */ -// ax + by + cz + dw +/* ax + by + cz + dw */ FLOAT D3DXPlaneDot ( CONST D3DXPLANE *pP, CONST D3DXVECTOR4 *pV); -// ax + by + cz + d +/* ax + by + cz + d */ FLOAT D3DXPlaneDotCoord ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV); -// ax + by + cz +/* ax + by + cz */ FLOAT D3DXPlaneDotNormal ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV); D3DXPLANE* D3DXPlaneScale (D3DXPLANE *pOut, CONST D3DXPLANE *pP, FLOAT s); -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif -// Normalize plane (so that |a,b,c| == 1) +/* Normalize plane (so that |a,b,c| == 1) */ D3DXPLANE* WINAPI D3DXPlaneNormalize ( D3DXPLANE *pOut, CONST D3DXPLANE *pP); -// Find the intersection between a plane and a line. If the line is -// parallel to the plane, NULL is returned. +/* Find the intersection between a plane and a line. If the line is + * parallel to the plane, NULL is returned. */ D3DXVECTOR3* WINAPI D3DXPlaneIntersectLine ( D3DXVECTOR3 *pOut, CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2); -// Construct a plane from a point and a normal +/* Construct a plane from a point and a normal */ D3DXPLANE* WINAPI D3DXPlaneFromPointNormal ( D3DXPLANE *pOut, CONST D3DXVECTOR3 *pPoint, CONST D3DXVECTOR3 *pNormal); -// Construct a plane from 3 points +/* Construct a plane from 3 points */ D3DXPLANE* WINAPI D3DXPlaneFromPoints ( D3DXPLANE *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, CONST D3DXVECTOR3 *pV3); -// Transform a plane by a matrix. The vector (a,b,c) must be normal. -// M should be the inverse transpose of the transformation desired. +/* Transform a plane by a matrix. The vector (a,b,c) must be normal. + * M should be the inverse transpose of the transformation desired. */ D3DXPLANE* WINAPI D3DXPlaneTransform ( D3DXPLANE *pOut, CONST D3DXPLANE *pP, CONST D3DXMATRIX *pM ); -// Transform an array of planes by a matrix. The vectors (a,b,c) must be normal. -// M should be the inverse transpose of the transformation desired. +/* Transform an array of planes by a matrix. The vectors (a,b,c) must be normal. + * M should be the inverse transpose of the transformation desired. */ D3DXPLANE* WINAPI D3DXPlaneTransformArray ( D3DXPLANE *pOut, UINT OutStride, CONST D3DXPLANE *pP, UINT PStride, CONST D3DXMATRIX *pM, UINT n ); @@ -1211,14 +1204,13 @@ D3DXPLANE* WINAPI D3DXPlaneTransformArray } #endif +/* + * Color + */ -//-------------------------- -// Color -//-------------------------- +/* inline */ -// inline - -// (1-r, 1-g, 1-b, a) +/* (1-r, 1-g, 1-b, a) */ D3DXCOLOR* D3DXColorNegative (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC); @@ -1231,25 +1223,25 @@ D3DXCOLOR* D3DXColorSubtract D3DXCOLOR* D3DXColorScale (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT s); -// (r1*r2, g1*g2, b1*b2, a1*a2) +/* (r1*r2, g1*g2, b1*b2, a1*a2) */ D3DXCOLOR* D3DXColorModulate (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2); -// Linear interpolation of r,g,b, and a. C1 + s(C2-C1) +/* Linear interpolation of r,g,b, and a. C1 + s(C2-C1) */ D3DXCOLOR* D3DXColorLerp (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2, FLOAT s); -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif -// Interpolate r,g,b between desaturated color and color. -// DesaturatedColor + s(Color - DesaturatedColor) +/* Interpolate r,g,b between desaturated color and color. + * DesaturatedColor + s(Color - DesaturatedColor) */ D3DXCOLOR* WINAPI D3DXColorAdjustSaturation (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT s); -// Interpolate r,g,b between 50% grey and color. Grey + s(Color - Grey) +/* Interpolate r,g,b between 50% grey and color. Grey + s(Color - Grey) */ D3DXCOLOR* WINAPI D3DXColorAdjustContrast (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT c); @@ -1257,16 +1249,16 @@ D3DXCOLOR* WINAPI D3DXColorAdjustContrast } #endif -//-------------------------- -// Misc -//-------------------------- +/* + * Misc +*/ #ifdef __cplusplus extern "C" { #endif -// Calculate Fresnel term given the cosine of theta (likely obtained by -// taking the dot of two normals), and the refraction index of the material. +/* Calculate Fresnel term given the cosine of theta (likely obtained by + * taking the dot of two normals), and the refraction index of the material. */ FLOAT WINAPI D3DXFresnelTerm (FLOAT CosTheta, FLOAT RefractionIndex); @@ -1274,16 +1266,15 @@ FLOAT WINAPI D3DXFresnelTerm } #endif -//=========================================================================== -// -// Matrix Stack -// -//=========================================================================== +/* + * + * Matrix Stack + */ typedef interface ID3DXMatrixStack ID3DXMatrixStack; typedef interface ID3DXMatrixStack *LPD3DXMATRIXSTACK; -// {C7885BA7-F990-4fe7-922D-8515E477DD85} +/* {C7885BA7-F990-4fe7-922D-8515E477DD85} */ DEFINE_GUID(IID_ID3DXMatrixStack, 0xc7885ba7, 0xf990, 0x4fe7, 0x92, 0x2d, 0x85, 0x15, 0xe4, 0x77, 0xdd, 0x85); @@ -1293,85 +1284,83 @@ DEFINE_GUID(IID_ID3DXMatrixStack, DECLARE_INTERFACE_(ID3DXMatrixStack, IUnknown) { - // - // IUnknown methods - // + /* IUnknown methods */ STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; - // - // ID3DXMatrixStack methods - // + /* ID3DXMatrixStack methods */ - // Pops the top of the stack, returns the current top - // *after* popping the top. + /* Pops the top of the stack, returns the current top + * *after* popping the top. */ STDMETHOD(Pop)(THIS) PURE; - // Pushes the stack by one, duplicating the current matrix. + /* Pushes the stack by one, duplicating the current matrix. */ STDMETHOD(Push)(THIS) PURE; - // Loads identity in the current matrix. + /* Loads identity in the current matrix. */ STDMETHOD(LoadIdentity)(THIS) PURE; - // Loads the given matrix into the current matrix + /* Loads the given matrix into the current matrix */ STDMETHOD(LoadMatrix)(THIS_ CONST D3DXMATRIX* pM ) PURE; - // Right-Multiplies the given matrix to the current matrix. - // (transformation is about the current world origin) + /* Right-Multiplies the given matrix to the current matrix. + * (transformation is about the current world origin) */ STDMETHOD(MultMatrix)(THIS_ CONST D3DXMATRIX* pM ) PURE; - // Left-Multiplies the given matrix to the current matrix - // (transformation is about the local origin of the object) + /* Left-Multiplies the given matrix to the current matrix + * (transformation is about the local origin of the object) */ STDMETHOD(MultMatrixLocal)(THIS_ CONST D3DXMATRIX* pM ) PURE; - // Right multiply the current matrix with the computed rotation - // matrix, counterclockwise about the given axis with the given angle. - // (rotation is about the current world origin) + /* Right multiply the current matrix with the computed rotation + * matrix, counterclockwise about the given axis with the given angle. + * (rotation is about the current world origin) */ STDMETHOD(RotateAxis) (THIS_ CONST D3DXVECTOR3* pV, FLOAT Angle) PURE; - // Left multiply the current matrix with the computed rotation - // matrix, counterclockwise about the given axis with the given angle. - // (rotation is about the local origin of the object) + /* Left multiply the current matrix with the computed rotation + * matrix, counterclockwise about the given axis with the given angle. + * (rotation is about the local origin of the object) */ STDMETHOD(RotateAxisLocal) (THIS_ CONST D3DXVECTOR3* pV, FLOAT Angle) PURE; - // Right multiply the current matrix with the computed rotation - // matrix. All angles are counterclockwise. (rotation is about the - // current world origin) + /* Right multiply the current matrix with the computed rotation + * matrix. All angles are counterclockwise. (rotation is about the + * current world origin) - // The rotation is composed of a yaw around the Y axis, a pitch around - // the X axis, and a roll around the Z axis. + * The rotation is composed of a yaw around the Y axis, a pitch around + * the X axis, and a roll around the Z axis. + */ STDMETHOD(RotateYawPitchRoll) (THIS_ FLOAT Yaw, FLOAT Pitch, FLOAT Roll) PURE; - // Left multiply the current matrix with the computed rotation - // matrix. All angles are counterclockwise. (rotation is about the - // local origin of the object) + /* Left multiply the current matrix with the computed rotation + * matrix. All angles are counterclockwise. (rotation is about the + * local origin of the object) - // The rotation is composed of a yaw around the Y axis, a pitch around - // the X axis, and a roll around the Z axis. + * The rotation is composed of a yaw around the Y axis, a pitch around + * the X axis, and a roll around the Z axis. + */ STDMETHOD(RotateYawPitchRollLocal) (THIS_ FLOAT Yaw, FLOAT Pitch, FLOAT Roll) PURE; - // Right multiply the current matrix with the computed scale - // matrix. (transformation is about the current world origin) + /* Right multiply the current matrix with the computed scale + * matrix. (transformation is about the current world origin) */ STDMETHOD(Scale)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; - // Left multiply the current matrix with the computed scale - // matrix. (transformation is about the local origin of the object) + /* Left multiply the current matrix with the computed scale + * matrix. (transformation is about the local origin of the object) */ STDMETHOD(ScaleLocal)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; - // Right multiply the current matrix with the computed translation - // matrix. (transformation is about the current world origin) + /* Right multiply the current matrix with the computed translation + * matrix. (transformation is about the current world origin) */ STDMETHOD(Translate)(THIS_ FLOAT x, FLOAT y, FLOAT z ) PURE; - // Left multiply the current matrix with the computed translation - // matrix. (transformation is about the local origin of the object) + /* Left multiply the current matrix with the computed translation + * matrix. (transformation is about the local origin of the object) */ STDMETHOD(TranslateLocal)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; - // Obtain the current matrix at the top of the stack + /* Obtain the current matrix at the top of the stack */ STDMETHOD_(D3DXMATRIX*, GetTop)(THIS) PURE; }; @@ -1388,30 +1377,27 @@ HRESULT WINAPI } #endif -//=========================================================================== -// -// Spherical Harmonic Runtime Routines -// -// NOTE: -// * Most of these functions can take the same object as in and out parameters. -// The exceptions are the rotation functions. -// -// * Out parameters are typically also returned as return values, so that -// the output of one function may be used as a parameter to another. -// -//============================================================================ +/* + * + * Spherical Harmonic Runtime Routines + * + * NOTE: + * * Most of these functions can take the same object as in and out parameters. + * The exceptions are the rotation functions. + * + * * Out parameters are typically also returned as return values, so that + * the output of one function may be used as a parameter to another. + */ - -// non-inline +/* non-inline */ #ifdef __cplusplus extern "C" { #endif -//============================================================================ -// -// Basic Spherical Harmonic math routines -// -//============================================================================ +/* + * + * Basic Spherical Harmonic math routines + */ #define D3DXSH_MINORDER 2 #define D3DXSH_MAXORDER 6 @@ -1440,12 +1426,10 @@ FLOAT* WINAPI D3DXSHMultiply4( FLOAT *pOut, CONST FLOAT *pF, CONST FLOAT *pG); FLOAT* WINAPI D3DXSHMultiply5( FLOAT *pOut, CONST FLOAT *pF, CONST FLOAT *pG); FLOAT* WINAPI D3DXSHMultiply6( FLOAT *pOut, CONST FLOAT *pF, CONST FLOAT *pG); - -//============================================================================ -// -// Basic Spherical Harmonic lighting routines -// -//============================================================================ +/* + * + * Basic Spherical Harmonic lighting routines + */ HRESULT WINAPI D3DXSHEvalDirectionalLight ( UINT Order, CONST D3DXVECTOR3 *pDir, @@ -1466,31 +1450,29 @@ HRESULT WINAPI D3DXSHEvalHemisphereLight ( UINT Order, CONST D3DXVECTOR3 *pDir, D3DXCOLOR Top, D3DXCOLOR Bottom, FLOAT *pROut, FLOAT *pGOut, FLOAT *pBOut ); -//============================================================================ -// -// Basic Spherical Harmonic projection routines -// -//============================================================================ +/* + * + * Basic Spherical Harmonic projection routines + */ -//============================================================================ -// -// D3DXSHProjectCubeMap: -// -------------------- -// Projects a function represented on a cube map into spherical harmonics. -// -// Parameters: -// Order -// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 -// pCubeMap -// CubeMap that is going to be projected into spherical harmonics -// pROut -// Output SH vector for Red. -// pGOut -// Output SH vector for Green -// pBOut -// Output SH vector for Blue -// -//============================================================================ +/* + * + * D3DXSHProjectCubeMap: + * -------------------- + * Projects a function represented on a cube map into spherical harmonics. + * + * Parameters: + * Order + * Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 + * pCubeMap + * CubeMap that is going to be projected into spherical harmonics + * pROut + * Output SH vector for Red. + * pGOut + * Output SH vector for Green + * pBOut + * Output SH vector for Blue + */ HRESULT WINAPI D3DXSHProjectCubeMap ( UINT uOrder, LPDIRECT3DCUBETEXTURE9 pCubeMap, diff --git a/gfx/include/d3d9/d3dx9math.inl b/gfx/include/d3d9/d3dx9math.inl index 1d747453da..08a408fc7c 100644 --- a/gfx/include/d3d9/d3dx9math.inl +++ b/gfx/include/d3d9/d3dx9math.inl @@ -1,26 +1,24 @@ -////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) Microsoft Corporation. All Rights Reserved. -// -// File: d3dx9math.inl -// Content: D3DX math inline functions -// -////////////////////////////////////////////////////////////////////////////// +/* + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3dx9math.inl + * Content: D3DX math inline functions + */ #ifndef __D3DX9MATH_INL__ #define __D3DX9MATH_INL__ -//=========================================================================== -// -// Inline Class Methods -// -//=========================================================================== +/* + * + * Inline Class Methods + */ #ifdef __cplusplus -//-------------------------- -// Float16 -//-------------------------- +/* + * Float16 + */ D3DXINLINE D3DXFLOAT16::D3DXFLOAT16( FLOAT f ) @@ -34,7 +32,7 @@ D3DXFLOAT16::D3DXFLOAT16( CONST D3DXFLOAT16& f ) value = f.value; } -// casting +/* casting */ D3DXINLINE D3DXFLOAT16::operator FLOAT () { @@ -43,7 +41,7 @@ D3DXFLOAT16::operator FLOAT () return f; } -// binary operators +/* binary operators */ D3DXINLINE BOOL D3DXFLOAT16::operator == ( CONST D3DXFLOAT16& f ) const { @@ -57,9 +55,9 @@ D3DXFLOAT16::operator != ( CONST D3DXFLOAT16& f ) const } -//-------------------------- -// 2D Vector -//-------------------------- +/* + * 2D Vector + */ D3DXINLINE D3DXVECTOR2::D3DXVECTOR2( CONST FLOAT *pf ) @@ -81,8 +79,7 @@ D3DXVECTOR2::D3DXVECTOR2( FLOAT fx, FLOAT fy ) y = fy; } - -// casting +/* casting */ D3DXINLINE D3DXVECTOR2::operator FLOAT* () { @@ -95,8 +92,7 @@ D3DXVECTOR2::operator CONST FLOAT* () const return (CONST FLOAT *) &x; } - -// assignment operators +/* assignment operators */ D3DXINLINE D3DXVECTOR2& D3DXVECTOR2::operator += ( CONST D3DXVECTOR2& v ) { @@ -130,8 +126,7 @@ D3DXVECTOR2::operator /= ( FLOAT f ) return *this; } - -// unary operators +/* unary operators */ D3DXINLINE D3DXVECTOR2 D3DXVECTOR2::operator + () const { @@ -144,8 +139,7 @@ D3DXVECTOR2::operator - () const return D3DXVECTOR2(-x, -y); } - -// binary operators +/* binary operators */ D3DXINLINE D3DXVECTOR2 D3DXVECTOR2::operator + ( CONST D3DXVECTOR2& v ) const { @@ -189,11 +183,9 @@ D3DXVECTOR2::operator != ( CONST D3DXVECTOR2& v ) const return x != v.x || y != v.y; } - - -//-------------------------- -// 2D Vector (16 bit) -//-------------------------- +/* + * 2D Vector (16 bit) + */ D3DXINLINE D3DXVECTOR2_16F::D3DXVECTOR2_16F( CONST FLOAT *pf ) @@ -214,8 +206,7 @@ D3DXVECTOR2_16F::D3DXVECTOR2_16F( CONST D3DXFLOAT16 &fx, CONST D3DXFLOAT16 &fy ) y = fy; } - -// casting +/* casting */ D3DXINLINE D3DXVECTOR2_16F::operator D3DXFLOAT16* () { @@ -228,8 +219,7 @@ D3DXVECTOR2_16F::operator CONST D3DXFLOAT16* () const return (CONST D3DXFLOAT16*) &x; } - -// binary operators +/* binary operators */ D3DXINLINE BOOL D3DXVECTOR2_16F::operator == ( CONST D3DXVECTOR2_16F &v ) const { @@ -243,9 +233,9 @@ D3DXVECTOR2_16F::operator != ( CONST D3DXVECTOR2_16F &v ) const } -//-------------------------- -// 3D Vector -//-------------------------- +/* + * 3D Vector + */ D3DXINLINE D3DXVECTOR3::D3DXVECTOR3( CONST FLOAT *pf ) { @@ -276,8 +266,7 @@ D3DXVECTOR3::D3DXVECTOR3( FLOAT fx, FLOAT fy, FLOAT fz ) z = fz; } - -// casting +/* casting */ D3DXINLINE D3DXVECTOR3::operator FLOAT* () { @@ -290,8 +279,7 @@ D3DXVECTOR3::operator CONST FLOAT* () const return (CONST FLOAT *) &x; } - -// assignment operators +/* assignment operators */ D3DXINLINE D3DXVECTOR3& D3DXVECTOR3::operator += ( CONST D3DXVECTOR3& v ) { @@ -329,8 +317,7 @@ D3DXVECTOR3::operator /= ( FLOAT f ) return *this; } - -// unary operators +/* unary operators */ D3DXINLINE D3DXVECTOR3 D3DXVECTOR3::operator + () const { @@ -343,8 +330,7 @@ D3DXVECTOR3::operator - () const return D3DXVECTOR3(-x, -y, -z); } - -// binary operators +/* binary operators */ D3DXINLINE D3DXVECTOR3 D3DXVECTOR3::operator + ( CONST D3DXVECTOR3& v ) const { @@ -390,11 +376,9 @@ D3DXVECTOR3::operator != ( CONST D3DXVECTOR3& v ) const return x != v.x || y != v.y || z != v.z; } - - -//-------------------------- -// 3D Vector (16 bit) -//-------------------------- +/* + * 3D Vector (16 bit) + */ D3DXINLINE D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST FLOAT *pf ) @@ -425,8 +409,7 @@ D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST D3DXFLOAT16 &fx, CONST D3DXFLOAT16 &fy, z = fz; } - -// casting +/* casting */ D3DXINLINE D3DXVECTOR3_16F::operator D3DXFLOAT16* () { @@ -439,8 +422,7 @@ D3DXVECTOR3_16F::operator CONST D3DXFLOAT16* () const return (CONST D3DXFLOAT16*) &x; } - -// binary operators +/* binary operators */ D3DXINLINE BOOL D3DXVECTOR3_16F::operator == ( CONST D3DXVECTOR3_16F &v ) const { @@ -456,9 +438,9 @@ D3DXVECTOR3_16F::operator != ( CONST D3DXVECTOR3_16F &v ) const } -//-------------------------- -// 4D Vector -//-------------------------- +/* + * 4D Vector + */ D3DXINLINE D3DXVECTOR4::D3DXVECTOR4( CONST FLOAT *pf ) { @@ -492,8 +474,7 @@ D3DXVECTOR4::D3DXVECTOR4( FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw ) w = fw; } - -// casting +/* casting */ D3DXINLINE D3DXVECTOR4::operator FLOAT* () { @@ -506,8 +487,7 @@ D3DXVECTOR4::operator CONST FLOAT* () const return (CONST FLOAT *) &x; } - -// assignment operators +/* assignment operators */ D3DXINLINE D3DXVECTOR4& D3DXVECTOR4::operator += ( CONST D3DXVECTOR4& v ) { @@ -549,8 +529,7 @@ D3DXVECTOR4::operator /= ( FLOAT f ) return *this; } - -// unary operators +/* unary operators */ D3DXINLINE D3DXVECTOR4 D3DXVECTOR4::operator + () const { @@ -563,8 +542,7 @@ D3DXVECTOR4::operator - () const return D3DXVECTOR4(-x, -y, -z, -w); } - -// binary operators +/* binary operators */ D3DXINLINE D3DXVECTOR4 D3DXVECTOR4::operator + ( CONST D3DXVECTOR4& v ) const { @@ -609,11 +587,9 @@ D3DXVECTOR4::operator != ( CONST D3DXVECTOR4& v ) const return x != v.x || y != v.y || z != v.z || w != v.w; } - - -//-------------------------- -// 4D Vector (16 bit) -//-------------------------- +/* + * 4D Vector (16 bit) + */ D3DXINLINE D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST FLOAT *pf ) @@ -646,8 +622,7 @@ D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST D3DXFLOAT16 &fx, CONST D3DXFLOAT16 &fy, w = fw; } - -// casting +/* casting */ D3DXINLINE D3DXVECTOR4_16F::operator D3DXFLOAT16* () { @@ -660,8 +635,7 @@ D3DXVECTOR4_16F::operator CONST D3DXFLOAT16* () const return (CONST D3DXFLOAT16*) &x; } - -// binary operators +/* binary operators */ D3DXINLINE BOOL D3DXVECTOR4_16F::operator == ( CONST D3DXVECTOR4_16F &v ) const { @@ -677,9 +651,9 @@ D3DXVECTOR4_16F::operator != ( CONST D3DXVECTOR4_16F &v ) const } -//-------------------------- -// Matrix -//-------------------------- +/* + * Matrix + */ D3DXINLINE D3DXMATRIX::D3DXMATRIX( CONST FLOAT* pf ) { @@ -710,9 +684,7 @@ D3DXMATRIX::D3DXMATRIX( FLOAT f11, FLOAT f12, FLOAT f13, FLOAT f14, _41 = f41; _42 = f42; _43 = f43; _44 = f44; } - - -// access grants +/* access grants */ D3DXINLINE FLOAT& D3DXMATRIX::operator () ( UINT iRow, UINT iCol ) { @@ -725,8 +697,7 @@ D3DXMATRIX::operator () ( UINT iRow, UINT iCol ) const return m[iRow][iCol]; } - -// casting operators +/* casting operators */ D3DXINLINE D3DXMATRIX::operator FLOAT* () { @@ -739,8 +710,7 @@ D3DXMATRIX::operator CONST FLOAT* () const return (CONST FLOAT *) &_11; } - -// assignment operators +/* assignment operators */ D3DXINLINE D3DXMATRIX& D3DXMATRIX::operator *= ( CONST D3DXMATRIX& mat ) { @@ -789,8 +759,7 @@ D3DXMATRIX::operator /= ( FLOAT f ) return *this; } - -// unary operators +/* unary operators */ D3DXINLINE D3DXMATRIX D3DXMATRIX::operator + () const { @@ -806,8 +775,7 @@ D3DXMATRIX::operator - () const -_41, -_42, -_43, -_44); } - -// binary operators +/* binary operators */ D3DXINLINE D3DXMATRIX D3DXMATRIX::operator * ( CONST D3DXMATRIX& mat ) const { @@ -876,11 +844,9 @@ D3DXMATRIX::operator != ( CONST D3DXMATRIX& mat ) const return 0 != memcmp(this, &mat, sizeof(D3DXMATRIX)); } - - -//-------------------------- -// Aligned Matrices -//-------------------------- +/* + * Aligned Matrices + */ D3DXINLINE _D3DXMATRIXA16::_D3DXMATRIXA16( CONST FLOAT* f ) : @@ -975,10 +941,9 @@ _D3DXMATRIXA16::operator=(CONST D3DXMATRIX& rhs) return *this; } - -//-------------------------- -// Quaternion -//-------------------------- +/* + * Quaternion + */ D3DXINLINE D3DXQUATERNION::D3DXQUATERNION( CONST FLOAT* pf ) @@ -1004,8 +969,7 @@ D3DXQUATERNION::D3DXQUATERNION( FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw ) w = fw; } - -// casting +/* casting */ D3DXINLINE D3DXQUATERNION::operator FLOAT* () { @@ -1018,8 +982,7 @@ D3DXQUATERNION::operator CONST FLOAT* () const return (CONST FLOAT *) &x; } - -// assignment operators +/* assignment operators */ D3DXINLINE D3DXQUATERNION& D3DXQUATERNION::operator += ( CONST D3DXQUATERNION& q ) { @@ -1068,8 +1031,7 @@ D3DXQUATERNION::operator /= ( FLOAT f ) return *this; } - -// unary operators +/* unary operators */ D3DXINLINE D3DXQUATERNION D3DXQUATERNION::operator + () const { @@ -1082,8 +1044,7 @@ D3DXQUATERNION::operator - () const return D3DXQUATERNION(-x, -y, -z, -w); } - -// binary operators +/* binary operators */ D3DXINLINE D3DXQUATERNION D3DXQUATERNION::operator + ( CONST D3DXQUATERNION& q ) const { @@ -1137,11 +1098,9 @@ D3DXQUATERNION::operator != ( CONST D3DXQUATERNION& q ) const return x != q.x || y != q.y || z != q.z || w != q.w; } - - -//-------------------------- -// Plane -//-------------------------- +/* + * Plane + */ D3DXINLINE D3DXPLANE::D3DXPLANE( CONST FLOAT* pf ) @@ -1167,8 +1126,7 @@ D3DXPLANE::D3DXPLANE( FLOAT fa, FLOAT fb, FLOAT fc, FLOAT fd ) d = fd; } - -// casting +/* casting */ D3DXINLINE D3DXPLANE::operator FLOAT* () { @@ -1181,8 +1139,7 @@ D3DXPLANE::operator CONST FLOAT* () const return (CONST FLOAT *) &a; } - -// assignment operators +/* assignment operators */ D3DXINLINE D3DXPLANE& D3DXPLANE::operator *= ( FLOAT f ) { @@ -1204,8 +1161,7 @@ D3DXPLANE::operator /= ( FLOAT f ) return *this; } - -// unary operators +/* unary operators */ D3DXINLINE D3DXPLANE D3DXPLANE::operator + () const { @@ -1218,8 +1174,7 @@ D3DXPLANE::operator - () const return D3DXPLANE(-a, -b, -c, -d); } - -// binary operators +/* binary operators */ D3DXINLINE D3DXPLANE D3DXPLANE::operator * ( FLOAT f ) const { @@ -1251,12 +1206,9 @@ D3DXPLANE::operator != ( CONST D3DXPLANE& p ) const return a != p.a || b != p.b || c != p.c || d != p.d; } - - - -//-------------------------- -// Color -//-------------------------- +/* + * Color + */ D3DXINLINE D3DXCOLOR::D3DXCOLOR( DWORD dw ) @@ -1301,8 +1253,7 @@ D3DXCOLOR::D3DXCOLOR( FLOAT fr, FLOAT fg, FLOAT fb, FLOAT fa ) a = fa; } - -// casting +/* casting */ D3DXINLINE D3DXCOLOR::operator DWORD () const { @@ -1353,8 +1304,7 @@ D3DXCOLOR::operator CONST D3DCOLORVALUE& () const return *((CONST D3DCOLORVALUE *) &r); } - -// assignment operators +/* assignment operators */ D3DXINLINE D3DXCOLOR& D3DXCOLOR::operator += ( CONST D3DXCOLOR& c ) { @@ -1396,8 +1346,7 @@ D3DXCOLOR::operator /= ( FLOAT f ) return *this; } - -// unary operators +/* unary operators */ D3DXINLINE D3DXCOLOR D3DXCOLOR::operator + () const { @@ -1410,8 +1359,7 @@ D3DXCOLOR::operator - () const return D3DXCOLOR(-r, -g, -b, -a); } - -// binary operators +/* binary operators */ D3DXINLINE D3DXCOLOR D3DXCOLOR::operator + ( CONST D3DXCOLOR& c ) const { @@ -1458,20 +1406,17 @@ D3DXCOLOR::operator != ( CONST D3DXCOLOR& c ) const } -#endif //__cplusplus +#endif /*__cplusplus */ + +/* + * + * Inline functions + */ - -//=========================================================================== -// -// Inline functions -// -//=========================================================================== - - -//-------------------------- -// 2D Vector -//-------------------------- +/* + * 2D Vector + */ D3DXINLINE FLOAT D3DXVec2Length ( CONST D3DXVECTOR2 *pV ) @@ -1550,10 +1495,9 @@ D3DXINLINE D3DXVECTOR2* D3DXVec2Lerp return pOut; } - -//-------------------------- -// 3D Vector -//-------------------------- +/* + * 3D Vector + */ D3DXINLINE FLOAT D3DXVec3Length ( CONST D3DXVECTOR3 *pV ) @@ -1646,9 +1590,9 @@ D3DXINLINE D3DXVECTOR3* D3DXVec3Lerp } -//-------------------------- -// 4D Vector -//-------------------------- +/* + * 4D Vector + */ D3DXINLINE FLOAT D3DXVec4Length ( CONST D3DXVECTOR4 *pV ) @@ -1734,9 +1678,9 @@ D3DXINLINE D3DXVECTOR4* D3DXVec4Lerp } -//-------------------------- -// 4D Matrix -//-------------------------- +/* + * 4D Matrix + */ D3DXINLINE D3DXMATRIX* D3DXMatrixIdentity ( D3DXMATRIX *pOut ) @@ -1761,9 +1705,9 @@ D3DXINLINE BOOL D3DXMatrixIsIdentity } -//-------------------------- -// Quaternion -//-------------------------- +/* + * Quaternion + */ D3DXINLINE FLOAT D3DXQuaternionLength ( CONST D3DXQUATERNION *pQ ) @@ -1813,10 +1757,9 @@ D3DXINLINE D3DXQUATERNION* D3DXQuaternionConjugate return pOut; } - -//-------------------------- -// Plane -//-------------------------- +/* + * Plane + */ D3DXINLINE FLOAT D3DXPlaneDot ( CONST D3DXPLANE *pP, CONST D3DXVECTOR4 *pV) @@ -1847,9 +1790,9 @@ D3DXINLINE D3DXPLANE* D3DXPlaneScale } -//-------------------------- -// Color -//-------------------------- +/* + * Color + */ D3DXINLINE D3DXCOLOR* D3DXColorNegative (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC) @@ -1912,4 +1855,4 @@ D3DXINLINE D3DXCOLOR* D3DXColorLerp } -#endif // __D3DX9MATH_INL__ +#endif /* __D3DX9MATH_INL__ */ diff --git a/gfx/include/d3d9/d3dx9xof.h b/gfx/include/d3d9/d3dx9xof.h index b581e0c858..1e0a249e37 100644 --- a/gfx/include/d3d9/d3dx9xof.h +++ b/gfx/include/d3d9/d3dx9xof.h @@ -34,59 +34,59 @@ typedef DWORD D3DXF_FILELOADOPTIONS; #define D3DXF_FILELOAD_FROMRESOURCE 0x02L #define D3DXF_FILELOAD_FROMMEMORY 0x03L -//---------------------------------------------------------------------------- -// D3DXF_FILELOADRESOURCE: -//---------------------------------------------------------------------------- +/* + * D3DXF_FILELOADRESOURCE: +*/ typedef struct _D3DXF_FILELOADRESOURCE { - HMODULE hModule; // Desc - LPCSTR lpName; // Desc - LPCSTR lpType; // Desc + HMODULE hModule; /* Desc */ + LPCSTR lpName; /* Desc */ + LPCSTR lpType; /* Desc */ } D3DXF_FILELOADRESOURCE; -//---------------------------------------------------------------------------- -// D3DXF_FILELOADMEMORY: -//---------------------------------------------------------------------------- +/* + * D3DXF_FILELOADMEMORY: + */ typedef struct _D3DXF_FILELOADMEMORY { - LPCVOID lpMemory; // Desc - SIZE_T dSize; // Desc + LPCVOID lpMemory; /* Desc */ + SIZE_T dSize; /* Desc */ } D3DXF_FILELOADMEMORY; #if defined( _WIN32 ) && !defined( _NO_COM ) -// {cef08cf9-7b4f-4429-9624-2a690a933201} +/* {cef08cf9-7b4f-4429-9624-2a690a933201} */ DEFINE_GUID( IID_ID3DXFile, 0xcef08cf9, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); -// {cef08cfa-7b4f-4429-9624-2a690a933201} +/* {cef08cfa-7b4f-4429-9624-2a690a933201} */ DEFINE_GUID( IID_ID3DXFileSaveObject, 0xcef08cfa, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); -// {cef08cfb-7b4f-4429-9624-2a690a933201} +/* {cef08cfb-7b4f-4429-9624-2a690a933201} */ DEFINE_GUID( IID_ID3DXFileSaveData, 0xcef08cfb, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); -// {cef08cfc-7b4f-4429-9624-2a690a933201} +/* {cef08cfc-7b4f-4429-9624-2a690a933201} */ DEFINE_GUID( IID_ID3DXFileEnumObject, 0xcef08cfc, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); -// {cef08cfd-7b4f-4429-9624-2a690a933201} +/* {cef08cfd-7b4f-4429-9624-2a690a933201} */ DEFINE_GUID( IID_ID3DXFileData, 0xcef08cfd, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); -#endif // defined( _WIN32 ) && !defined( _NO_COM ) +#endif /* defined( _WIN32 ) && !defined( _NO_COM ) */ #if defined( __cplusplus ) #if !defined( DECLSPEC_UUID ) #if _MSC_VER >= 1100 #define DECLSPEC_UUID( x ) __declspec( uuid( x ) ) -#else // !( _MSC_VER >= 1100 ) +#else /* !( _MSC_VER >= 1100 ) */ #define DECLSPEC_UUID( x ) -#endif // !( _MSC_VER >= 1100 ) -#endif // !defined( DECLSPEC_UUID ) +#endif /* !( _MSC_VER >= 1100 ) */ +#endif /* !defined( DECLSPEC_UUID ) */ interface DECLSPEC_UUID( "cef08cf9-7b4f-4429-9624-2a690a933201" ) ID3DXFile; @@ -110,8 +110,8 @@ _COM_SMARTPTR_TYPEDEF( ID3DXFileEnumObject, __uuidof( ID3DXFileEnumObject ) ); _COM_SMARTPTR_TYPEDEF( ID3DXFileData, __uuidof( ID3DXFileData ) ); -#endif // defined( _COM_SMARTPTR_TYPEDEF ) -#endif // defined( __cplusplus ) +#endif /* defined( _COM_SMARTPTR_TYPEDEF ) */ +#endif /* defined( __cplusplus ) */ typedef interface ID3DXFile ID3DXFile; typedef interface ID3DXFileSaveObject ID3DXFileSaveObject; @@ -119,9 +119,9 @@ typedef interface ID3DXFileSaveData ID3DXFileSaveData; typedef interface ID3DXFileEnumObject ID3DXFileEnumObject; typedef interface ID3DXFileData ID3DXFileData; -////////////////////////////////////////////////////////////////////////////// -// ID3DXFile ///////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// +/* + * ID3DXFile + */ #undef INTERFACE #define INTERFACE ID3DXFile @@ -140,9 +140,9 @@ DECLARE_INTERFACE_( ID3DXFile, IUnknown ) STDMETHOD( RegisterEnumTemplates )( THIS_ ID3DXFileEnumObject* ) PURE; }; -////////////////////////////////////////////////////////////////////////////// -// ID3DXFileSaveObject /////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// +/* + * ID3DXFileSaveObject + */ #undef INTERFACE #define INTERFACE ID3DXFileSaveObject @@ -159,9 +159,9 @@ DECLARE_INTERFACE_( ID3DXFileSaveObject, IUnknown ) STDMETHOD( Save )( THIS ) PURE; }; -////////////////////////////////////////////////////////////////////////////// -// ID3DXFileSaveData ///////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// +/* + * ID3DXFileSaveData + */ #undef INTERFACE #define INTERFACE ID3DXFileSaveData @@ -181,9 +181,9 @@ DECLARE_INTERFACE_( ID3DXFileSaveData, IUnknown ) STDMETHOD( AddDataReference )( THIS_ LPCSTR, CONST GUID* ) PURE; }; -////////////////////////////////////////////////////////////////////////////// -// ID3DXFileEnumObject /////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// +/* + * ID3DXFileEnumObject + */ #undef INTERFACE #define INTERFACE ID3DXFileEnumObject @@ -201,9 +201,9 @@ DECLARE_INTERFACE_( ID3DXFileEnumObject, IUnknown ) STDMETHOD( GetDataObjectByName )( THIS_ LPCSTR, ID3DXFileData** ) PURE; }; -////////////////////////////////////////////////////////////////////////////// -// ID3DXFileData ///////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// +/* + * ID3DXFileData + */ #undef INTERFACE #define INTERFACE ID3DXFileData diff --git a/menu/drivers_display/menu_display_d3d11.c b/menu/drivers_display/menu_display_d3d11.c index 15318c4ee9..2dfb3aca2e 100644 --- a/menu/drivers_display/menu_display_d3d11.c +++ b/menu/drivers_display/menu_display_d3d11.c @@ -26,11 +26,20 @@ #include "../../gfx/video_driver.h" #include "../../gfx/common/d3d11_common.h" -static const float* menu_display_d3d11_get_default_vertices(void) { return NULL; } +static const float* menu_display_d3d11_get_default_vertices(void) +{ + return NULL; +} -static const float* menu_display_d3d11_get_default_tex_coords(void) { return NULL; } +static const float* menu_display_d3d11_get_default_tex_coords(void) +{ + return NULL; +} -static void* menu_display_d3d11_get_default_mvp(void) { return NULL; } +static void* menu_display_d3d11_get_default_mvp(void) +{ + return NULL; +} static void menu_display_d3d11_blend_begin(void) { @@ -44,7 +53,9 @@ static void menu_display_d3d11_blend_end(void) D3D11SetBlendState(d3d11->ctx, d3d11->blend_disable, NULL, D3D11_DEFAULT_SAMPLE_MASK); } -static void menu_display_d3d11_viewport(void* data) {} +static void menu_display_d3d11_viewport(void* data) +{ +} static void menu_display_d3d11_draw(void* data) { @@ -80,14 +91,17 @@ static void menu_display_d3d11_draw(void* data) { D3D11_MAPPED_SUBRESOURCE mapped_vbo; + d3d11_sprite_t *v = NULL; + D3D11MapBuffer( d3d11->ctx, d3d11->sprites.vbo, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &mapped_vbo); - d3d11_sprite_t* v = (d3d11_sprite_t*)mapped_vbo.pData + d3d11->sprites.offset; - v->pos.x = draw->x / (float)d3d11->viewport.Width; - v->pos.y = (d3d11->viewport.Height - draw->y - draw->height) / (float)d3d11->viewport.Height; - v->pos.w = draw->width / (float)d3d11->viewport.Width; - v->pos.h = draw->height / (float)d3d11->viewport.Height; + v = (d3d11_sprite_t*)mapped_vbo.pData + d3d11->sprites.offset; + + v->pos.x = draw->x / (float)d3d11->viewport.Width; + v->pos.y = (d3d11->viewport.Height - draw->y - draw->height) / (float)d3d11->viewport.Height; + v->pos.w = draw->width / (float)d3d11->viewport.Width; + v->pos.h = draw->height / (float)d3d11->viewport.Height; v->coords.u = 0.0f; v->coords.v = 0.0f; @@ -117,19 +131,18 @@ static void menu_display_d3d11_draw(void* data) D3D11UnmapBuffer(d3d11->ctx, d3d11->sprites.vbo, 0); } - d3d11_set_texture_and_sampler(d3d11->ctx, 0, (d3d11_texture_t*)draw->texture); + d3d11_set_texture_and_sampler(d3d11->ctx, 0, + (d3d11_texture_t*)draw->texture); D3D11Draw(d3d11->ctx, 1, d3d11->sprites.offset); d3d11->sprites.offset++; - return; } static void menu_display_d3d11_draw_pipeline(void* data) { + video_coord_array_t *ca = NULL; menu_display_ctx_draw_t* draw = (menu_display_ctx_draw_t*)data; d3d11_video_t* d3d11 = (d3d11_video_t*)video_driver_get_ptr(false); - video_coord_array_t* ca = NULL; - if (!d3d11 || !draw) return; @@ -137,7 +150,6 @@ static void menu_display_d3d11_draw_pipeline(void* data) { case VIDEO_SHADER_MENU: case VIDEO_SHADER_MENU_2: - { ca = menu_display_get_coords_array(); if (!d3d11->menu_pipeline_vbo) @@ -154,7 +166,6 @@ static void menu_display_d3d11_draw_pipeline(void* data) draw->coords->vertices = ca->coords.vertices; D3D11SetBlendState(d3d11->ctx, d3d11->blend_pipeline, NULL, D3D11_DEFAULT_SAMPLE_MASK); break; - } case VIDEO_SHADER_MENU_3: case VIDEO_SHADER_MENU_4: @@ -178,7 +189,9 @@ static void menu_display_d3d11_draw_pipeline(void* data) } } -static void menu_display_d3d11_restore_clear_color(void) {} +static void menu_display_d3d11_restore_clear_color(void) +{ +} static void menu_display_d3d11_clear_color(menu_display_ctx_clearcolor_t* clearcolor) {