Declare references as constant in the metal renderers.
This silences a warning that appeared with iOS 13, and is more efficient in general. Bug: webrtc:10866 Change-Id: I23db6b78af36e59b1d825d3f0cccc6008f9b626a Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/149808 Commit-Queue: Kári Helgason <kthelgason@webrtc.org> Reviewed-by: Anders Carlsson <andersc@webrtc.org> Cr-Commit-Position: refs/heads/master@{#28911}
This commit is contained in:
parent
2579f0c584
commit
93d4c10ffc
@ -33,10 +33,10 @@ static NSString *const shaderSource = MTL_STRINGIFY(
|
||||
float2 texcoord;
|
||||
} Varyings;
|
||||
|
||||
vertex Varyings vertexPassthrough(device Vertex * verticies[[buffer(0)]],
|
||||
vertex Varyings vertexPassthrough(constant Vertex *verticies[[buffer(0)]],
|
||||
unsigned int vid[[vertex_id]]) {
|
||||
Varyings out;
|
||||
device Vertex &v = verticies[vid];
|
||||
constant Vertex &v = verticies[vid];
|
||||
out.position = float4(float2(v.position), 0.0, 1.0);
|
||||
out.texcoord = v.texcoord;
|
||||
|
||||
@ -44,7 +44,8 @@ static NSString *const shaderSource = MTL_STRINGIFY(
|
||||
}
|
||||
|
||||
fragment half4 fragmentColorConversion(
|
||||
Varyings in[[stage_in]], texture2d<float, access::sample> textureY[[texture(0)]],
|
||||
Varyings in[[stage_in]],
|
||||
texture2d<float, access::sample> textureY[[texture(0)]],
|
||||
texture2d<float, access::sample> textureU[[texture(1)]],
|
||||
texture2d<float, access::sample> textureV[[texture(2)]]) {
|
||||
constexpr sampler s(address::clamp_to_edge, filter::linear);
|
||||
|
||||
@ -34,10 +34,10 @@ static NSString *const shaderSource = MTL_STRINGIFY(
|
||||
float2 texcoord;
|
||||
} Varyings;
|
||||
|
||||
vertex Varyings vertexPassthrough(device Vertex * verticies[[buffer(0)]],
|
||||
vertex Varyings vertexPassthrough(constant Vertex *verticies[[buffer(0)]],
|
||||
unsigned int vid[[vertex_id]]) {
|
||||
Varyings out;
|
||||
device Vertex &v = verticies[vid];
|
||||
constant Vertex &v = verticies[vid];
|
||||
out.position = float4(float2(v.position), 0.0, 1.0);
|
||||
out.texcoord = v.texcoord;
|
||||
return out;
|
||||
@ -45,7 +45,8 @@ static NSString *const shaderSource = MTL_STRINGIFY(
|
||||
|
||||
// Receiving YCrCb textures.
|
||||
fragment half4 fragmentColorConversion(
|
||||
Varyings in[[stage_in]], texture2d<float, access::sample> textureY[[texture(0)]],
|
||||
Varyings in[[stage_in]],
|
||||
texture2d<float, access::sample> textureY[[texture(0)]],
|
||||
texture2d<float, access::sample> textureCbCr[[texture(1)]]) {
|
||||
constexpr sampler s(address::clamp_to_edge, filter::linear);
|
||||
float y;
|
||||
|
||||
@ -34,17 +34,17 @@ static NSString *const shaderSource = MTL_STRINGIFY(
|
||||
float2 texcoord;
|
||||
} VertexIO;
|
||||
|
||||
vertex VertexIO vertexPassthrough(device Vertex * verticies[[buffer(0)]],
|
||||
vertex VertexIO vertexPassthrough(constant Vertex *verticies[[buffer(0)]],
|
||||
uint vid[[vertex_id]]) {
|
||||
VertexIO out;
|
||||
device Vertex &v = verticies[vid];
|
||||
constant Vertex &v = verticies[vid];
|
||||
out.position = float4(float2(v.position), 0.0, 1.0);
|
||||
out.texcoord = v.texcoord;
|
||||
return out;
|
||||
}
|
||||
|
||||
fragment half4 fragmentColorConversion(
|
||||
VertexIO in[[stage_in]], texture2d<half, access::sample> texture[[texture(0)]],
|
||||
fragment half4 fragmentColorConversion(VertexIO in[[stage_in]],
|
||||
texture2d<half, access::sample> texture[[texture(0)]],
|
||||
constant bool &isARGB[[buffer(0)]]) {
|
||||
constexpr sampler s(address::clamp_to_edge, filter::linear);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user