Пример #1
0
        public DefaultRenderRequest(
            IRenderContext renderContext,
            RasterizerState rasterizerState,
            BlendState blendState,
            DepthStencilState depthStencilState,
            IEffect effect,
            string techniqueName,
            IEffectParameterSet effectParameterSet,
            VertexBuffer meshVertexBuffer,
            IndexBuffer meshIndexBuffer,
            PrimitiveType primitiveType,
            Matrix[] instances,
            Action <List <Matrix>, VertexBuffer, IndexBuffer> computeCombinedBuffers,
            LocalisedBoundingRegion boundingRegion)
        {
#if DEBUG
            GraphicsMetricsProfilerVisualiser.RenderRequestsCreated++;
#endif

            RasterizerState         = rasterizerState;
            BlendState              = blendState;
            DepthStencilState       = depthStencilState;
            Effect                  = effect;
            TechniqueName           = techniqueName;
            EffectParameterSet      = effectParameterSet;
            MeshVertexBuffer        = meshVertexBuffer;
            MeshIndexBuffer         = meshIndexBuffer;
            PrimitiveType           = primitiveType;
            Instances               = instances;
            BoundingRegion          = boundingRegion;
            _computeCombinedBuffers = computeCombinedBuffers;

            // Now that the parameter set has been used in a request, prevent it
            // from being changed.
            EffectParameterSet.Lock(renderContext);

            StateHash =
                RasterizerState.GetHashCode() ^ 397 +
                BlendState.GetHashCode() ^ 397 +
                DepthStencilState.GetHashCode() ^ 397 +
                Effect.GetHashCode() ^ 397 +
                TechniqueName.GetHashCode() ^ 397 +
                EffectParameterSet.GetStateHash() ^ 397 +
                MeshVertexBuffer.GetHashCode() ^ 397 +
                MeshIndexBuffer.GetHashCode() ^ 397 +
                PrimitiveType.GetHashCode() ^ 397;
        }
Пример #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (int)Type;
         hashCode = (hashCode * 397) ^ RenderTargetClearColor.GetHashCode();
         hashCode = (hashCode * 397) ^ (RenderTarget != null ? RenderTarget.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (RenderTargets != null ? RenderTargets.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (RenderTargetDepthStencil != null ? RenderTargetDepthStencil.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ TexturesStartSlot;
         hashCode = (hashCode * 397) ^ TextureCount;
         hashCode = (hashCode * 397) ^ (Textures != null ? Textures.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ SamplersStartSlot;
         hashCode = (hashCode * 397) ^ SamplerCount;
         hashCode = (hashCode * 397) ^ (Samplers != null ? Samplers.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ ConstantBuffersStartSlot;
         hashCode = (hashCode * 397) ^ ConstantBufferCount;
         hashCode = (hashCode * 397) ^ (int)ConstantBufferScope;
         hashCode = (hashCode * 397) ^ (ConstantBuffer != null ? ConstantBuffer.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (RasterizerState != null ? RasterizerState.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (DepthStencilState != null ? DepthStencilState.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BlendState != null ? BlendState.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ DepthClear.GetHashCode();
         hashCode = (hashCode * 397) ^ DepthClearStencil.GetHashCode();
         hashCode = (hashCode * 397) ^ (PassName != null ? PassName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)PrimitiveTopology;
         hashCode = (hashCode * 397) ^ VertexBufferBinding.GetHashCode();
         hashCode = (hashCode * 397) ^ VertexCount;
         hashCode = (hashCode * 397) ^ VertexOffset;
         hashCode = (hashCode * 397) ^ (IndexBuffer != null ? IndexBuffer.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)IndexBufferFormat;
         hashCode = (hashCode * 397) ^ IndexCount;
         hashCode = (hashCode * 397) ^ IndexOffset;
         hashCode = (hashCode * 397) ^ (VertexShader != null ? VertexShader.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (PixelShader != null ? PixelShader.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ComputeShader != null ? ComputeShader.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Viewport.GetHashCode();
         hashCode = (hashCode * 397) ^ ScissorRectangle.GetHashCode();
         hashCode = (hashCode * 397) ^ (InputLayout != null ? InputLayout.GetHashCode() : 0);
         return(hashCode);
     }
 }