This covers implementation of the GPUTexture abstraction for the Metal backend, with additional utility functionality as required. Some components have been temporarily disabled pending dependencies on upcoming Metal backend components, and these will be addressed as the backend is fleshed out. One core challenge addressed in the Metal backend is the requirement for read/update routines for textures. MTLBlitCommandEncoders offer a limited range of the full functionality provided by OpenGLs texture update and read functions such that a series of compute kernels have been implemented to provide advanced functionality such as data format conversion and partial/swizzled component updates. This diff is provided in full, but if further division is required for purposes of code review, this can be done. Authored by Apple: Michael Parkin-White Ref T96261 Reviewed By: fclem Maniphest Tasks: T96261 Differential Revision: https://developer.blender.org/D14543
33 lines
691 B
GLSL
33 lines
691 B
GLSL
|
|
uniform vec2 extent;
|
|
uniform vec2 offset;
|
|
uniform vec2 size;
|
|
out vec2 texCoord_interp;
|
|
in vec2 pos;
|
|
|
|
void main()
|
|
{
|
|
vec4 rect = vec4(offset.x, offset.y, offset.x + extent.x, offset.y + extent.y);
|
|
rect /= vec4(size, size);
|
|
vec4 tex = rect;
|
|
rect = rect * 2.0 - 1.0;
|
|
|
|
/* QUAD */
|
|
if (pos.x == 0.0 && pos.y == 0.0) {
|
|
rect.xy = rect.xy;
|
|
texCoord_interp = tex.xy;
|
|
}
|
|
else if (pos.x == 0.0 && pos.y == 1.0) {
|
|
rect.xy = rect.xw;
|
|
texCoord_interp = tex.xw;
|
|
}
|
|
else if (pos.x == 1.0 && pos.y == 1.0) {
|
|
rect.xy = rect.zw;
|
|
texCoord_interp = tex.zw;
|
|
}
|
|
else {
|
|
rect.xy = rect.zy;
|
|
texCoord_interp = tex.zy;
|
|
}
|
|
gl_Position = vec4(rect.xy, 0.0f, 1.0f);
|
|
} |