mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 21:32:45 +00:00
Prevent implicit memsets
This commit is contained in:
parent
c7bb666214
commit
479058d1a3
@ -914,6 +914,7 @@ void vulkan_filter_chain::build_offscreen_passes(VkCommandBuffer cmd,
|
||||
const VkViewport &vp)
|
||||
{
|
||||
unsigned i;
|
||||
Texture source;
|
||||
|
||||
/* First frame, make sure our history and feedback textures
|
||||
* are in a clean state. */
|
||||
@ -934,7 +935,7 @@ void vulkan_filter_chain::build_offscreen_passes(VkCommandBuffer cmd,
|
||||
passes.front()->get_address_mode(),
|
||||
};
|
||||
|
||||
Texture source = original;
|
||||
source = original;
|
||||
|
||||
for (i = 0; i < passes.size() - 1; i++)
|
||||
{
|
||||
|
@ -216,12 +216,15 @@ static bool slang_process_reflection(
|
||||
slang_semantic_meta& src = sl_reflection.semantics[semantic];
|
||||
if (src.push_constant || src.uniform)
|
||||
{
|
||||
uniform_sem_t uniform = { map->uniforms[semantic],
|
||||
src.num_components
|
||||
* (unsigned)sizeof(float) };
|
||||
uniform_sem_t uniform;
|
||||
const char *uniform_id = get_semantic_name(
|
||||
sl_reflection, (slang_semantic)semantic, 0).c_str();
|
||||
|
||||
uniform.data = map->uniforms[semantic];
|
||||
uniform.size = src.num_components * (unsigned)sizeof(float);
|
||||
uniform.offset = 0;
|
||||
uniform.id[0] = '\0';
|
||||
|
||||
strlcpy(uniform.id, uniform_id, sizeof(uniform.id));
|
||||
|
||||
if (src.push_constant)
|
||||
@ -243,11 +246,15 @@ static bool slang_process_reflection(
|
||||
|
||||
if (src.push_constant || src.uniform)
|
||||
{
|
||||
uniform_sem_t uniform = {
|
||||
&shader_info->parameters[i].current, sizeof(float) };
|
||||
|
||||
uniform_sem_t uniform;
|
||||
const char *uniform_id = get_semantic_name(
|
||||
sl_reflection, SLANG_SEMANTIC_FLOAT_PARAMETER, i).c_str();
|
||||
|
||||
uniform.data = &shader_info->parameters[i].current;
|
||||
uniform.size = sizeof(float);
|
||||
uniform.offset = 0;
|
||||
uniform.id[0] = '\0';
|
||||
|
||||
strlcpy(uniform.id, uniform_id, sizeof(uniform.id));
|
||||
|
||||
if (src.push_constant)
|
||||
@ -275,9 +282,11 @@ static bool slang_process_reflection(
|
||||
|
||||
if (src.stage_mask)
|
||||
{
|
||||
texture_sem_t texture = {
|
||||
(void*)((uintptr_t)map->textures[semantic].image + index * map->textures[semantic].image_stride)
|
||||
};
|
||||
texture_sem_t texture;
|
||||
string id = get_semantic_name(
|
||||
sl_reflection, (slang_texture_semantic)semantic, index);
|
||||
texture.texture_data =
|
||||
(void*)((uintptr_t)map->textures[semantic].image + index * map->textures[semantic].image_stride);
|
||||
|
||||
if (semantic == SLANG_TEXTURE_SEMANTIC_USER)
|
||||
{
|
||||
@ -291,8 +300,7 @@ static bool slang_process_reflection(
|
||||
}
|
||||
texture.stage_mask = src.stage_mask;
|
||||
texture.binding = src.binding;
|
||||
string id = get_semantic_name(
|
||||
sl_reflection, (slang_texture_semantic)semantic, index);
|
||||
texture.id[0] = '\0';
|
||||
|
||||
strlcpy(texture.id, id.c_str(), sizeof(texture.id));
|
||||
|
||||
@ -308,17 +316,19 @@ static bool slang_process_reflection(
|
||||
|
||||
if (src.push_constant || src.uniform)
|
||||
{
|
||||
uniform_sem_t uniform = {
|
||||
(void*)((uintptr_t)map->textures[semantic].size
|
||||
+ index * map->textures[semantic].size_stride),
|
||||
4 * sizeof(float)
|
||||
};
|
||||
|
||||
uniform_sem_t uniform;
|
||||
const char *uniform_id =
|
||||
get_size_semantic_name(
|
||||
sl_reflection,
|
||||
(slang_texture_semantic)semantic, index).c_str();
|
||||
|
||||
uniform.data = (void*)((uintptr_t)
|
||||
map->textures[semantic].size
|
||||
+ index * map->textures[semantic].size_stride);
|
||||
uniform.size = 4 * sizeof(float);
|
||||
uniform.offset = 0;
|
||||
uniform.id[0] = '\0';
|
||||
|
||||
strlcpy(uniform.id, uniform_id, sizeof(uniform.id));
|
||||
|
||||
if (src.push_constant)
|
||||
@ -565,13 +575,14 @@ bool slang_process(
|
||||
const ShaderResources &resources) {
|
||||
for (const Resource& resource : resources.push_constant_buffers)
|
||||
{
|
||||
// Explicit 1:1 mapping for bindings.
|
||||
/* Explicit 1:1 mapping for bindings. */
|
||||
MSLResourceBinding binding = {};
|
||||
binding.stage = comp->get_execution_model();
|
||||
binding.desc_set = kPushConstDescSet;
|
||||
binding.binding = kPushConstBinding;
|
||||
// Use earlier decoration override.
|
||||
binding.msl_buffer = comp->get_decoration(resource.id, spv::DecorationBinding);
|
||||
binding.stage = comp->get_execution_model();
|
||||
binding.desc_set = kPushConstDescSet;
|
||||
binding.binding = kPushConstBinding;
|
||||
/* Use earlier decoration override. */
|
||||
binding.msl_buffer = comp->get_decoration(
|
||||
resource.id, spv::DecorationBinding);
|
||||
comp->add_msl_resource_binding(binding);
|
||||
}
|
||||
};
|
||||
@ -580,17 +591,19 @@ bool slang_process(
|
||||
const SmallVector<Resource> &resources) {
|
||||
for (const Resource& resource : resources)
|
||||
{
|
||||
// Explicit 1:1 mapping for bindings.
|
||||
/* Explicit 1:1 mapping for bindings. */
|
||||
MSLResourceBinding binding = {};
|
||||
binding.stage = comp->get_execution_model();
|
||||
binding.desc_set = comp->get_decoration(resource.id, spv::DecorationDescriptorSet);
|
||||
binding.stage = comp->get_execution_model();
|
||||
binding.desc_set = comp->get_decoration(
|
||||
resource.id, spv::DecorationDescriptorSet);
|
||||
|
||||
// Use existing decoration override.
|
||||
uint32_t msl_binding = comp->get_decoration(resource.id, spv::DecorationBinding);
|
||||
binding.binding = msl_binding;
|
||||
binding.msl_buffer = msl_binding;
|
||||
binding.msl_texture = msl_binding;
|
||||
binding.msl_sampler = msl_binding;
|
||||
/* Use existing decoration override. */
|
||||
uint32_t msl_binding = comp->get_decoration(
|
||||
resource.id, spv::DecorationBinding);
|
||||
binding.binding = msl_binding;
|
||||
binding.msl_buffer = msl_binding;
|
||||
binding.msl_texture = msl_binding;
|
||||
binding.msl_sampler = msl_binding;
|
||||
comp->add_msl_resource_binding(binding);
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user