Update the postprocessing shader and vertex array for the Metal changes.

Closes #201.
This commit is contained in:
Patrick Walton 2019-06-21 18:04:18 -07:00
parent 2c49a3360e
commit d86ff9011a
4 changed files with 22 additions and 8 deletions

View File

@ -654,7 +654,7 @@ where
}
}
self.device.draw_arrays(4, &RenderState {
self.device.draw_elements(6, &RenderState {
target: &self.dest_render_target(),
program: &self.postprocess_program.program,
vertex_array: &self.postprocess_vertex_array.vertex_array,
@ -1451,7 +1451,7 @@ where
device.configure_vertex_attr(&vertex_array, &position_attr, &VertexAttrDescriptor {
size: 2,
class: VertexAttrClass::Int,
attr_type: VertexAttrType::U16,
attr_type: VertexAttrType::I16,
stride: 4,
offset: 0,
divisor: 0,

View File

@ -19,7 +19,13 @@ in ivec2 aPosition;
out vec2 vTexCoord;
void main(){
vTexCoord = vec2(aPosition);
gl_Position = vec4(vec2(aPosition)* 2.0 - 1.0, 0.0, 1.0);
vec2 position = vec2(aPosition);
vTexCoord = position;
gl_Position = vec4(vec2(position)* 2.0 - 1.0, 0.0, 1.0);
}

View File

@ -18,8 +18,10 @@ struct main0_in
vertex main0_out main0(main0_in in [[stage_in]])
{
main0_out out = {};
out.vTexCoord = float2(in.aPosition);
out.gl_Position = float4((float2(in.aPosition) * 2.0) - float2(1.0), 0.0, 1.0);
float2 position = float2(in.aPosition);
out.vTexCoord = position;
position.y = 1.0 - position.y;
out.gl_Position = float4((float2(position) * 2.0) - float2(1.0), 0.0, 1.0);
return out;
}

View File

@ -17,6 +17,12 @@ in ivec2 aPosition;
out vec2 vTexCoord;
void main() {
vTexCoord = vec2(aPosition);
gl_Position = vec4(vec2(aPosition) * 2.0 - 1.0, 0.0, 1.0);
vec2 position = vec2(aPosition);
vTexCoord = position;
#ifdef PF_ORIGIN_UPPER_LEFT
// FIXME(pcwalton): This is wrong.
position.y = 1.0 - position.y;
#endif
gl_Position = vec4(vec2(position) * 2.0 - 1.0, 0.0, 1.0);
}