Add USER semantic to match user textures.
This commit is contained in:
parent
d39a3619d6
commit
f208bba41e
|
@ -183,7 +183,8 @@ class StaticTexture
|
||||||
VkImage image,
|
VkImage image,
|
||||||
VkImageView view,
|
VkImageView view,
|
||||||
VkDeviceMemory memory,
|
VkDeviceMemory memory,
|
||||||
unique_ptr<Buffer> buffer);
|
unique_ptr<Buffer> buffer,
|
||||||
|
unsigned width, unsigned height);
|
||||||
~StaticTexture();
|
~StaticTexture();
|
||||||
|
|
||||||
StaticTexture(StaticTexture&&) = delete;
|
StaticTexture(StaticTexture&&) = delete;
|
||||||
|
@ -204,6 +205,11 @@ class StaticTexture
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Texture &get_texture() const
|
||||||
|
{
|
||||||
|
return texture;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VkDevice device;
|
VkDevice device;
|
||||||
VkImage image;
|
VkImage image;
|
||||||
|
@ -211,6 +217,7 @@ class StaticTexture
|
||||||
VkDeviceMemory memory;
|
VkDeviceMemory memory;
|
||||||
unique_ptr<Buffer> buffer;
|
unique_ptr<Buffer> buffer;
|
||||||
string id;
|
string id;
|
||||||
|
Texture texture;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Framebuffer
|
class Framebuffer
|
||||||
|
@ -816,6 +823,19 @@ bool vulkan_filter_chain::init_alias()
|
||||||
slang_texture_semantic_map{ SLANG_TEXTURE_SEMANTIC_PASS_FEEDBACK, i }))
|
slang_texture_semantic_map{ SLANG_TEXTURE_SEMANTIC_PASS_FEEDBACK, i }))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (auto &lut : common.luts)
|
||||||
|
{
|
||||||
|
unsigned i = &lut - common.luts.data();
|
||||||
|
if (!set_unique_map(common.texture_semantic_map, lut->get_id(),
|
||||||
|
slang_texture_semantic_map{ SLANG_TEXTURE_SEMANTIC_USER, i }))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!set_unique_map(common.texture_semantic_uniform_map, lut->get_id() + "Size",
|
||||||
|
slang_texture_semantic_map{ SLANG_TEXTURE_SEMANTIC_USER, i }))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1029,14 +1049,22 @@ StaticTexture::StaticTexture(string id,
|
||||||
VkImage image,
|
VkImage image,
|
||||||
VkImageView view,
|
VkImageView view,
|
||||||
VkDeviceMemory memory,
|
VkDeviceMemory memory,
|
||||||
unique_ptr<Buffer> buffer)
|
unique_ptr<Buffer> buffer,
|
||||||
|
unsigned width, unsigned height)
|
||||||
: id(move(id)),
|
: id(move(id)),
|
||||||
device(device),
|
device(device),
|
||||||
image(image),
|
image(image),
|
||||||
view(view),
|
view(view),
|
||||||
memory(memory),
|
memory(memory),
|
||||||
buffer(move(buffer))
|
buffer(move(buffer))
|
||||||
{}
|
{
|
||||||
|
texture.filter = VULKAN_FILTER_CHAIN_LINEAR;
|
||||||
|
texture.texture.image = image;
|
||||||
|
texture.texture.view = view;
|
||||||
|
texture.texture.layout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||||
|
texture.texture.width = width;
|
||||||
|
texture.texture.height = height;
|
||||||
|
}
|
||||||
|
|
||||||
StaticTexture::~StaticTexture()
|
StaticTexture::~StaticTexture()
|
||||||
{
|
{
|
||||||
|
@ -1709,6 +1737,16 @@ void Pass::build_semantics(VkDescriptorSet set, uint8_t *buffer,
|
||||||
texture);
|
texture);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LUTs.
|
||||||
|
i = 0;
|
||||||
|
for (auto &lut : common->luts)
|
||||||
|
{
|
||||||
|
build_semantic_texture_array(set, buffer,
|
||||||
|
SLANG_TEXTURE_SEMANTIC_USER, i,
|
||||||
|
lut->get_texture());
|
||||||
|
i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pass::build_commands(
|
void Pass::build_commands(
|
||||||
|
@ -2261,7 +2299,8 @@ static unique_ptr<StaticTexture> vulkan_filter_chain_load_lut(VkCommandBuffer cm
|
||||||
VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT,
|
VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT,
|
||||||
VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
|
VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
|
||||||
|
|
||||||
return unique_ptr<StaticTexture>(new StaticTexture(shader->id, info->device, tex, view, memory, move(buffer)));
|
return unique_ptr<StaticTexture>(new StaticTexture(shader->id, info->device,
|
||||||
|
tex, view, memory, move(buffer), image.width, image.height));
|
||||||
|
|
||||||
error:
|
error:
|
||||||
if (image.pixels)
|
if (image.pixels)
|
||||||
|
|
|
@ -29,6 +29,7 @@ static bool slang_texture_semantic_is_array(slang_texture_semantic sem)
|
||||||
case SLANG_TEXTURE_SEMANTIC_ORIGINAL_HISTORY:
|
case SLANG_TEXTURE_SEMANTIC_ORIGINAL_HISTORY:
|
||||||
case SLANG_TEXTURE_SEMANTIC_PASS_OUTPUT:
|
case SLANG_TEXTURE_SEMANTIC_PASS_OUTPUT:
|
||||||
case SLANG_TEXTURE_SEMANTIC_PASS_FEEDBACK:
|
case SLANG_TEXTURE_SEMANTIC_PASS_FEEDBACK:
|
||||||
|
case SLANG_TEXTURE_SEMANTIC_USER:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -52,6 +53,7 @@ static const char *texture_semantic_names[] = {
|
||||||
"OriginalHistory",
|
"OriginalHistory",
|
||||||
"PassOutput",
|
"PassOutput",
|
||||||
"PassFeedback",
|
"PassFeedback",
|
||||||
|
"User",
|
||||||
nullptr
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -61,6 +63,7 @@ static const char *texture_semantic_uniform_names[] = {
|
||||||
"OriginalHistorySize",
|
"OriginalHistorySize",
|
||||||
"PassOutputSize",
|
"PassOutputSize",
|
||||||
"PassFeedbackSize",
|
"PassFeedbackSize",
|
||||||
|
"UserSize",
|
||||||
nullptr
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue