51c22a1f51
Supported on OpenGL (and ES) 3.0+ and everywhere else. Can also be a render target, targeting a single slice at a time. Can be mipmapped, cannot be multisample. Reading back a given slice from a 3D texture is left as a future exercise, for now it is documented to be not supported. Upload is going to be limited to one slice in one upload entry, just like we specify one face or one miplevel for cubemap and mipmapped textures. This also involves some welcome hardening of how texture subresources are described internally: as we no longer can count on a layer index between 0..5 (as is the case with cubemaps), simply arrays with MAX_LAYER==6 are no longer sufficient. Switch to sufficiently dynamic data structures where applicable. On Vulkan rendering to a slice needs Vulkan 1.1 (and 1.1 enabled on the VkInstance). Task-number: QTBUG-89703 Change-Id: Ide6c20124ec9201d94ffc339dd479cd1ece777b0 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
25 lines
442 B
GLSL
25 lines
442 B
GLSL
#version 440
|
|
|
|
layout(location = 0) in vec2 v_texcoord;
|
|
|
|
layout(location = 0) out vec4 fragColor;
|
|
|
|
layout(std140, binding = 0) uniform buf {
|
|
mat4 mvp;
|
|
int flip;
|
|
int idx;
|
|
} ubuf;
|
|
|
|
layout(binding = 1) uniform sampler3D tex;
|
|
|
|
void main()
|
|
{
|
|
float w = 0.0;
|
|
if (ubuf.idx == 1)
|
|
w = 0.5;
|
|
else if (ubuf.idx == 2)
|
|
w = 1.0;
|
|
vec4 c = texture(tex, vec3(v_texcoord, w));
|
|
fragColor = vec4(c.rgb * c.a, c.a);
|
|
}
|