metal renderer: use the device address space instead of the constant address space for colors.

It doesn't negatively impact GPU performance in my tests, and it removes the need for 256 byte memory alignment of color data on macOS.
This commit is contained in:
Alex Szpakowski 2019-08-17 00:37:22 -03:00
parent 3fb5cabe5e
commit e5acccc7c3
5 changed files with 1526 additions and 1522 deletions

View File

@ -962,7 +962,7 @@ static int
METAL_QueueSetDrawColor(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
{
const size_t vertlen = sizeof (float) * 4;
float *verts = (float *) SDL_AllocateRenderVertices(renderer, vertlen, CONSTANT_ALIGN, &cmd->data.color.first);
float *verts = (float *) SDL_AllocateRenderVertices(renderer, vertlen, 16, &cmd->data.color.first);
if (!verts) {
return -1;
}

View File

@ -20,7 +20,7 @@ vertex SolidVertexOutput SDL_Solid_vertex(const device float2 *position [[buffer
return v;
}
fragment float4 SDL_Solid_fragment(constant float4 &col [[buffer(0)]])
fragment float4 SDL_Solid_fragment(const device float4 &col [[buffer(0)]])
{
return col;
}
@ -44,7 +44,7 @@ vertex CopyVertexOutput SDL_Copy_vertex(const device float2 *position [[buffer(0
}
fragment float4 SDL_Copy_fragment(CopyVertexOutput vert [[stage_in]],
constant float4 &col [[buffer(0)]],
const device float4 &col [[buffer(0)]],
texture2d<float> tex [[texture(0)]],
sampler s [[sampler(0)]])
{
@ -60,7 +60,7 @@ struct YUVDecode
};
fragment float4 SDL_YUV_fragment(CopyVertexOutput vert [[stage_in]],
constant float4 &col [[buffer(0)]],
const device float4 &col [[buffer(0)]],
constant YUVDecode &decode [[buffer(1)]],
texture2d<float> texY [[texture(0)]],
texture2d_array<float> texUV [[texture(1)]],
@ -77,7 +77,7 @@ fragment float4 SDL_YUV_fragment(CopyVertexOutput vert [[stage_in]],
}
fragment float4 SDL_NV12_fragment(CopyVertexOutput vert [[stage_in]],
constant float4 &col [[buffer(0)]],
const device float4 &col [[buffer(0)]],
constant YUVDecode &decode [[buffer(1)]],
texture2d<float> texY [[texture(0)]],
texture2d<float> texUV [[texture(1)]],
@ -93,7 +93,7 @@ fragment float4 SDL_NV12_fragment(CopyVertexOutput vert [[stage_in]],
}
fragment float4 SDL_NV21_fragment(CopyVertexOutput vert [[stage_in]],
constant float4 &col [[buffer(0)]],
const device float4 &col [[buffer(0)]],
constant YUVDecode &decode [[buffer(1)]],
texture2d<float> texY [[texture(0)]],
texture2d<float> texUV [[texture(1)]],

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff