mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-04-11 20:03:11 +00:00
[qfcc] Get some more texture functions implemented
GLSL's texture functions are a bit of a nightmare. The return types are wrong, but I need to decide how I want to pull the sample type from a texture or sampler.
This commit is contained in:
parent
09bd49814e
commit
03bbfde5f1
2 changed files with 11 additions and 1 deletions
|
@ -358,6 +358,7 @@ SRC_LINE
|
|||
"#define uint unsigned" "\n"
|
||||
"#define uvec2 uivec2" "\n"
|
||||
"#define sampler(t,d,m,a,s) @handle t##sampler##d##m##a##s" "\n"
|
||||
"#define _texture(t,d,m,a,s) @handle t##texture##d##m##a##s" "\n"
|
||||
"@generic(genFType=@vector(float)," "\n"
|
||||
" genDType=@vector(double)," "\n"
|
||||
" genIType=@vector(int)," "\n"
|
||||
|
@ -368,6 +369,12 @@ SRC_LINE
|
|||
" ivec=[ivec2,ivec3,ivec4]," "\n"
|
||||
" uvec=[uivec2,uivec3,uivec4]," "\n"
|
||||
" bvec=[bvec2,bvec3,bvec4]," "\n"
|
||||
" gtextureBuffer=[_texture(,Buffer,,,)," "\n"
|
||||
" _texture(i,Buffer,,,)," "\n"
|
||||
" _texture(u,Buffer,,,)]," "\n"
|
||||
" gsamplerCube=[sampler(,Cube,,,)," "\n"
|
||||
" sampler(i,Cube,,,)," "\n"
|
||||
" sampler(u,Cube,,,)]," "\n"
|
||||
" gsampler2DArray=[sampler(,2D,,Array,)," "\n"
|
||||
" sampler(i,2D,,Array,)," "\n"
|
||||
" sampler(u,2D,,Array,)]," "\n"
|
||||
|
@ -606,10 +613,13 @@ SRC_LINE
|
|||
"genIType findLSB(genUType value);" "\n"
|
||||
"genIType findMSB(highp genIType value);" "\n"
|
||||
"genIType findMSB(highp genUType value);" "\n"
|
||||
"//FIXME these are wrong (ret type)\n"
|
||||
"vec4 texture(gsampler1D sampler, float P ) = " SPV(87) ";" "\n"
|
||||
"vec4 texture(gsampler2D sampler, vec2 P ) = " SPV(87) ";" "\n"
|
||||
"vec4 texture(gsampler3D sampler, vec3 P ) = " SPV(87) ";" "\n"
|
||||
"vec4 texture(gsampler2DArray sampler, vec3 P ) = " SPV(87) ";" "\n"
|
||||
"vec4 texture(gsamplerCube sampler, vec3 P ) = " SPV(87) ";" "\n"
|
||||
"vec4 texelFetch(gtextureBuffer sampler, int P) = " SPV(95) ";" "\n"
|
||||
"};" "\n"
|
||||
"#undef out" "\n"
|
||||
"#undef highp" "\n"
|
||||
|
|
|
@ -1715,7 +1715,7 @@ glsl_parse_image (const char *token, rua_ctx_t *ctx)
|
|||
.sampled = type.val,
|
||||
.format = 0, //unknown (comes from layout)
|
||||
};
|
||||
if (type.val == 0) { // sampler
|
||||
if (type.val == 1) { // sampler
|
||||
auto shad = *find_image_sub (image_shadow, token + offset);
|
||||
offset += strlen (shad.substr);
|
||||
image.depth = shad.val;
|
||||
|
|
Loading…
Reference in a new issue