mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 22:13:51 +00:00
Revert "* d3d11.c - minor cleanups for C89"
This reverts commit fa458b2f5ce7e5216854719c287de7bbde9cdc77.
This commit is contained in:
parent
fa458b2f5c
commit
0b4ccf25e7
@ -37,10 +37,9 @@
|
||||
|
||||
static void d3d11_set_filtering(void* data, unsigned index, bool smooth)
|
||||
{
|
||||
unsigned i;
|
||||
d3d11_video_t* d3d11 = (d3d11_video_t*)data;
|
||||
|
||||
for (i = 0; i < RARCH_WRAP_MAX; i++)
|
||||
for (int i = 0; i < RARCH_WRAP_MAX; i++)
|
||||
{
|
||||
if (smooth)
|
||||
d3d11->samplers[RARCH_FILTER_UNSPEC][i] = d3d11->samplers[RARCH_FILTER_LINEAR][i];
|
||||
@ -94,14 +93,11 @@ 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 (i = 0; i < d3d11->shader_preset->passes; i++)
|
||||
for (int 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);
|
||||
@ -109,7 +105,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 (j = 0; j < SLANG_CBUFFER_MAX; j++)
|
||||
for (int j = 0; j < SLANG_CBUFFER_MAX; j++)
|
||||
{
|
||||
free(d3d11->pass[i].semantics.cbuffers[j].uniforms);
|
||||
Release(d3d11->pass[i].buffers[j]);
|
||||
@ -118,7 +114,7 @@ static void d3d11_free_shader_preset(d3d11_video_t* d3d11)
|
||||
|
||||
memset(d3d11->pass, 0, sizeof(d3d11->pass));
|
||||
|
||||
for (i = 0; i < d3d11->shader_preset->luts; i++)
|
||||
for (int i = 0; i < d3d11->shader_preset->luts; i++)
|
||||
d3d11_release_texture(&d3d11->luts[i]);
|
||||
|
||||
memset(d3d11->luts, 0, sizeof(d3d11->luts));
|
||||
@ -129,10 +125,7 @@ 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)
|
||||
{
|
||||
unsigned i, j;
|
||||
config_file_t *conf = NULL;
|
||||
d3d11_texture_t *source = NULL;
|
||||
d3d11_video_t *d3d11 = (d3d11_video_t*)data;
|
||||
d3d11_video_t* d3d11 = (d3d11_video_t*)data;
|
||||
|
||||
if (!d3d11)
|
||||
return false;
|
||||
@ -151,7 +144,7 @@ static bool d3d11_gfx_set_shader(void* data, enum rarch_shader_type type, const
|
||||
return false;
|
||||
}
|
||||
|
||||
conf = config_file_new(path);
|
||||
config_file_t* conf = config_file_new(path);
|
||||
|
||||
if (!conf)
|
||||
return false;
|
||||
@ -163,74 +156,75 @@ static bool d3d11_gfx_set_shader(void* data, enum rarch_shader_type type, const
|
||||
|
||||
video_shader_resolve_relative(d3d11->shader_preset, path);
|
||||
|
||||
source = &d3d11->frame.texture;
|
||||
|
||||
for (i = 0; i < d3d11->shader_preset->passes; i++)
|
||||
d3d11_texture_t* source = &d3d11->frame.texture;
|
||||
for (int 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),
|
||||
};
|
||||
|
||||
{
|
||||
texture_map_t* ptr = texture_map;
|
||||
while (ptr->texture_data)
|
||||
ptr++;
|
||||
/* 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),
|
||||
};
|
||||
|
||||
for (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++;
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
||||
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++;
|
||||
}
|
||||
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 < 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++;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
@ -255,13 +249,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)
|
||||
@ -285,7 +279,7 @@ static bool d3d11_gfx_set_shader(void* data, enum rarch_shader_type type, const
|
||||
goto error;
|
||||
}
|
||||
|
||||
for (j = 0; j < SLANG_CBUFFER_MAX; j++)
|
||||
for (int j = 0; j < SLANG_CBUFFER_MAX; j++)
|
||||
{
|
||||
D3D11_BUFFER_DESC desc = {
|
||||
.ByteWidth = d3d11->pass[i].semantics.cbuffers[j].size,
|
||||
@ -297,14 +291,13 @@ 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 (i = 0; i < d3d11->shader_preset->luts; i++)
|
||||
for (int i = 0; i < d3d11->shader_preset->luts; i++)
|
||||
{
|
||||
struct texture_image image = { 0 };
|
||||
image.supports_rgba = true;
|
||||
@ -321,15 +314,13 @@ 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);
|
||||
@ -344,7 +335,6 @@ error:
|
||||
|
||||
static void d3d11_gfx_free(void* data)
|
||||
{
|
||||
unsigned i;
|
||||
d3d11_video_t* d3d11 = (d3d11_video_t*)data;
|
||||
|
||||
if (!d3d11)
|
||||
@ -379,7 +369,7 @@ static void d3d11_gfx_free(void* data)
|
||||
Release(d3d11->blend_enable);
|
||||
Release(d3d11->blend_disable);
|
||||
|
||||
for (i = 0; i < RARCH_WRAP_MAX; i++)
|
||||
for (int i = 0; i < RARCH_WRAP_MAX; i++)
|
||||
{
|
||||
Release(d3d11->samplers[RARCH_FILTER_LINEAR][i]);
|
||||
Release(d3d11->samplers[RARCH_FILTER_NEAREST][i]);
|
||||
@ -399,13 +389,12 @@ 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)
|
||||
{
|
||||
unsigned i;
|
||||
WNDCLASSEX wndclass = { 0 };
|
||||
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));
|
||||
|
||||
@ -463,10 +452,8 @@ static void *d3d11_gfx_init(const video_info_t* video,
|
||||
#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);
|
||||
}
|
||||
|
||||
@ -485,8 +472,7 @@ static void *d3d11_gfx_init(const video_info_t* video,
|
||||
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;
|
||||
@ -519,9 +505,8 @@ static void *d3d11_gfx_init(const video_info_t* video,
|
||||
.MinLOD = -D3D11_FLOAT32_MAX,
|
||||
.MaxLOD = D3D11_FLOAT32_MAX,
|
||||
};
|
||||
|
||||
/* Initialize samplers */
|
||||
for (i = 0; i < RARCH_WRAP_MAX; i++)
|
||||
for (int i = 0; i < RARCH_WRAP_MAX; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
@ -545,12 +530,10 @@ static void *d3d11_gfx_init(const video_info_t* video,
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -563,21 +546,23 @@ static void *d3d11_gfx_init(const video_info_t* video,
|
||||
{ { 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 };
|
||||
|
||||
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_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);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
@ -712,17 +697,14 @@ static void *d3d11_gfx_init(const video_info_t* video,
|
||||
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 = {
|
||||
@ -733,16 +715,14 @@ static void *d3d11_gfx_init(const video_info_t* video,
|
||||
}
|
||||
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;
|
||||
@ -751,15 +731,11 @@ 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 (i = 0; i < d3d11->shader_preset->passes; i++)
|
||||
for (int 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));
|
||||
@ -772,7 +748,7 @@ static bool d3d11_init_frame_textures(d3d11_video_t *d3d11,
|
||||
|
||||
if (d3d11->shader_preset)
|
||||
{
|
||||
for (i = 0; i < d3d11->shader_preset->passes; i++)
|
||||
for (int i = 0; i < d3d11->shader_preset->passes; i++)
|
||||
{
|
||||
struct video_shader_pass* pass = &d3d11->shader_preset->pass[i];
|
||||
|
||||
@ -827,17 +803,14 @@ static bool d3d11_init_frame_textures(d3d11_video_t *d3d11,
|
||||
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;
|
||||
@ -845,8 +818,7 @@ static bool d3d11_init_frame_textures(d3d11_video_t *d3d11,
|
||||
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)
|
||||
@ -887,7 +859,6 @@ 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)
|
||||
@ -917,40 +888,33 @@ static bool d3d11_gfx_frame(
|
||||
|
||||
PERF_START();
|
||||
|
||||
/* custom viewport doesn't call apply_state_changes,
|
||||
* so we can't rely on this for now */
|
||||
#if 0
|
||||
#if 0 /* custom viewport doesn't call apply_state_changes, so we can't rely on this for now */
|
||||
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 (i = 0; i < d3d11->shader_preset->passes; i++)
|
||||
for (int i = 0; i < d3d11->shader_preset->passes; i++)
|
||||
{
|
||||
if (d3d11->shader_preset->pass[i].feedback)
|
||||
{
|
||||
@ -960,22 +924,21 @@ static bool d3d11_gfx_frame(
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < d3d11->shader_preset->passes; i++)
|
||||
for (int 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)
|
||||
{
|
||||
D3D11ShaderResourceView view = *(D3D11ShaderResourceView*)
|
||||
texture_sem->texture_data;
|
||||
D3D11SamplerStateRef sampler = *(D3D11SamplerStateRef*)
|
||||
texture_sem->sampler_data;
|
||||
texture_sem_t* texture_sem = d3d11->pass[i].semantics.textures;
|
||||
|
||||
d3d11->pass[i].textures[texture_sem->binding] = view;
|
||||
d3d11->pass[i].samplers[texture_sem->binding] = sampler;
|
||||
while (texture_sem->stage_mask)
|
||||
{
|
||||
D3D11ShaderResourceView view = *(D3D11ShaderResourceView*)texture_sem->texture_data;
|
||||
D3D11SamplerStateRef sampler = *(D3D11SamplerStateRef*)texture_sem->sampler_data;
|
||||
|
||||
texture_sem++;
|
||||
d3d11->pass[i].textures[texture_sem->binding] = view;
|
||||
d3d11->pass[i].samplers[texture_sem->binding] = sampler;
|
||||
|
||||
texture_sem++;
|
||||
}
|
||||
}
|
||||
|
||||
if (d3d11->shader_preset->pass[i].frame_count_mod)
|
||||
@ -984,7 +947,7 @@ static bool d3d11_gfx_frame(
|
||||
else
|
||||
d3d11->pass[i].frame_count = frame_count;
|
||||
|
||||
for (j = 0; j < SLANG_CBUFFER_MAX; j++)
|
||||
for (int 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];
|
||||
@ -994,25 +957,20 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1020,17 +978,13 @@ static bool d3d11_gfx_frame(
|
||||
|
||||
D3D11RenderTargetView null_rt = NULL;
|
||||
D3D11SetRenderTargets(d3d11->ctx, 1, &null_rt, NULL);
|
||||
D3D11SetPShaderResources(d3d11->ctx, 0, SLANG_NUM_BINDINGS,
|
||||
(ID3D11ShaderResourceView * const*)d3d11->pass[i].textures);
|
||||
D3D11SetPShaderSamplers(d3d11->ctx, 0, SLANG_NUM_BINDINGS,
|
||||
d3d11->pass[i].samplers);
|
||||
D3D11SetPShaderResources(d3d11->ctx, 0, SLANG_NUM_BINDINGS, 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);
|
||||
@ -1050,30 +1004,24 @@ 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,
|
||||
(const ID3D11SamplerState**)
|
||||
&d3d11->samplers[RARCH_FILTER_UNSPEC][RARCH_WRAP_DEFAULT]);
|
||||
d3d11->ctx, 0, 1, &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);
|
||||
@ -1082,10 +1030,8 @@ 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);
|
||||
|
||||
@ -1122,22 +1068,15 @@ 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)
|
||||
{
|
||||
@ -1169,8 +1108,7 @@ 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;
|
||||
@ -1179,16 +1117,12 @@ static bool d3d11_gfx_read_viewport(void* data,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -1196,16 +1130,14 @@ 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;
|
||||
|
||||
@ -1216,8 +1148,7 @@ static void d3d11_set_menu_texture_enable(void* data, bool state,
|
||||
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;
|
||||
|
||||
@ -1237,8 +1168,7 @@ 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;
|
||||
|
||||
@ -1251,8 +1181,7 @@ 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;
|
||||
@ -1269,15 +1198,13 @@ 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;
|
||||
}
|
||||
|
||||
@ -1288,8 +1215,7 @@ 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;
|
||||
@ -1331,8 +1257,7 @@ 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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,24 +1,26 @@
|
||||
/*
|
||||
*
|
||||
* 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 )
|
||||
@ -32,7 +34,7 @@ D3DXFLOAT16::D3DXFLOAT16( CONST D3DXFLOAT16& f )
|
||||
value = f.value;
|
||||
}
|
||||
|
||||
/* casting */
|
||||
// casting
|
||||
D3DXINLINE
|
||||
D3DXFLOAT16::operator FLOAT ()
|
||||
{
|
||||
@ -41,7 +43,7 @@ D3DXFLOAT16::operator FLOAT ()
|
||||
return f;
|
||||
}
|
||||
|
||||
/* binary operators */
|
||||
// binary operators
|
||||
D3DXINLINE BOOL
|
||||
D3DXFLOAT16::operator == ( CONST D3DXFLOAT16& f ) const
|
||||
{
|
||||
@ -55,9 +57,9 @@ D3DXFLOAT16::operator != ( CONST D3DXFLOAT16& f ) const
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 2D Vector
|
||||
*/
|
||||
//--------------------------
|
||||
// 2D Vector
|
||||
//--------------------------
|
||||
|
||||
D3DXINLINE
|
||||
D3DXVECTOR2::D3DXVECTOR2( CONST FLOAT *pf )
|
||||
@ -79,7 +81,8 @@ D3DXVECTOR2::D3DXVECTOR2( FLOAT fx, FLOAT fy )
|
||||
y = fy;
|
||||
}
|
||||
|
||||
/* casting */
|
||||
|
||||
// casting
|
||||
D3DXINLINE
|
||||
D3DXVECTOR2::operator FLOAT* ()
|
||||
{
|
||||
@ -92,7 +95,8 @@ D3DXVECTOR2::operator CONST FLOAT* () const
|
||||
return (CONST FLOAT *) &x;
|
||||
}
|
||||
|
||||
/* assignment operators */
|
||||
|
||||
// assignment operators
|
||||
D3DXINLINE D3DXVECTOR2&
|
||||
D3DXVECTOR2::operator += ( CONST D3DXVECTOR2& v )
|
||||
{
|
||||
@ -126,7 +130,8 @@ D3DXVECTOR2::operator /= ( FLOAT f )
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* unary operators */
|
||||
|
||||
// unary operators
|
||||
D3DXINLINE D3DXVECTOR2
|
||||
D3DXVECTOR2::operator + () const
|
||||
{
|
||||
@ -139,7 +144,8 @@ D3DXVECTOR2::operator - () const
|
||||
return D3DXVECTOR2(-x, -y);
|
||||
}
|
||||
|
||||
/* binary operators */
|
||||
|
||||
// binary operators
|
||||
D3DXINLINE D3DXVECTOR2
|
||||
D3DXVECTOR2::operator + ( CONST D3DXVECTOR2& v ) const
|
||||
{
|
||||
@ -183,9 +189,11 @@ 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 )
|
||||
@ -206,7 +214,8 @@ D3DXVECTOR2_16F::D3DXVECTOR2_16F( CONST D3DXFLOAT16 &fx, CONST D3DXFLOAT16 &fy )
|
||||
y = fy;
|
||||
}
|
||||
|
||||
/* casting */
|
||||
|
||||
// casting
|
||||
D3DXINLINE
|
||||
D3DXVECTOR2_16F::operator D3DXFLOAT16* ()
|
||||
{
|
||||
@ -219,7 +228,8 @@ D3DXVECTOR2_16F::operator CONST D3DXFLOAT16* () const
|
||||
return (CONST D3DXFLOAT16*) &x;
|
||||
}
|
||||
|
||||
/* binary operators */
|
||||
|
||||
// binary operators
|
||||
D3DXINLINE BOOL
|
||||
D3DXVECTOR2_16F::operator == ( CONST D3DXVECTOR2_16F &v ) const
|
||||
{
|
||||
@ -233,9 +243,9 @@ D3DXVECTOR2_16F::operator != ( CONST D3DXVECTOR2_16F &v ) const
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 3D Vector
|
||||
*/
|
||||
//--------------------------
|
||||
// 3D Vector
|
||||
//--------------------------
|
||||
D3DXINLINE
|
||||
D3DXVECTOR3::D3DXVECTOR3( CONST FLOAT *pf )
|
||||
{
|
||||
@ -266,7 +276,8 @@ D3DXVECTOR3::D3DXVECTOR3( FLOAT fx, FLOAT fy, FLOAT fz )
|
||||
z = fz;
|
||||
}
|
||||
|
||||
/* casting */
|
||||
|
||||
// casting
|
||||
D3DXINLINE
|
||||
D3DXVECTOR3::operator FLOAT* ()
|
||||
{
|
||||
@ -279,7 +290,8 @@ D3DXVECTOR3::operator CONST FLOAT* () const
|
||||
return (CONST FLOAT *) &x;
|
||||
}
|
||||
|
||||
/* assignment operators */
|
||||
|
||||
// assignment operators
|
||||
D3DXINLINE D3DXVECTOR3&
|
||||
D3DXVECTOR3::operator += ( CONST D3DXVECTOR3& v )
|
||||
{
|
||||
@ -317,7 +329,8 @@ D3DXVECTOR3::operator /= ( FLOAT f )
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* unary operators */
|
||||
|
||||
// unary operators
|
||||
D3DXINLINE D3DXVECTOR3
|
||||
D3DXVECTOR3::operator + () const
|
||||
{
|
||||
@ -330,7 +343,8 @@ D3DXVECTOR3::operator - () const
|
||||
return D3DXVECTOR3(-x, -y, -z);
|
||||
}
|
||||
|
||||
/* binary operators */
|
||||
|
||||
// binary operators
|
||||
D3DXINLINE D3DXVECTOR3
|
||||
D3DXVECTOR3::operator + ( CONST D3DXVECTOR3& v ) const
|
||||
{
|
||||
@ -376,9 +390,11 @@ 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 )
|
||||
@ -409,7 +425,8 @@ D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST D3DXFLOAT16 &fx, CONST D3DXFLOAT16 &fy,
|
||||
z = fz;
|
||||
}
|
||||
|
||||
/* casting */
|
||||
|
||||
// casting
|
||||
D3DXINLINE
|
||||
D3DXVECTOR3_16F::operator D3DXFLOAT16* ()
|
||||
{
|
||||
@ -422,7 +439,8 @@ D3DXVECTOR3_16F::operator CONST D3DXFLOAT16* () const
|
||||
return (CONST D3DXFLOAT16*) &x;
|
||||
}
|
||||
|
||||
/* binary operators */
|
||||
|
||||
// binary operators
|
||||
D3DXINLINE BOOL
|
||||
D3DXVECTOR3_16F::operator == ( CONST D3DXVECTOR3_16F &v ) const
|
||||
{
|
||||
@ -438,9 +456,9 @@ D3DXVECTOR3_16F::operator != ( CONST D3DXVECTOR3_16F &v ) const
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 4D Vector
|
||||
*/
|
||||
//--------------------------
|
||||
// 4D Vector
|
||||
//--------------------------
|
||||
D3DXINLINE
|
||||
D3DXVECTOR4::D3DXVECTOR4( CONST FLOAT *pf )
|
||||
{
|
||||
@ -474,7 +492,8 @@ D3DXVECTOR4::D3DXVECTOR4( FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw )
|
||||
w = fw;
|
||||
}
|
||||
|
||||
/* casting */
|
||||
|
||||
// casting
|
||||
D3DXINLINE
|
||||
D3DXVECTOR4::operator FLOAT* ()
|
||||
{
|
||||
@ -487,7 +506,8 @@ D3DXVECTOR4::operator CONST FLOAT* () const
|
||||
return (CONST FLOAT *) &x;
|
||||
}
|
||||
|
||||
/* assignment operators */
|
||||
|
||||
// assignment operators
|
||||
D3DXINLINE D3DXVECTOR4&
|
||||
D3DXVECTOR4::operator += ( CONST D3DXVECTOR4& v )
|
||||
{
|
||||
@ -529,7 +549,8 @@ D3DXVECTOR4::operator /= ( FLOAT f )
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* unary operators */
|
||||
|
||||
// unary operators
|
||||
D3DXINLINE D3DXVECTOR4
|
||||
D3DXVECTOR4::operator + () const
|
||||
{
|
||||
@ -542,7 +563,8 @@ D3DXVECTOR4::operator - () const
|
||||
return D3DXVECTOR4(-x, -y, -z, -w);
|
||||
}
|
||||
|
||||
/* binary operators */
|
||||
|
||||
// binary operators
|
||||
D3DXINLINE D3DXVECTOR4
|
||||
D3DXVECTOR4::operator + ( CONST D3DXVECTOR4& v ) const
|
||||
{
|
||||
@ -587,9 +609,11 @@ 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 )
|
||||
@ -622,7 +646,8 @@ D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST D3DXFLOAT16 &fx, CONST D3DXFLOAT16 &fy,
|
||||
w = fw;
|
||||
}
|
||||
|
||||
/* casting */
|
||||
|
||||
// casting
|
||||
D3DXINLINE
|
||||
D3DXVECTOR4_16F::operator D3DXFLOAT16* ()
|
||||
{
|
||||
@ -635,7 +660,8 @@ D3DXVECTOR4_16F::operator CONST D3DXFLOAT16* () const
|
||||
return (CONST D3DXFLOAT16*) &x;
|
||||
}
|
||||
|
||||
/* binary operators */
|
||||
|
||||
// binary operators
|
||||
D3DXINLINE BOOL
|
||||
D3DXVECTOR4_16F::operator == ( CONST D3DXVECTOR4_16F &v ) const
|
||||
{
|
||||
@ -651,9 +677,9 @@ D3DXVECTOR4_16F::operator != ( CONST D3DXVECTOR4_16F &v ) const
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Matrix
|
||||
*/
|
||||
//--------------------------
|
||||
// Matrix
|
||||
//--------------------------
|
||||
D3DXINLINE
|
||||
D3DXMATRIX::D3DXMATRIX( CONST FLOAT* pf )
|
||||
{
|
||||
@ -684,7 +710,9 @@ 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 )
|
||||
{
|
||||
@ -697,7 +725,8 @@ D3DXMATRIX::operator () ( UINT iRow, UINT iCol ) const
|
||||
return m[iRow][iCol];
|
||||
}
|
||||
|
||||
/* casting operators */
|
||||
|
||||
// casting operators
|
||||
D3DXINLINE
|
||||
D3DXMATRIX::operator FLOAT* ()
|
||||
{
|
||||
@ -710,7 +739,8 @@ D3DXMATRIX::operator CONST FLOAT* () const
|
||||
return (CONST FLOAT *) &_11;
|
||||
}
|
||||
|
||||
/* assignment operators */
|
||||
|
||||
// assignment operators
|
||||
D3DXINLINE D3DXMATRIX&
|
||||
D3DXMATRIX::operator *= ( CONST D3DXMATRIX& mat )
|
||||
{
|
||||
@ -759,7 +789,8 @@ D3DXMATRIX::operator /= ( FLOAT f )
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* unary operators */
|
||||
|
||||
// unary operators
|
||||
D3DXINLINE D3DXMATRIX
|
||||
D3DXMATRIX::operator + () const
|
||||
{
|
||||
@ -775,7 +806,8 @@ D3DXMATRIX::operator - () const
|
||||
-_41, -_42, -_43, -_44);
|
||||
}
|
||||
|
||||
/* binary operators */
|
||||
|
||||
// binary operators
|
||||
D3DXINLINE D3DXMATRIX
|
||||
D3DXMATRIX::operator * ( CONST D3DXMATRIX& mat ) const
|
||||
{
|
||||
@ -844,9 +876,11 @@ D3DXMATRIX::operator != ( CONST D3DXMATRIX& mat ) const
|
||||
return 0 != memcmp(this, &mat, sizeof(D3DXMATRIX));
|
||||
}
|
||||
|
||||
/*
|
||||
* Aligned Matrices
|
||||
*/
|
||||
|
||||
|
||||
//--------------------------
|
||||
// Aligned Matrices
|
||||
//--------------------------
|
||||
|
||||
D3DXINLINE
|
||||
_D3DXMATRIXA16::_D3DXMATRIXA16( CONST FLOAT* f ) :
|
||||
@ -941,9 +975,10 @@ _D3DXMATRIXA16::operator=(CONST D3DXMATRIX& rhs)
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*
|
||||
* Quaternion
|
||||
*/
|
||||
|
||||
//--------------------------
|
||||
// Quaternion
|
||||
//--------------------------
|
||||
|
||||
D3DXINLINE
|
||||
D3DXQUATERNION::D3DXQUATERNION( CONST FLOAT* pf )
|
||||
@ -969,7 +1004,8 @@ D3DXQUATERNION::D3DXQUATERNION( FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw )
|
||||
w = fw;
|
||||
}
|
||||
|
||||
/* casting */
|
||||
|
||||
// casting
|
||||
D3DXINLINE
|
||||
D3DXQUATERNION::operator FLOAT* ()
|
||||
{
|
||||
@ -982,7 +1018,8 @@ D3DXQUATERNION::operator CONST FLOAT* () const
|
||||
return (CONST FLOAT *) &x;
|
||||
}
|
||||
|
||||
/* assignment operators */
|
||||
|
||||
// assignment operators
|
||||
D3DXINLINE D3DXQUATERNION&
|
||||
D3DXQUATERNION::operator += ( CONST D3DXQUATERNION& q )
|
||||
{
|
||||
@ -1031,7 +1068,8 @@ D3DXQUATERNION::operator /= ( FLOAT f )
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* unary operators */
|
||||
|
||||
// unary operators
|
||||
D3DXINLINE D3DXQUATERNION
|
||||
D3DXQUATERNION::operator + () const
|
||||
{
|
||||
@ -1044,7 +1082,8 @@ D3DXQUATERNION::operator - () const
|
||||
return D3DXQUATERNION(-x, -y, -z, -w);
|
||||
}
|
||||
|
||||
/* binary operators */
|
||||
|
||||
// binary operators
|
||||
D3DXINLINE D3DXQUATERNION
|
||||
D3DXQUATERNION::operator + ( CONST D3DXQUATERNION& q ) const
|
||||
{
|
||||
@ -1098,9 +1137,11 @@ 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 )
|
||||
@ -1126,7 +1167,8 @@ D3DXPLANE::D3DXPLANE( FLOAT fa, FLOAT fb, FLOAT fc, FLOAT fd )
|
||||
d = fd;
|
||||
}
|
||||
|
||||
/* casting */
|
||||
|
||||
// casting
|
||||
D3DXINLINE
|
||||
D3DXPLANE::operator FLOAT* ()
|
||||
{
|
||||
@ -1139,7 +1181,8 @@ D3DXPLANE::operator CONST FLOAT* () const
|
||||
return (CONST FLOAT *) &a;
|
||||
}
|
||||
|
||||
/* assignment operators */
|
||||
|
||||
// assignment operators
|
||||
D3DXINLINE D3DXPLANE&
|
||||
D3DXPLANE::operator *= ( FLOAT f )
|
||||
{
|
||||
@ -1161,7 +1204,8 @@ D3DXPLANE::operator /= ( FLOAT f )
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* unary operators */
|
||||
|
||||
// unary operators
|
||||
D3DXINLINE D3DXPLANE
|
||||
D3DXPLANE::operator + () const
|
||||
{
|
||||
@ -1174,7 +1218,8 @@ D3DXPLANE::operator - () const
|
||||
return D3DXPLANE(-a, -b, -c, -d);
|
||||
}
|
||||
|
||||
/* binary operators */
|
||||
|
||||
// binary operators
|
||||
D3DXINLINE D3DXPLANE
|
||||
D3DXPLANE::operator * ( FLOAT f ) const
|
||||
{
|
||||
@ -1206,9 +1251,12 @@ 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 )
|
||||
@ -1253,7 +1301,8 @@ D3DXCOLOR::D3DXCOLOR( FLOAT fr, FLOAT fg, FLOAT fb, FLOAT fa )
|
||||
a = fa;
|
||||
}
|
||||
|
||||
/* casting */
|
||||
|
||||
// casting
|
||||
D3DXINLINE
|
||||
D3DXCOLOR::operator DWORD () const
|
||||
{
|
||||
@ -1304,7 +1353,8 @@ D3DXCOLOR::operator CONST D3DCOLORVALUE& () const
|
||||
return *((CONST D3DCOLORVALUE *) &r);
|
||||
}
|
||||
|
||||
/* assignment operators */
|
||||
|
||||
// assignment operators
|
||||
D3DXINLINE D3DXCOLOR&
|
||||
D3DXCOLOR::operator += ( CONST D3DXCOLOR& c )
|
||||
{
|
||||
@ -1346,7 +1396,8 @@ D3DXCOLOR::operator /= ( FLOAT f )
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* unary operators */
|
||||
|
||||
// unary operators
|
||||
D3DXINLINE D3DXCOLOR
|
||||
D3DXCOLOR::operator + () const
|
||||
{
|
||||
@ -1359,7 +1410,8 @@ D3DXCOLOR::operator - () const
|
||||
return D3DXCOLOR(-r, -g, -b, -a);
|
||||
}
|
||||
|
||||
/* binary operators */
|
||||
|
||||
// binary operators
|
||||
D3DXINLINE D3DXCOLOR
|
||||
D3DXCOLOR::operator + ( CONST D3DXCOLOR& c ) const
|
||||
{
|
||||
@ -1406,17 +1458,20 @@ D3DXCOLOR::operator != ( CONST D3DXCOLOR& c ) const
|
||||
}
|
||||
|
||||
|
||||
#endif /*__cplusplus */
|
||||
|
||||
/*
|
||||
*
|
||||
* Inline functions
|
||||
*/
|
||||
#endif //__cplusplus
|
||||
|
||||
|
||||
/*
|
||||
* 2D Vector
|
||||
*/
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// Inline functions
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
|
||||
//--------------------------
|
||||
// 2D Vector
|
||||
//--------------------------
|
||||
|
||||
D3DXINLINE FLOAT D3DXVec2Length
|
||||
( CONST D3DXVECTOR2 *pV )
|
||||
@ -1495,9 +1550,10 @@ D3DXINLINE D3DXVECTOR2* D3DXVec2Lerp
|
||||
return pOut;
|
||||
}
|
||||
|
||||
/*
|
||||
* 3D Vector
|
||||
*/
|
||||
|
||||
//--------------------------
|
||||
// 3D Vector
|
||||
//--------------------------
|
||||
|
||||
D3DXINLINE FLOAT D3DXVec3Length
|
||||
( CONST D3DXVECTOR3 *pV )
|
||||
@ -1590,9 +1646,9 @@ D3DXINLINE D3DXVECTOR3* D3DXVec3Lerp
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 4D Vector
|
||||
*/
|
||||
//--------------------------
|
||||
// 4D Vector
|
||||
//--------------------------
|
||||
|
||||
D3DXINLINE FLOAT D3DXVec4Length
|
||||
( CONST D3DXVECTOR4 *pV )
|
||||
@ -1678,9 +1734,9 @@ D3DXINLINE D3DXVECTOR4* D3DXVec4Lerp
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 4D Matrix
|
||||
*/
|
||||
//--------------------------
|
||||
// 4D Matrix
|
||||
//--------------------------
|
||||
|
||||
D3DXINLINE D3DXMATRIX* D3DXMatrixIdentity
|
||||
( D3DXMATRIX *pOut )
|
||||
@ -1705,9 +1761,9 @@ D3DXINLINE BOOL D3DXMatrixIsIdentity
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Quaternion
|
||||
*/
|
||||
//--------------------------
|
||||
// Quaternion
|
||||
//--------------------------
|
||||
|
||||
D3DXINLINE FLOAT D3DXQuaternionLength
|
||||
( CONST D3DXQUATERNION *pQ )
|
||||
@ -1757,9 +1813,10 @@ D3DXINLINE D3DXQUATERNION* D3DXQuaternionConjugate
|
||||
return pOut;
|
||||
}
|
||||
|
||||
/*
|
||||
* Plane
|
||||
*/
|
||||
|
||||
//--------------------------
|
||||
// Plane
|
||||
//--------------------------
|
||||
|
||||
D3DXINLINE FLOAT D3DXPlaneDot
|
||||
( CONST D3DXPLANE *pP, CONST D3DXVECTOR4 *pV)
|
||||
@ -1790,9 +1847,9 @@ D3DXINLINE D3DXPLANE* D3DXPlaneScale
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Color
|
||||
*/
|
||||
//--------------------------
|
||||
// Color
|
||||
//--------------------------
|
||||
|
||||
D3DXINLINE D3DXCOLOR* D3DXColorNegative
|
||||
(D3DXCOLOR *pOut, CONST D3DXCOLOR *pC)
|
||||
@ -1855,4 +1912,4 @@ D3DXINLINE D3DXCOLOR* D3DXColorLerp
|
||||
}
|
||||
|
||||
|
||||
#endif /* __D3DX9MATH_INL__ */
|
||||
#endif // __D3DX9MATH_INL__
|
||||
|
@ -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
|
||||
|
@ -26,20 +26,11 @@
|
||||
#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)
|
||||
{
|
||||
@ -53,9 +44,7 @@ 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)
|
||||
{
|
||||
@ -91,17 +80,14 @@ 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 = (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->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;
|
||||
@ -131,18 +117,19 @@ 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;
|
||||
|
||||
@ -150,6 +137,7 @@ 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)
|
||||
@ -166,6 +154,7 @@ 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:
|
||||
@ -189,9 +178,7 @@ 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)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user