Skip to content

Commit

Permalink
2D shadow and 2D array uniforms got their own types
Browse files Browse the repository at this point in the history
  • Loading branch information
aras-p committed Aug 28, 2015
1 parent bfa3868 commit 40da708
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 11 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Expand Up @@ -4,6 +4,10 @@ GLSL optimizer Change Log
2015 08
-------

Changes:

* 2D shadow and 2D array uniforms got their own glslopt_basic_type entries.

Fixes:

* Fixed translation of 2D texture arrays (GLSL with EXT_texture_array, GLES3 and Metal).
Expand Down
9 changes: 8 additions & 1 deletion src/glsl/glsl_optimizer.cpp
Expand Up @@ -523,7 +523,14 @@ static void glsl_type_to_optimizer_desc(const glsl_type* type, glsl_precision pr
else if (type->is_sampler())
{
if (type->sampler_dimensionality == GLSL_SAMPLER_DIM_2D)
out->type = kGlslTypeTex2D;
{
if (type->sampler_shadow)
out->type = kGlslTypeTex2DShadow;
else if (type->sampler_array)
out->type = kGlslTypeTex2DArray;
else
out->type = kGlslTypeTex2D;
}
else if (type->sampler_dimensionality == GLSL_SAMPLER_DIM_3D)
out->type = kGlslTypeTex3D;
else if (type->sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE)
Expand Down
2 changes: 2 additions & 0 deletions src/glsl/glsl_optimizer.h
Expand Up @@ -51,6 +51,8 @@ enum glslopt_basic_type {
kGlslTypeTex2D,
kGlslTypeTex3D,
kGlslTypeTexCube,
kGlslTypeTex2DShadow,
kGlslTypeTex2DArray,
kGlslTypeOther,
kGlslTypeCount
};
Expand Down
2 changes: 1 addition & 1 deletion tests/fragment/tex2DArray-out.txt
Expand Up @@ -11,4 +11,4 @@ void main ()
// inputs: 1
// #0: uv (high float) 4x1 [-1]
// textures: 1
// #0: myarr (high 2d) 0x0 [-1]
// #0: myarr (high 2darray) 0x0 [-1]
2 changes: 1 addition & 1 deletion tests/fragment/tex2DArray-outES3.txt
Expand Up @@ -30,4 +30,4 @@ void main ()
// inputs: 1
// #0: uv (high float) 4x1 [-1]
// textures: 1
// #0: myarr (low 2d) 0x0 [-1]
// #0: myarr (low 2darray) 0x0 [-1]
2 changes: 1 addition & 1 deletion tests/fragment/tex2DArray-outES3Metal.txt
Expand Up @@ -39,4 +39,4 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
// inputs: 1
// #0: uv (high float) 4x1 [-1]
// textures: 1
// #0: myarr (low 2d) 0x0 [-1] loc 0
// #0: myarr (low 2darray) 0x0 [-1] loc 0
2 changes: 1 addition & 1 deletion tests/fragment/tex2dshadow-out.txt
Expand Up @@ -10,4 +10,4 @@ void main ()
// inputs: 1
// #0: xlv_TEXCOORD0 (high float) 4x1 [-1]
// textures: 1
// #0: shadowmap (high 2d) 0x0 [-1]
// #0: shadowmap (high 2dshadow) 0x0 [-1]
2 changes: 1 addition & 1 deletion tests/fragment/tex2dshadow-outES.txt
Expand Up @@ -13,4 +13,4 @@ void main ()
// inputs: 1
// #0: xlv_TEXCOORD0 (high float) 4x1 [-1]
// textures: 1
// #0: shadowmap (low 2d) 0x0 [-1]
// #0: shadowmap (low 2dshadow) 0x0 [-1]
2 changes: 1 addition & 1 deletion tests/fragment/tex2dshadow-outES3.txt
Expand Up @@ -20,4 +20,4 @@ void main ()
// #0: uvHi (high float) 4x1 [-1]
// #1: uvMed (medium float) 4x1 [-1]
// textures: 1
// #0: shadowmap (low 2d) 0x0 [-1]
// #0: shadowmap (low 2dshadow) 0x0 [-1]
2 changes: 1 addition & 1 deletion tests/fragment/tex2dshadow-outES3Metal.txt
Expand Up @@ -30,4 +30,4 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
// #0: uvHi (high float) 4x1 [-1]
// #1: uvMed (medium float) 4x1 [-1]
// textures: 1
// #0: shadowmap (low 2d) 0x0 [-1] loc 0
// #0: shadowmap (low 2dshadow) 0x0 [-1] loc 0
2 changes: 1 addition & 1 deletion tests/fragment/texProj-outES.txt
Expand Up @@ -38,4 +38,4 @@ void main ()
// #0: uv (high float) 4x1 [-1]
// textures: 2
// #0: tex (low 2d) 0x0 [-1]
// #1: shadowmap (low 2d) 0x0 [-1]
// #1: shadowmap (low 2dshadow) 0x0 [-1]
2 changes: 1 addition & 1 deletion tests/fragment/texProj-outES3.txt
Expand Up @@ -20,4 +20,4 @@ void main ()
// #0: uv (high float) 4x1 [-1]
// textures: 2
// #0: tex (low 2d) 0x0 [-1]
// #1: shadowmap (low 2d) 0x0 [-1]
// #1: shadowmap (low 2dshadow) 0x0 [-1]
2 changes: 1 addition & 1 deletion tests/fragment/texProj-outES3Metal.txt
Expand Up @@ -30,4 +30,4 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
// #0: uv (high float) 4x1 [-1]
// textures: 2
// #0: tex (low 2d) 0x0 [-1] loc 0
// #1: shadowmap (low 2d) 0x0 [-1] loc 1
// #1: shadowmap (low 2dshadow) 0x0 [-1] loc 1

0 comments on commit 40da708

Please sign in to comment.