Add zmode decal support
This commit is contained in:
parent
aecea750f7
commit
31b30b72cb
1 changed files with 12 additions and 3 deletions
|
@ -317,6 +317,10 @@ static std::string gfx_vulkan_create_fragment_shader(CCFeatures features) {
|
||||||
|
|
||||||
src += ";\n";
|
src += ";\n";
|
||||||
|
|
||||||
|
if(features.opt_texture_edge && features.opt_alpha) {
|
||||||
|
src += "if (texel.a > 0.3) texel.a = 1.0; else discard;";
|
||||||
|
}
|
||||||
|
|
||||||
if(uses_alpha) {
|
if(uses_alpha) {
|
||||||
src += "out_color = texel;\n";
|
src += "out_color = texel;\n";
|
||||||
} else {
|
} else {
|
||||||
|
@ -498,7 +502,9 @@ static std::tuple<VkPipeline, VkPipelineLayout, VkDescriptorSetLayout> gfx_vulka
|
||||||
const std::array dynamic_states = { VK_DYNAMIC_STATE_VIEWPORT,
|
const std::array dynamic_states = { VK_DYNAMIC_STATE_VIEWPORT,
|
||||||
VK_DYNAMIC_STATE_SCISSOR,
|
VK_DYNAMIC_STATE_SCISSOR,
|
||||||
VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE,
|
VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE,
|
||||||
VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE };
|
VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE,
|
||||||
|
VK_DYNAMIC_STATE_DEPTH_BIAS,
|
||||||
|
VK_DYNAMIC_STATE_DEPTH_BIAS_ENABLE };
|
||||||
|
|
||||||
VkPipelineDynamicStateCreateInfo dynamic_state = {};
|
VkPipelineDynamicStateCreateInfo dynamic_state = {};
|
||||||
dynamic_state.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO;
|
dynamic_state.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO;
|
||||||
|
@ -1233,8 +1239,6 @@ static void gfx_vulkan_renderer_start_frame(void) {
|
||||||
static void gfx_vulkan_renderer_select_texture(int tile, uint32_t texture_id) {
|
static void gfx_vulkan_renderer_select_texture(int tile, uint32_t texture_id) {
|
||||||
last_tile = tile;
|
last_tile = tile;
|
||||||
bound_textures[last_tile] = texture_id;
|
bound_textures[last_tile] = texture_id;
|
||||||
|
|
||||||
printf("selecting texture %d in slot %d\n", texture_id, tile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static VkCommandBuffer gfx_vulkan_begin_singletime_commands() {
|
static VkCommandBuffer gfx_vulkan_begin_singletime_commands() {
|
||||||
|
@ -1457,6 +1461,11 @@ static void gfx_vulkan_renderer_set_depth_mask(bool z_upd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gfx_vulkan_renderer_set_zmode_decal(bool zmode_decal) {
|
static void gfx_vulkan_renderer_set_zmode_decal(bool zmode_decal) {
|
||||||
|
vkCmdSetDepthBiasEnable(current_cmd, zmode_decal);
|
||||||
|
|
||||||
|
if(zmode_decal) {
|
||||||
|
vkCmdSetDepthBias(current_cmd, -2, 0, -2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gfx_vulkan_renderer_set_viewport(int x, int y, int width, int height) {
|
static void gfx_vulkan_renderer_set_viewport(int x, int y, int width, int height) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue