mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fix issues msh encountered with Intel 4600.
This commit is contained in:
parent
10245e0c1b
commit
d3b878de2a
@ -3,42 +3,42 @@
|
|||||||
/* TODO: Add the ability to control the tendency to do stuff in the vertex vs. fragment shader.
|
/* TODO: Add the ability to control the tendency to do stuff in the vertex vs. fragment shader.
|
||||||
* Currently this flag is ignored and always set to prefer fragment, but this tradeoff is not correct on all
|
* Currently this flag is ignored and always set to prefer fragment, but this tradeoff is not correct on all
|
||||||
* machines in all cases (mine, for instance). */
|
* machines in all cases (mine, for instance). */
|
||||||
#define VOXYGEN_COMPUTATION_PREERENCE_FRAGMENT 0u
|
#define VOXYGEN_COMPUTATION_PREERENCE_FRAGMENT 0
|
||||||
#define VOXYGEN_COMPUTATION_PREERENCE_VERTEX 1u
|
#define VOXYGEN_COMPUTATION_PREERENCE_VERTEX 1
|
||||||
|
|
||||||
#define FLUID_MODE_CHEAP 0u
|
#define FLUID_MODE_CHEAP 0
|
||||||
#define FLUID_MODE_SHINY 1u
|
#define FLUID_MODE_SHINY 1
|
||||||
|
|
||||||
#define CLOUD_MODE_NONE 0u
|
#define CLOUD_MODE_NONE 0
|
||||||
#define CLOUD_MODE_REGULAR 1u
|
#define CLOUD_MODE_REGULAR 1
|
||||||
|
|
||||||
#define LIGHTING_ALGORITHM_LAMBERTIAN 0u
|
#define LIGHTING_ALGORITHM_LAMBERTIAN 0
|
||||||
#define LIGHTING_ALGORITHM_BLINN_PHONG 1u
|
#define LIGHTING_ALGORITHM_BLINN_PHONG 1
|
||||||
#define LIGHTING_ALGORITHM_ASHIKHMIN 2u
|
#define LIGHTING_ALGORITHM_ASHIKHMIN 2
|
||||||
|
|
||||||
#define SHADOW_MODE_NONE 0u
|
#define SHADOW_MODE_NONE 0
|
||||||
#define SHADOW_MODE_CHEAP 1u
|
#define SHADOW_MODE_CHEAP 1
|
||||||
#define SHADOW_MODE_MAP 2u
|
#define SHADOW_MODE_MAP 2
|
||||||
|
|
||||||
/* Unlike the other flags (for now anyway), these are bitmask values */
|
/* Unlike the other flags (for now anyway), these are bitmask values */
|
||||||
#define LIGHTING_TYPE_REFLECTION 0x01u
|
#define LIGHTING_TYPE_REFLECTION 0x01
|
||||||
#define LIGHTING_TYPE_TRANSMISSION 0x02u
|
#define LIGHTING_TYPE_TRANSMISSION 0x02
|
||||||
|
|
||||||
/* Currently ignored, but ideally shoud be helpful for determining light transport properties. */
|
/* Currently ignored, but ideally shoud be helpful for determining light transport properties. */
|
||||||
#define LIGHTING_REFLECTION_KIND_DIFFUSE 0u
|
#define LIGHTING_REFLECTION_KIND_DIFFUSE 0
|
||||||
#define LIGHTING_REFLECTION_KIND_GLOSSY 1u
|
#define LIGHTING_REFLECTION_KIND_GLOSSY 1
|
||||||
#define LIGHTING_REFLECTION_KIND_SPECULAR 2u
|
#define LIGHTING_REFLECTION_KIND_SPECULAR 2
|
||||||
|
|
||||||
#define LIGHTING_TRANSPORT_MODE_IMPORTANCE 0u
|
#define LIGHTING_TRANSPORT_MODE_IMPORTANCE 0
|
||||||
/* Radiance mode is currently used as a proxy for "attenuation and medium materials
|
/* Radiance mode is currently used as a proxy for "attenuation and medium materials
|
||||||
* matter," but we may make it more granular. */
|
* matter," but we may make it more granular. */
|
||||||
#define LIGHTING_TRANSPORT_MODE_RADIANCE 1u
|
#define LIGHTING_TRANSPORT_MODE_RADIANCE 1
|
||||||
|
|
||||||
#define LIGHTING_DISTRIBUTION_SCHEME_MICROFACET 0u
|
#define LIGHTING_DISTRIBUTION_SCHEME_MICROFACET 0
|
||||||
#define LIGHTING_DISTRIBUTION_SCHEME_VOXEL 1u
|
#define LIGHTING_DISTRIBUTION_SCHEME_VOXEL 1
|
||||||
|
|
||||||
#define LIGHTING_DISTRIBUTION_BECKMANN 0u
|
#define LIGHTING_DISTRIBUTION_BECKMANN 0
|
||||||
#define LIGHTING_DISTRIBUTION_TROWBRIDGE 1u
|
#define LIGHTING_DISTRIBUTION_TROWBRIDGE 1
|
||||||
|
|
||||||
/* Constants expected to be defined automatically by configuration: */
|
/* Constants expected to be defined automatically by configuration: */
|
||||||
|
|
||||||
|
@ -443,38 +443,27 @@ impl Renderer {
|
|||||||
> {
|
> {
|
||||||
// (Attempt to) apply resolution factor to shadow map resolution.
|
// (Attempt to) apply resolution factor to shadow map resolution.
|
||||||
let resolution_factor = mode.resolution.clamped(0.25, 4.0);
|
let resolution_factor = mode.resolution.clamped(0.25, 4.0);
|
||||||
fn vec2_result<T, E>(v: Vec2<Result<T, E>>) -> Result<Vec2<T>, E> {
|
|
||||||
Ok(Vec2::new(v.x?, v.y?))
|
|
||||||
};
|
|
||||||
|
|
||||||
let max_texture_size = Self::max_texture_size_raw(factory);
|
let max_texture_size = Self::max_texture_size_raw(factory);
|
||||||
let size = vec2_result(Vec2::new(size.0, size.1).map(|e| {
|
// Limit to max texture size, rather than erroring.
|
||||||
|
let size = Vec2::new(size.0, size.1).map(|e| {
|
||||||
let size = f32::from(e) * resolution_factor;
|
let size = f32::from(e) * resolution_factor;
|
||||||
// NOTE: We know 0 <= e since we clamped the resolution factor to be between
|
// NOTE: We know 0 <= e since we clamped the resolution factor to be between
|
||||||
// 0.25 and 4.0.
|
// 0.25 and 4.0.
|
||||||
if size <= f32::from(max_texture_size) {
|
if size <= f32::from(max_texture_size) {
|
||||||
Ok(size as u16)
|
size as u16
|
||||||
} else {
|
} else {
|
||||||
Err(RenderError::CustomError(format!(
|
max_texture_size
|
||||||
"Resolution factor {:?} multiplied by screen resolution axis {:?} does not \
|
|
||||||
fit in a texture on this machine.",
|
|
||||||
resolution_factor, e
|
|
||||||
)))
|
|
||||||
}
|
}
|
||||||
}))?;
|
});
|
||||||
|
|
||||||
let levels = 1;
|
let levels = 1;
|
||||||
let two_size = vec2_result(size.map(|e| {
|
// Limit to max texture size rather than erroring.
|
||||||
|
let two_size = size.map(|e| {
|
||||||
u16::checked_next_power_of_two(e)
|
u16::checked_next_power_of_two(e)
|
||||||
.filter(|&e| e <= max_texture_size)
|
.filter(|&e| e <= max_texture_size)
|
||||||
.ok_or_else(|| {
|
.unwrap_or(max_texture_size)
|
||||||
RenderError::CustomError(format!(
|
});
|
||||||
"Next power of two for shadow map resolution axis {:?} does not fit in a \
|
|
||||||
texture on this machine.",
|
|
||||||
e
|
|
||||||
))
|
|
||||||
})
|
|
||||||
}))?;
|
|
||||||
let min_size = size.reduce_min();
|
let min_size = size.reduce_min();
|
||||||
let max_size = size.reduce_max();
|
let max_size = size.reduce_max();
|
||||||
let _min_two_size = two_size.reduce_min();
|
let _min_two_size = two_size.reduce_min();
|
||||||
@ -493,20 +482,13 @@ impl Renderer {
|
|||||||
// u16, so does diag_cross_size.
|
// u16, so does diag_cross_size.
|
||||||
(diag_size as u16, diag_cross_size as u16)
|
(diag_size as u16, diag_cross_size as u16)
|
||||||
} else {
|
} else {
|
||||||
return Err(RenderError::CustomError(format!(
|
// Limit to max texture resolution rather than error.
|
||||||
"Resolution of shadow map diagonal {:?} does not fit in a texture on this machine.",
|
(max_texture_size as u16, max_texture_size as u16)
|
||||||
diag_size
|
|
||||||
)));
|
|
||||||
};
|
};
|
||||||
let diag_two_size = u16::checked_next_power_of_two(diag_size)
|
let diag_two_size = u16::checked_next_power_of_two(diag_size)
|
||||||
.filter(|&e| e <= max_texture_size)
|
.filter(|&e| e <= max_texture_size)
|
||||||
.ok_or_else(|| {
|
// Limit to max texture resolution rather than error.
|
||||||
RenderError::CustomError(format!(
|
.unwrap_or(max_texture_size);
|
||||||
"Next power of two for resolution of shadow map diagonal {:?} does not fit in \
|
|
||||||
a texture on this machine.",
|
|
||||||
diag_size
|
|
||||||
))
|
|
||||||
})?;
|
|
||||||
let depth_stencil_cty = <<ShadowDepthStencilFmt as gfx::format::Formatted>::Channel as gfx::format::ChannelTyped>::get_channel_type();
|
let depth_stencil_cty = <<ShadowDepthStencilFmt as gfx::format::Formatted>::Channel as gfx::format::ChannelTyped>::get_channel_type();
|
||||||
|
|
||||||
let point_shadow_tex = factory
|
let point_shadow_tex = factory
|
||||||
|
Loading…
Reference in New Issue
Block a user