mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-25 16:22:47 +01:00
metal: flip y texture coordinate
This commit is contained in:
parent
e3ab4c6349
commit
8ff1ce68c3
2 changed files with 14 additions and 12 deletions
|
@ -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(
|
||||||
|
|
||||||
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() {
|
||||||
#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() {
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue