Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MOVC translation with swizzle #33

Open
wants to merge 51 commits into
base: master
Choose a base branch
from

Commits on Sep 30, 2014

  1. Configuration menu
    Copy the full SHA
    b20c523 View commit details
    Browse the repository at this point in the history

Commits on Apr 8, 2015

  1. Fix incorrect behavior GLSL compiler for ATI cards:

    this case will cast to 0.0:
    intBitsToFloat(int(0xBECCCCCDu));
    
    this case will cast to -0.4:
    uint q = 0xBECCCCCDu;
    intBitsToFloat(int(q));
    
    this case will cast to 0.0 again:
    const uint q = 0xBECCCCCDu;
    intBitsToFloat(int(q));
    MrShoor committed Apr 8, 2015
    Configuration menu
    Copy the full SHA
    9f83393 View commit details
    Browse the repository at this point in the history
  2. Fix incorrect swizzling for ftoi instruction.

    For example instruction:
    ftoi r0.yz, r0.yyzy
    Will translate into:
    Temp[0].yz = intBitsToFloat(ivec4(Temp[0].yyzy).xy);
    Instead correct translate:
    Temp[0].yz = intBitsToFloat(ivec4(Temp[0].yyzy).yz);
    MrShoor committed Apr 8, 2015
    Configuration menu
    Copy the full SHA
    8160436 View commit details
    Browse the repository at this point in the history

Commits on Oct 30, 2015

  1. Fix translation LT instruction:

    lt r2.zw, l(0.000000, 0.000000, 0.500000, 0.500000), |v4.xxxy|
    was:
    Temp[2].zw = uintBitsToFloat(uvec2(lessThan(vec4(intBitsToFloat(0x0), intBitsToFloat(0x0), intBitsToFloat(0x3F000000), intBitsToFloat(0x3F000000)), abs(Input4.xxxy))) * 0xFFFFFFFFu);
    should be:
    Temp[2].zw = uintBitsToFloat(uvec2(lessThan(vec4(intBitsToFloat(0x0), intBitsToFloat(0x0), intBitsToFloat(0x3F000000), intBitsToFloat(0x3F000000)), abs(Input4.xxxy)).zw) * 0xFFFFFFFFu);
    MrShoor committed Oct 30, 2015
    Configuration menu
    Copy the full SHA
    d79f744 View commit details
    Browse the repository at this point in the history

Commits on Apr 9, 2016

  1. Added a little more flexibility when writing the "layout" qualifiers …

    …for resources
    
    - new flag "HLSLCC_FLAG_PREFER_BINDINGS" that causes the compiler to use bindings (rather than locations) for all resources
    - another flag, "HLSLCC_FLAG_ASSIGN_DESCRIPTOR_SET" uses the set qualifier to distinguish between resource bindings and constant buffer bindings
    - this is intended to be used when compiling HLSL -> SPIR-V (via GLSL).
    djewsbury committed Apr 9, 2016
    Configuration menu
    Copy the full SHA
    8ada495 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4b7de53 View commit details
    Browse the repository at this point in the history
  3. Explicitly specifying matrix dimensions

    - in order to support float3x4/float4x3 type matrices
    djewsbury committed Apr 9, 2016
    Configuration menu
    Copy the full SHA
    853f47f View commit details
    Browse the repository at this point in the history

Commits on Apr 13, 2016

  1. Configuration menu
    Copy the full SHA
    5cbc6c8 View commit details
    Browse the repository at this point in the history

