[vulkan] Get alias lighting mostly working

It's not so much that parts aren't working, but rather there's no
base-level lighting so everything is black until a dlight is in the
vicinity
This commit is contained in:
Bill Currie 2021-01-28 15:20:24 +09:00
parent 28652c4d59
commit 206c631811
2 changed files with 8 additions and 7 deletions

View file

@ -8,7 +8,7 @@ layout (set = 2, binding = 0) uniform sampler2D Texture;
layout (set = 2, binding = 1) uniform sampler2D GlowMap;
layout (set = 2, binding = 2) uniform sampler2D ColorA;
layout (set = 2, binding = 3) uniform sampler2D ColorB;
*/
struct LightData {
vec3 color;
float dist;
@ -19,11 +19,12 @@ struct LightData {
};
layout (constant_id = 0) const int MaxLights = 8;
layout (set = 1, binding = 0) uniform Lights {
//layout (set = 1, binding = 0) uniform Lights {
layout (set = 0, binding = 1) uniform Lights {
int light_count;
LightData lights[MaxLights];
};
*/
layout (push_constant) uniform PushConstants {
layout (offset = 80)
vec4 fog;
@ -45,7 +46,7 @@ main (void)
c = texture (Texture, st);
c += texture (ColorA, st);
c += texture (ColorB, st);
/*
if (MaxLights > 0) {
for (i = 0; i < light_count; i++) {
vec3 dist = lights[i].position - position;
@ -55,7 +56,7 @@ main (void)
}
}
c *= vec4 (light, 1);
*/
c += texture (GlowMap, st);
//frag_color = vec4((normal + 1)/2, 1);
frag_color = c;//fogBlend (c);

View file

@ -193,7 +193,7 @@ Vulkan_AliasBegin (vulkan_ctx_t *ctx)
// actx->layout, 0, 2, sets, 0, 0);
dfunc->vkCmdPushDescriptorSetKHR (cmd, VK_PIPELINE_BIND_POINT_GRAPHICS,
actx->layout,
0, 1, aframe->descriptors + 0);
0, 2, aframe->descriptors + 0);
VkViewport viewport = {0, 0, vid.width, vid.height, 0, 1};
VkRect2D scissor = { {0, 0}, {vid.width, vid.height} };
dfunc->vkCmdSetViewport (cmd, 0, 1, &viewport);
@ -293,7 +293,7 @@ Vulkan_Alias_Init (vulkan_ctx_t *ctx)
aframe->bufferInfo[j] = base_buffer_info;
aframe->descriptors[j] = base_buffer_write;
//aframe->descriptors[j].dstSet = sets->a[ALIAS_BUFFER_INFOS*i + j];
aframe->descriptors[j].dstBinding = 0;
aframe->descriptors[j].dstBinding = j;
aframe->descriptors[j].pBufferInfo = &aframe->bufferInfo[j];
}
for (int j = 0; j < ALIAS_IMAGE_INFOS; j++) {