Creating texture views with the correct view type
This commit is contained in:
@@ -343,7 +343,7 @@ struct CookTorrance : IBRDF
|
||||
float3 k_s = FresnelSchlickRoughness(max(dot(normal, viewDir_WS), 0.0), F0, roughness);
|
||||
float3 k_d = 1 - k_s;
|
||||
k_d *= 1 - metallic;
|
||||
float3 irradiance = pLightEnv.irradianceMap.Sample(pLightEnv.irradianceSampler, normal).rgb;
|
||||
float3 irradiance = pLightEnv.irradianceMap.SampleLevel(pLightEnv.irradianceSampler, normal, 4).rgb;
|
||||
float3 diffuse = irradiance * baseColor;
|
||||
return (k_d * diffuse) * ambientOcclusion;
|
||||
}
|
||||
|
||||
@@ -62,12 +62,20 @@ void TextureView::setLayout(Gfx::SeImageLayout layout) { source->layout = layout
|
||||
|
||||
Gfx::OTextureView TextureHandle::createTextureView(uint32 baseMipLevel, uint32 levelCount, uint32 baseArrayLayer, uint32 layerCount) {
|
||||
VkImageView view;
|
||||
VkImageViewType type = viewType;
|
||||
if (type == VK_IMAGE_VIEW_TYPE_CUBE || type == VK_IMAGE_VIEW_TYPE_CUBE_ARRAY) {
|
||||
if (layerCount == 1) {
|
||||
type = VK_IMAGE_VIEW_TYPE_2D;
|
||||
} else if (layerCount % 6 != 0) {
|
||||
type = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
}
|
||||
}
|
||||
VkImageViewCreateInfo createInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
.flags = 0,
|
||||
.image = image,
|
||||
.viewType = viewType,
|
||||
.viewType = type,
|
||||
.format = cast(format),
|
||||
.subresourceRange =
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user