Fix opengl and auto resolution crashes (#14)
* video_core: fix UniformData size on opengl * video_core: check for renderer on auto resolution The rasterizer cache constructor will call GetResolutionScaleFactor before the renderer is initialized on the vulkan backend, so check for that case and return 1 as a placeholder scale factor.
This commit is contained in:
@ -75,10 +75,11 @@ struct UniformData {
|
|||||||
LightSrc light_src[8];
|
LightSrc light_src[8];
|
||||||
alignas(16) Common::Vec4f const_color[6]; // A vec4 color for each of the six tev stages
|
alignas(16) Common::Vec4f const_color[6]; // A vec4 color for each of the six tev stages
|
||||||
alignas(16) Common::Vec4f tev_combiner_buffer_color;
|
alignas(16) Common::Vec4f tev_combiner_buffer_color;
|
||||||
|
alignas(16) Common::Vec3f tex_lod_bias;
|
||||||
alignas(16) Common::Vec4f clip_coef;
|
alignas(16) Common::Vec4f clip_coef;
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(sizeof(UniformData) == 0x4F0,
|
static_assert(sizeof(UniformData) == 0x500,
|
||||||
"The size of the UniformData does not match the structure in the shader");
|
"The size of the UniformData does not match the structure in the shader");
|
||||||
static_assert(sizeof(UniformData) < 16384,
|
static_assert(sizeof(UniformData) < 16384,
|
||||||
"UniformData structure must be less than 16kb as per the OpenGL spec");
|
"UniformData structure must be less than 16kb as per the OpenGL spec");
|
||||||
|
@ -1344,7 +1344,7 @@ void FragmentModule::DefineUniformStructs() {
|
|||||||
i32_id, i32_id, f32_id, f32_id, f32_id, f32_id, i32_id, i32_id, i32_id, i32_id, i32_id,
|
i32_id, i32_id, f32_id, f32_id, f32_id, f32_id, i32_id, i32_id, i32_id, i32_id, i32_id,
|
||||||
i32_id, i32_id, i32_id, i32_id, i32_id, f32_id, i32_id, u32_id, lighting_lut_array_id,
|
i32_id, i32_id, i32_id, i32_id, i32_id, f32_id, i32_id, u32_id, lighting_lut_array_id,
|
||||||
vec_ids.Get(3), vec_ids.Get(2), vec_ids.Get(2), vec_ids.Get(2), vec_ids.Get(3),
|
vec_ids.Get(3), vec_ids.Get(2), vec_ids.Get(2), vec_ids.Get(2), vec_ids.Get(3),
|
||||||
light_src_array_id, const_color_array_id, vec_ids.Get(4), vec_ids.Get(4), vec_ids.Get(3))};
|
light_src_array_id, const_color_array_id, vec_ids.Get(4), vec_ids.Get(3), vec_ids.Get(4))};
|
||||||
|
|
||||||
constexpr std::array light_src_offsets{0u, 16u, 32u, 48u, 64u, 80u, 92u, 96u};
|
constexpr std::array light_src_offsets{0u, 16u, 32u, 48u, 64u, 80u, 92u, 96u};
|
||||||
constexpr std::array shader_data_offsets{
|
constexpr std::array shader_data_offsets{
|
||||||
|
@ -63,8 +63,8 @@ struct UniformData {
|
|||||||
LightSrc light_src[8];
|
LightSrc light_src[8];
|
||||||
alignas(16) Common::Vec4f const_color[6]; // A vec4 color for each of the six tev stages
|
alignas(16) Common::Vec4f const_color[6]; // A vec4 color for each of the six tev stages
|
||||||
alignas(16) Common::Vec4f tev_combiner_buffer_color;
|
alignas(16) Common::Vec4f tev_combiner_buffer_color;
|
||||||
alignas(16) Common::Vec4f clip_coef;
|
|
||||||
alignas(16) Common::Vec3f tex_lod_bias;
|
alignas(16) Common::Vec3f tex_lod_bias;
|
||||||
|
alignas(16) Common::Vec4f clip_coef;
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(sizeof(UniformData) == 0x500,
|
static_assert(sizeof(UniformData) == 0x500,
|
||||||
|
@ -93,7 +93,7 @@ void RequestScreenshot(void* data, std::function<void()> callback,
|
|||||||
}
|
}
|
||||||
|
|
||||||
u16 GetResolutionScaleFactor() {
|
u16 GetResolutionScaleFactor() {
|
||||||
if (g_hw_renderer_enabled) {
|
if (g_hw_renderer_enabled && g_renderer) {
|
||||||
return Settings::values.resolution_factor.GetValue()
|
return Settings::values.resolution_factor.GetValue()
|
||||||
? Settings::values.resolution_factor.GetValue()
|
? Settings::values.resolution_factor.GetValue()
|
||||||
: g_renderer->GetRenderWindow().GetFramebufferLayout().GetScalingRatio();
|
: g_renderer->GetRenderWindow().GetFramebufferLayout().GetScalingRatio();
|
||||||
|
Reference in New Issue
Block a user