mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 03:32:46 +00:00
fix(Metal): Fix release build crash for misaligned read
This commit is contained in:
parent
44ca1062b0
commit
30d2192338
@ -148,7 +148,7 @@
|
||||
SpriteVertex *pv = (SpriteVertex *)range.data;
|
||||
for (unsigned i = 0; i < draw->coords->vertices; i++, pv++)
|
||||
{
|
||||
pv->position = simd_make_float2(vertex[0], 1.0 - vertex[1]);
|
||||
pv->position = simd_make_float2(vertex[0], 1.0f - vertex[1]);
|
||||
vertex += 2;
|
||||
|
||||
pv->texCoord = simd_make_float2(tex_coord[0], tex_coord[1]);
|
||||
@ -196,8 +196,9 @@
|
||||
}
|
||||
|
||||
[rce setRenderPipelineState:[_driver getStockShader:VIDEO_SHADER_STOCK_BLEND blend:_blend]];
|
||||
|
||||
Uniforms uniforms = {
|
||||
.projectionMatrix = draw->matrix_data ? *(matrix_float4x4 *)draw->matrix_data
|
||||
.projectionMatrix = draw->matrix_data ? make_matrix_float4x4((const float *)draw->matrix_data)
|
||||
: _uniforms.projectionMatrix
|
||||
};
|
||||
[rce setVertexBytes:&uniforms length:sizeof(uniforms) atIndex:BufferIndexUniforms];
|
||||
|
@ -54,5 +54,6 @@ typedef NS_ENUM(NSUInteger, RTextureFilter)
|
||||
};
|
||||
|
||||
extern matrix_float4x4 matrix_proj_ortho(float left, float right, float top, float bottom);
|
||||
extern matrix_float4x4 make_matrix_float4x4(const float *v);
|
||||
|
||||
#endif /* RendererCommon_h */
|
||||
|
@ -52,6 +52,17 @@ NSString *NSStringFromRPixelFormat(RPixelFormat format)
|
||||
return RPixelStrings[format];
|
||||
}
|
||||
|
||||
matrix_float4x4 make_matrix_float4x4(const float *v)
|
||||
{
|
||||
simd_float4 P = simd_make_float4(*v++, *v++, *v++, *v++);
|
||||
simd_float4 Q = simd_make_float4(*v++, *v++, *v++, *v++);
|
||||
simd_float4 R = simd_make_float4(*v++, *v++, *v++, *v++);
|
||||
simd_float4 S = simd_make_float4(*v++, *v++, *v++, *v++);
|
||||
|
||||
matrix_float4x4 mat = {P, Q, R, S};
|
||||
return mat;
|
||||
}
|
||||
|
||||
matrix_float4x4 matrix_proj_ortho(float left, float right, float top, float bottom)
|
||||
{
|
||||
float near = 0;
|
||||
|
@ -622,7 +622,7 @@
|
||||
|
||||
#pragma mark - FrameView
|
||||
|
||||
#define ALIGN(x) __attribute__((aligned(x)))
|
||||
#define MTLALIGN(x) __attribute__((aligned(x)))
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -638,7 +638,7 @@ typedef struct texture
|
||||
float4_t size_data;
|
||||
} texture_t;
|
||||
|
||||
typedef struct ALIGN(16)
|
||||
typedef struct MTLALIGN(16)
|
||||
{
|
||||
matrix_float4x4 mvp;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user