Commits on Apr 15, 2016

  1. Removed a line that write "subroutine void SubroutineType();" into al…

    …l shaders with higher GLSL version numbers
    
    - it's not clear to me what the intention of this line is
    - however, it causes a compile error when attempting to compile the result to SPIR-V (which doesn't support subroutines)
    djewsbury committed Apr 15, 2016
    Configuration menu
    Copy the full SHA
    eb520e4 View commit details
    Browse the repository at this point in the history

Commits on Apr 18, 2016

  1. INEG instruction can now handle format conversions and swizzling prop…

    …erly
    
    - new CallUnaryOp, which duplicates the behaviour of CallBinaryOp function (but for unary operations)
    - this allows the INEG instruction (which is translated as X = 0 - A) to deal with complex swizzling operations, as well as casting (when the register types are not integers)
    djewsbury committed Apr 18, 2016
    Configuration menu
    Copy the full SHA
    8420fdd View commit details
    Browse the repository at this point in the history
  2. RESINFO instruction now translates to imageSize when appropriate

    - previously, textureSize was always used for RESINFO, regardless of the type of the object we were querying
    - UAV declarations are translated into "image" types, and so size queries should use the corresponding function, "imageSize"
    - this only works when targetting GLSL 4.3 (which is the standard that adds imageSize)
    	- when targetting early languages, using RESINFO with a UAV will result in uncompilable code
    djewsbury committed Apr 18, 2016
    Configuration menu
    Copy the full SHA
    9345ac3 View commit details
    Browse the repository at this point in the history
  3. Support for "GL_KHR_vulkan_glsl" extension

    - this extension renames gl_VertexID -> gl_VertexIndex and gl_InstanceID -> gl_InstanceIndex
    - this is required when using the GLSL -> SPIR-V path
    djewsbury committed Apr 18, 2016
    Configuration menu
    Copy the full SHA
    81a07e3 View commit details
    Browse the repository at this point in the history
  4. Using "TranslateTexCoord" for all variations of "GATHER" instructions

    - this is required when doing a depth compare gather on an array of 2d textures (for example)
    - previously, this was implemented for some variations of the GATHER instruction
    - this change uses the same logic for all variations
    djewsbury committed Apr 18, 2016
    Configuration menu
    Copy the full SHA
    5ffcb6b View commit details
    Browse the repository at this point in the history
  5. Improved support for output variables from vertex shaders that have o…

    …verlap on the same location
    
    - now, all output locations get a temporary "vec4"
    - we copy from those vec4 values to the actual output values in a fixup step at the end of the shader
    - previously there was an attempt at this behaviour with #defines
    	- however, this required declaring one of the output variables as a vec4 (even if really wasn't)
    	- this solution handles more cases and results in a shader interface that better matches the original HLSL code
    - there may be issues with types largers than a vec4 (such as a matrix)
    - currently this is only supported for vertex shader outputs... but it could be made more general and used for other shader types
    djewsbury committed Apr 18, 2016
    Configuration menu
    Copy the full SHA
    2408f08 View commit details
    Browse the repository at this point in the history
  6. Fix for RESINFO instruction when using complex swizzle patterns on th…

    …e destination
    
    - previously, RESINFO instruction only supported some "mask" type swizzle pattern for the destination
    - this adds support for all swizzle patterns
    - added a new function that can calculate the order of the components referenced by a given swizzle pattern
    	- that is, it converts the swizzle values into an array of 4 ints, where each int references either x, y, z or w
    djewsbury committed Apr 18, 2016
    Configuration menu
    Copy the full SHA
    3182d86 View commit details
    Browse the repository at this point in the history
  7. Shader inputs are now correctly sized for the used components

    - previously all shader inputs would be 4 component vectors
    - this could cause shader linking errors now that vertex shaders can output fewer components
    - this change uses the "component" layout attribute and uses the correct sized vector types
    djewsbury committed Apr 18, 2016
    Configuration menu
    Copy the full SHA
    017bf7f View commit details
    Browse the repository at this point in the history

Commits on Apr 22, 2016

  1. typecast of gl_FrontFacing should match with type of destination Input

    code:
      uvec4 Input7
      Input7.x = uint(gl_FrontFacing);
    
    cause: error C7011: implicit cast from "int" to "uint"
    at least at NVidia GF960
    MrShoor committed Apr 22, 2016
    Configuration menu
    Copy the full SHA
    cb719bd View commit details
    Browse the repository at this point in the history

Commits on Apr 25, 2016

  1. New callback to allow the client to construct the rules for selecting…

    … binding points and descriptor set indices
    
    - Clients can use the callback function, EvaluateBindingFn, to select any binding, descriptor set, or location for HLSL resources
    	- clients get access to the type, HLSL binding register information and name with which to make an assignment
    - this is important for Vulkan, were we need to assign descriptor sets to resources
    - depreciated the previous flags, HLSLCC_FLAG_PREFER_BINDINGS & HLSLCC_FLAG_ASSIGN_DESCRIPTOR_SET, since this is much more powerful solution
    djewsbury committed Apr 25, 2016
    Configuration menu
    Copy the full SHA
    fc0c9e6 View commit details
    Browse the repository at this point in the history

Commits on Apr 27, 2016

  1. Added support for separated texture and sampler objects (as defined b…

    …y GL_KHR_vulkan_glsl)
    
    - this is useful when compiling to Vulkan
    - when using the "Load" method in texture objects in HLSL, we need to use a dummy sampler in the generated GLSL
    	- this appears to only be required in order to compile... the sampler may have no effect on the output
    	- the dummy sampler is bound to s16 by default; but it can be rebound using the bind evaluation function
    djewsbury committed Apr 27, 2016
    Configuration menu
    Copy the full SHA
    fdf1201 View commit details
    Browse the repository at this point in the history
  2. UAV objects can now have binding and set information

    djewsbury committed Apr 27, 2016
    Configuration menu
    Copy the full SHA
    92f4e70 View commit details
    Browse the repository at this point in the history
  3. Passing ResourceBinding information through to the "evaluate binding"…

    … function for buffers
    
    - this allows us to distinquish between StructuredBuffer types and ConstantBuffers
    - both types have a "ConstantBuffer" object
    - but the true type can be determined from the "eType" member of the ResourceBinding object
    djewsbury committed Apr 27, 2016
    Configuration menu
    Copy the full SHA
    6ced4a1 View commit details
    Browse the repository at this point in the history

Commits on Apr 28, 2016

  1. Configuration menu
    Copy the full SHA
    cd2c8af View commit details
    Browse the repository at this point in the history
  2. Changed the naming conventions for RWStructuredBuffers to match Struc…

    …turedBuffers
    
    - this allows the RWStructedBuffer's "buffer" object to contain the true name
    - that name will be preserved in the SPIR-V code and allows us to get at it using reflection on the SPIR-V bytecode
    djewsbury committed Apr 28, 2016
    Configuration menu
    Copy the full SHA
    fdf08ed View commit details
    Browse the repository at this point in the history

Commits on May 2, 2016

  1. More robust handling of swizzling for FTOI, FTOU, ITOF, UTOF and RESI…

    …NFO instructions
    
    - these instructions were interpreted incorrectly for cases where the destination swizzle was not a contiguous sequence from .x
    - the new method handles more cases...
    	- but this is only applied to a few instructions
    	- it should really effect many instructions!
    djewsbury committed May 2, 2016
    Configuration menu
    Copy the full SHA
    ea29040 View commit details
    Browse the repository at this point in the history
  2. Another fix to FTOU/UTOF swizzling

    djewsbury committed May 2, 2016
    Configuration menu
    Copy the full SHA
    816499d View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    94b5bd6 View commit details
    Browse the repository at this point in the history

Commits on May 3, 2016

  1. Better logic for selecting method for "vec1", "uvec1", etc

    - selecting a #define for languages that support scalar swizzle, or falling back to old solution otherwise
    djewsbury committed May 3, 2016
    Configuration menu
    Copy the full SHA
    9a74ca3 View commit details
    Browse the repository at this point in the history
  2. Fix for single intructions that load from multiple cbuffer variables

    - Sometimes a single instruction will use values from multiple constant buffer variables.
    	- So, for example, a constant buffer might look like this:
    		cbuffer Buffer { float3 Vector; float Scalar; }
    	- Now consider the following statement:
    		variable = float4(Vector, Scalar);
    	- this can become a single instruction, because both Vector and Scalar are packed into the same 4d vector in the cbuffer
    - new code for loading from a cbuffer that handles these cases
    - also some improvements to the swizzling code to handle more cases
    djewsbury committed May 3, 2016
    Configuration menu
    Copy the full SHA
    8a8bf5c View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    8444828 View commit details
    Browse the repository at this point in the history
  4. Fixes for geometry shader input variables

    djewsbury committed May 3, 2016
    Configuration menu
    Copy the full SHA
    3f8370c View commit details
    Browse the repository at this point in the history

Commits on May 17, 2016

  1. Minor change to the cmake config to make it easier to generate separa…

    …te Win32/x64 target builds
    djewsbury committed May 17, 2016
    Configuration menu
    Copy the full SHA
    ca20f37 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ce15153 View commit details
    Browse the repository at this point in the history

Commits on May 19, 2016

  1. Using an "instance" name for all cbuffers when GL_KHR_vulkan_glsl is …

    …enabled
    
    - an instance name is required using the layout(push_constant) qualifier
    - so we use an instance name for all cbuffers to cover this case
    djewsbury committed May 19, 2016
    Configuration menu
    Copy the full SHA
    1ec4781 View commit details
    Browse the repository at this point in the history

Commits on Aug 24, 2016

  1. Configuration menu
    Copy the full SHA
    a8e1cea View commit details
    Browse the repository at this point in the history
  2. Merge branch 'master' of https://github.com/James-Jones/HLSLCrossComp…

    …iler
    
    Conflicts:
    	src/toGLSLDeclaration.c
    MrShoor committed Aug 24, 2016
    Configuration menu
    Copy the full SHA
    a4e0c8e View commit details
    Browse the repository at this point in the history
  3. Domain shader input arrays now sized using gl_MaxPatchVertices (like …

    …Hull shader)
    
    Fixes the following error seen on an NVIDIA driver.
    
    Number components of parameters for domain shader should match with number components of input parameters of fragment shader
    MrShoor committed Aug 24, 2016
    Configuration menu
    Copy the full SHA
    bd1096e View commit details
    Browse the repository at this point in the history

Commits on Aug 25, 2016

  1. OPERAND_TYPE_INPUT_FORK_INSTANCE_ID should be presented as SVT_INT da…

    …ta type
    
    HS_CTRL_POINT_PHASE require post shader code phase (because it contain writing to gl_out)
    SetDataTypes current working wrong, because for case:
       8: mov r0.x, vForkInstanceID.x
       9: mov o[r0.x + 0].x, l(5.000000)
    will generated incorrect code:
            //MOV
            Temp_int[0].x = ivec4(floatBitsToInt(forkInstanceID)).x; // writing to Temp_int
            //MOV
            Output0[int(Temp[0].x)].x = vec4(immediateConstBufferF(int(Temp_int[0].x)).x).x; // but reading from Temp
    due psOperand->psSubOperand[0]->aeDataType == SVT_FLOAT of destination operand o[r0.x + 0].x
    MrShoor committed Aug 25, 2016
    Configuration menu
    Copy the full SHA
    a601b5d View commit details
    Browse the repository at this point in the history

Commits on Aug 26, 2016

  1. Configuration menu
    Copy the full SHA
    73e624d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6c9c801 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e64ed95 View commit details
    Browse the repository at this point in the history

Commits on Sep 29, 2016

  1. Configuration menu
    Copy the full SHA
    5522379 View commit details
    Browse the repository at this point in the history

Commits on Dec 6, 2016

  1. fix swizling case for vec1 inputs:

    vec1 Input6;
    //....
    Temp[123] = Input6.xxx + Input3.xyz;
    should be represented as:
    vec1 Input6;
    //....
    Temp[123] = vec3(Input6.x) + Input3.xyz;
    mrshoor committed Dec 6, 2016
    Configuration menu
    Copy the full SHA
    0751d57 View commit details
    Browse the repository at this point in the history
  2. fix link error due optimization

    mrshoor committed Dec 6, 2016
    Configuration menu
    Copy the full SHA
    509c9b8 View commit details
    Browse the repository at this point in the history

Commits on Jan 22, 2017

  1. fix compilation error in Visual Studio

    Joao Paulo Magalhaes committed Jan 22, 2017
    Configuration menu
    Copy the full SHA
    bf33242 View commit details
    Browse the repository at this point in the history

Commits on May 31, 2018

  1. Configuration menu
    Copy the full SHA
    0e7c7bf View commit details
    Browse the repository at this point in the history
  2. fix: scalar type cannot be swizzled in GLSL

    fix: impossible assign vec1 to float
    MrShoor committed May 31, 2018
    Configuration menu
    Copy the full SHA
    c23bf2d View commit details
    Browse the repository at this point in the history

Commits on Jun 2, 2018

  1. Configuration menu
    Copy the full SHA
    78c8d63 View commit details
    Browse the repository at this point in the history

Commits on Jun 4, 2018

  1. fix swizzling at scalar types

    fix input declaraion crashes
    MrShoor committed Jun 4, 2018
    Configuration menu
    Copy the full SHA
    d70f910 View commit details
    Browse the repository at this point in the history

Commits on Jul 27, 2018

  1. Configuration menu
    Copy the full SHA
    22a61ce View commit details
    Browse the repository at this point in the history

Commits on Aug 30, 2018

  1. Configuration menu
    Copy the full SHA
    2f57479 View commit details
    Browse the repository at this point in the history

Commits on Sep 16, 2018

  1. * structs can't be used as input semantics

    upd. for vertex shaders only
    MrShoor committed Sep 16, 2018
    Configuration menu
    Copy the full SHA
    0276f42 View commit details
    Browse the repository at this point in the history