Hash :
e8528d89
Author :
Date :
2016-05-16T17:50:52
Fix determining texture mipmap completeness The code didn't previously take base level properly into account when determining how many levels to check when checking for texture completeness. The code is refactored so that the "q" value in spec, that is the maximum mipmap level for determining completeness, can be queried from TextureState. This value is used now for checking completeness. This requires moving ImageDescs under TextureState. Functions that operate on the ImageDesc array are also moved from Texture to TextureState. TextureState members are also renamed to start with the "m" prefix and made private. Also handle levels outside the base/max level range consistently in eglCreateImageKHR validation. We interpret the spec so that if the level used for the EGL image is not a part of the texture levels that affect texture completeness, an error is generated. BUG=angleproject:596 TEST=angle_end2end_tests Change-Id: I038ef24aa83e0a6905ca3c0bbada5989eecb00d9 Reviewed-on: https://chromium-review.googlesource.com/344880 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
//
// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Blit11.cpp: Texture copy utility class.
#ifndef LIBANGLE_RENDERER_D3D_D3D11_BLIT11_H_
#define LIBANGLE_RENDERER_D3D_D3D11_BLIT11_H_
#include "common/angleutils.h"
#include "libANGLE/angletypes.h"
#include "libANGLE/Error.h"
#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
#include <map>
namespace rx
{
class Renderer11;
class Blit11 : angle::NonCopyable
{
public:
explicit Blit11(Renderer11 *renderer);
~Blit11();
gl::Error swizzleTexture(ID3D11ShaderResourceView *source,
ID3D11RenderTargetView *dest,
const gl::Extents &size,
const gl::SwizzleState &swizzleTarget);
gl::Error copyTexture(ID3D11ShaderResourceView *source,
const gl::Box &sourceArea,
const gl::Extents &sourceSize,
ID3D11RenderTargetView *dest,
const gl::Box &destArea,
const gl::Extents &destSize,
const gl::Rectangle *scissor,
GLenum destFormat,
GLenum filter,
bool maskOffAlpha);
gl::Error copyStencil(ID3D11Resource *source, unsigned int sourceSubresource, const gl::Box &sourceArea, const gl::Extents &sourceSize,
ID3D11Resource *dest, unsigned int destSubresource, const gl::Box &destArea, const gl::Extents &destSize,
const gl::Rectangle *scissor);
gl::Error copyDepth(ID3D11ShaderResourceView *source, const gl::Box &sourceArea, const gl::Extents &sourceSize,
ID3D11DepthStencilView *dest, const gl::Box &destArea, const gl::Extents &destSize,
const gl::Rectangle *scissor);
gl::Error copyDepthStencil(ID3D11Resource *source, unsigned int sourceSubresource, const gl::Box &sourceArea, const gl::Extents &sourceSize,
ID3D11Resource *dest, unsigned int destSubresource, const gl::Box &destArea, const gl::Extents &destSize,
const gl::Rectangle *scissor);
private:
enum BlitShaderType
{
BLITSHADER_INVALID,
BLITSHADER_2D_RGBAF,
BLITSHADER_2D_BGRAF,
BLITSHADER_2D_RGBF,
BLITSHADER_2D_RGF,
BLITSHADER_2D_RF,
BLITSHADER_2D_ALPHA,
BLITSHADER_2D_LUMA,
BLITSHADER_2D_LUMAALPHA,
BLITSHADER_2D_RGBAUI,
BLITSHADER_2D_RGBAI,
BLITSHADER_2D_RGBUI,
BLITSHADER_2D_RGBI,
BLITSHADER_2D_RGUI,
BLITSHADER_2D_RGI,
BLITSHADER_2D_RUI,
BLITSHADER_2D_RI,
BLITSHADER_3D_RGBAF,
BLITSHADER_3D_RGBAUI,
BLITSHADER_3D_RGBAI,
BLITSHADER_3D_BGRAF,
BLITSHADER_3D_RGBF,
BLITSHADER_3D_RGBUI,
BLITSHADER_3D_RGBI,
BLITSHADER_3D_RGF,
BLITSHADER_3D_RGUI,
BLITSHADER_3D_RGI,
BLITSHADER_3D_RF,
BLITSHADER_3D_RUI,
BLITSHADER_3D_RI,
BLITSHADER_3D_ALPHA,
BLITSHADER_3D_LUMA,
BLITSHADER_3D_LUMAALPHA,
};
enum SwizzleShaderType
{
SWIZZLESHADER_INVALID,
SWIZZLESHADER_2D_FLOAT,
SWIZZLESHADER_2D_UINT,
SWIZZLESHADER_2D_INT,
SWIZZLESHADER_CUBE_FLOAT,
SWIZZLESHADER_CUBE_UINT,
SWIZZLESHADER_CUBE_INT,
SWIZZLESHADER_3D_FLOAT,
SWIZZLESHADER_3D_UINT,
SWIZZLESHADER_3D_INT,
SWIZZLESHADER_ARRAY_FLOAT,
SWIZZLESHADER_ARRAY_UINT,
SWIZZLESHADER_ARRAY_INT,
};
typedef void (*WriteVertexFunction)(const gl::Box &sourceArea, const gl::Extents &sourceSize,
const gl::Box &destArea, const gl::Extents &destSize,
void *outVertices, unsigned int *outStride, unsigned int *outVertexCount,
D3D11_PRIMITIVE_TOPOLOGY *outTopology);
enum ShaderDimension
{
SHADER_2D,
SHADER_3D,
};
struct Shader
{
ShaderDimension dimension;
ID3D11PixelShader *pixelShader;
};
struct ShaderSupport
{
ID3D11InputLayout *inputLayout;
ID3D11VertexShader *vertexShader;
ID3D11GeometryShader *geometryShader;
WriteVertexFunction vertexWriteFunction;
};
gl::Error initResources();
void freeResources();
ShaderSupport getShaderSupport(const Shader &shader);
static BlitShaderType GetBlitShaderType(GLenum destinationFormat, bool isSigned, ShaderDimension dimension);
static SwizzleShaderType GetSwizzleShaderType(GLenum type, D3D11_SRV_DIMENSION dimensionality);
gl::Error copyDepthStencil(ID3D11Resource *source, unsigned int sourceSubresource, const gl::Box &sourceArea, const gl::Extents &sourceSize,
ID3D11Resource *dest, unsigned int destSubresource, const gl::Box &destArea, const gl::Extents &destSize,
const gl::Rectangle *scissor, bool stencilOnly);
void addBlitShaderToMap(BlitShaderType blitShaderType, ShaderDimension dimension, ID3D11PixelShader *ps);
gl::Error getBlitShader(GLenum destFormat, bool isSigned, ShaderDimension dimension, const Shader **shaderOut);
gl::Error getSwizzleShader(GLenum type, D3D11_SRV_DIMENSION viewDimension, const Shader **shaderOut);
void addSwizzleShaderToMap(SwizzleShaderType swizzleShaderType, ShaderDimension dimension, ID3D11PixelShader *ps);
void clearShaderMap();
Renderer11 *mRenderer;
std::map<BlitShaderType, Shader> mBlitShaderMap;
std::map<SwizzleShaderType, Shader> mSwizzleShaderMap;
bool mResourcesInitialized;
ID3D11Buffer *mVertexBuffer;
ID3D11SamplerState *mPointSampler;
ID3D11SamplerState *mLinearSampler;
ID3D11RasterizerState *mScissorEnabledRasterizerState;
ID3D11RasterizerState *mScissorDisabledRasterizerState;
ID3D11DepthStencilState *mDepthStencilState;
d3d11::LazyInputLayout mQuad2DIL;
d3d11::LazyShader<ID3D11VertexShader> mQuad2DVS;
d3d11::LazyShader<ID3D11PixelShader> mDepthPS;
d3d11::LazyInputLayout mQuad3DIL;
d3d11::LazyShader<ID3D11VertexShader> mQuad3DVS;
d3d11::LazyShader<ID3D11GeometryShader> mQuad3DGS;
d3d11::LazyBlendState mAlphaMaskBlendState;
ID3D11Buffer *mSwizzleCB;
};
}
#endif // LIBANGLE_RENDERER_D3D_D3D11_BLIT11_H_