Skip to content
Snippets Groups Projects
Unverified Commit 8ff1ce68 authored by Samuliak's avatar Samuliak
Browse files

metal: flip y texture coordinate

parent e3ab4c63
No related branches found
No related tags found
No related merge requests found
...@@ -279,10 +279,10 @@ std::unique_ptr<GraphicsPipeline> PipelineCache::CreateGraphicsPipeline( ...@@ -279,10 +279,10 @@ std::unique_ptr<GraphicsPipeline> PipelineCache::CreateGraphicsPipeline(
#include <metal_stdlib> #include <metal_stdlib>
using namespace metal; using namespace metal;
constant float2 texCoords[] = { constant float2 positions[] = {
float2(0.0, -1.0), float2(-1.0, -3.0),
float2(0.0, 1.0), float2(-1.0, 1.0),
float2(2.0, 1.0), float2( 3.0, 1.0),
}; };
struct VertexOut { struct VertexOut {
...@@ -292,8 +292,9 @@ std::unique_ptr<GraphicsPipeline> PipelineCache::CreateGraphicsPipeline( ...@@ -292,8 +292,9 @@ std::unique_ptr<GraphicsPipeline> PipelineCache::CreateGraphicsPipeline(
vertex VertexOut vertexMain(uint vid [[vertex_id]]) { vertex VertexOut vertexMain(uint vid [[vertex_id]]) {
VertexOut out; VertexOut out;
out.position = float4(texCoords[vid] * 2.0 - 1.0, 0.0, 1.0); out.position = float4(positions[vid], 0.0, 1.0);
out.texCoord = texCoords[vid]; out.texCoord = positions[vid] * 0.5 + 0.5;
out.texCoord.y = 1.0 - out.texCoord.y;
return out; return out;
} }
......
...@@ -80,10 +80,10 @@ void RendererMetal::CreateBlitPipelineState() { ...@@ -80,10 +80,10 @@ void RendererMetal::CreateBlitPipelineState() {
#include <metal_stdlib> #include <metal_stdlib>
using namespace metal; using namespace metal;
constant float2 texCoords[] = { constant float2 positions[] = {
float2(0.0, -1.0), float2(-1.0, -3.0),
float2(0.0, 1.0), float2(-1.0, 1.0),
float2(2.0, 1.0), float2( 3.0, 1.0),
}; };
struct VertexOut { struct VertexOut {
...@@ -93,8 +93,9 @@ void RendererMetal::CreateBlitPipelineState() { ...@@ -93,8 +93,9 @@ void RendererMetal::CreateBlitPipelineState() {
vertex VertexOut vertexMain(uint vid [[vertex_id]]) { vertex VertexOut vertexMain(uint vid [[vertex_id]]) {
VertexOut out; VertexOut out;
out.position = float4(texCoords[vid] * 2.0 - 1.0, 0.0, 1.0); out.position = float4(positions[vid], 0.0, 1.0);
out.texCoord = texCoords[vid]; out.texCoord = positions[vid] * 0.5 + 0.5;
out.texCoord.y = 1.0 - out.texCoord.y;
return out; return out;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment