Commit 437cca5a by Geoff Lang Committed by Commit Bot

Add support for CHROMIUM_copy_texture with D3D9.

BUG=angleproject:1356 Change-Id: If63779e39609083deb6bb72dc8c29eaaa90c698c Reviewed-on: https://chromium-review.googlesource.com/339813 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 76cdbd51
......@@ -7,6 +7,8 @@
// Blit9.cpp: Surface copy utility class.
#include "libANGLE/renderer/d3d/d3d9/Blit9.h"
#include "libANGLE/renderer/d3d/TextureD3D.h"
#include "libANGLE/renderer/d3d/d3d9/renderer9_utils.h"
#include "libANGLE/renderer/d3d/d3d9/formatutils9.h"
#include "libANGLE/renderer/d3d/d3d9/TextureStorage9.h"
......@@ -20,27 +22,34 @@ namespace
{
// Precompiled shaders
#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/standardvs.h"
#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/flipyvs.h"
#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/passthroughps.h"
#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/luminanceps.h"
#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/luminancepremultps.h"
#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/luminanceunmultps.h"
#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskps.h"
#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskpremultps.h"
#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskunmultps.h"
const BYTE* const g_shaderCode[] =
{
const BYTE *const g_shaderCode[] = {
g_vs20_standardvs,
g_vs20_flipyvs,
g_ps20_passthroughps,
g_ps20_luminanceps,
g_ps20_componentmaskps
g_ps20_luminancepremultps,
g_ps20_luminanceunmultps,
g_ps20_componentmaskps,
g_ps20_componentmaskpremultps,
g_ps20_componentmaskunmultps,
};
const size_t g_shaderSize[] =
{
const size_t g_shaderSize[] = {
sizeof(g_vs20_standardvs),
sizeof(g_vs20_flipyvs),
sizeof(g_ps20_passthroughps),
sizeof(g_ps20_luminanceps),
sizeof(g_ps20_componentmaskps)
sizeof(g_ps20_luminancepremultps),
sizeof(g_ps20_luminanceunmultps),
sizeof(g_ps20_componentmaskps),
sizeof(g_ps20_componentmaskpremultps),
sizeof(g_ps20_componentmaskunmultps),
};
}
......@@ -182,11 +191,19 @@ RECT Blit9::getSurfaceRect(IDirect3DSurface9 *surface) const
return rect;
}
gl::Extents Blit9::getSurfaceSize(IDirect3DSurface9 *surface) const
{
D3DSURFACE_DESC desc;
surface->GetDesc(&desc);
return gl::Extents(desc.Width, desc.Height, 1);
}
gl::Error Blit9::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest)
{
ANGLE_TRY(initialize());
IDirect3DTexture9 *texture = NULL;
IDirect3DBaseTexture9 *texture = NULL;
ANGLE_TRY(copySurfaceToTexture(source, getSurfaceRect(source), &texture));
IDirect3DDevice9 *device = mRenderer->getDevice();
......@@ -203,7 +220,8 @@ gl::Error Blit9::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest)
device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
setViewport(getSurfaceRect(dest), gl::Offset(0, 0, 0));
setViewportAndShaderConstants(getSurfaceRect(dest), getSurfaceSize(source), gl::Offset(0, 0, 0),
false);
render();
......@@ -238,7 +256,8 @@ gl::Error Blit9::copy2D(const gl::Framebuffer *framebuffer, const RECT &sourceRe
}
ASSERT(destSurface);
gl::Error result = copy(source, sourceRect, destFormat, destOffset, destSurface);
gl::Error result =
copy(source, nullptr, sourceRect, destFormat, destOffset, destSurface, false, false, false);
SafeRelease(destSurface);
SafeRelease(source);
......@@ -278,7 +297,8 @@ gl::Error Blit9::copyCube(const gl::Framebuffer *framebuffer, const RECT &source
}
ASSERT(destSurface);
gl::Error result = copy(source, sourceRect, destFormat, destOffset, destSurface);
gl::Error result =
copy(source, nullptr, sourceRect, destFormat, destOffset, destSurface, false, false, false);
SafeRelease(destSurface);
SafeRelease(source);
......@@ -286,7 +306,63 @@ gl::Error Blit9::copyCube(const gl::Framebuffer *framebuffer, const RECT &source
return result;
}
gl::Error Blit9::copy(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, const gl::Offset &destOffset, IDirect3DSurface9 *dest)
gl::Error Blit9::copyTexture2D(const gl::Texture *source,
GLint sourceLevel,
const RECT &sourceRect,
GLenum destFormat,
const gl::Offset &destOffset,
TextureStorage *storage,
GLint destLevel,
bool flipY,
bool premultiplyAlpha,
bool unmultiplyAlpha)
{
ANGLE_TRY(initialize());
const TextureD3D *sourceD3D = GetImplAs<TextureD3D>(source);
TextureStorage *sourceStorage = nullptr;
ANGLE_TRY(const_cast<TextureD3D *>(sourceD3D)->getNativeTexture(&sourceStorage));
TextureStorage9_2D *sourceStorage9 = GetAs<TextureStorage9_2D>(sourceStorage);
ASSERT(sourceStorage9);
TextureStorage9_2D *destStorage9 = GetAs<TextureStorage9_2D>(storage);
ASSERT(destStorage9);
ASSERT(sourceLevel == 0);
IDirect3DBaseTexture9 *sourceTexture = nullptr;
ANGLE_TRY(sourceStorage9->getBaseTexture(&sourceTexture));
IDirect3DSurface9 *sourceSurface = nullptr;
ANGLE_TRY(sourceStorage9->getSurfaceLevel(GL_TEXTURE_2D, sourceLevel, true, &sourceSurface));
IDirect3DSurface9 *destSurface = nullptr;
gl::Error error = destStorage9->getSurfaceLevel(GL_TEXTURE_2D, destLevel, true, &destSurface);
if (error.isError())
{
SafeRelease(sourceSurface);
return error;
}
error = copy(sourceSurface, sourceTexture, sourceRect, destFormat, destOffset, destSurface,
flipY, premultiplyAlpha, unmultiplyAlpha);
SafeRelease(sourceSurface);
SafeRelease(destSurface);
return error;
}
gl::Error Blit9::copy(IDirect3DSurface9 *source,
IDirect3DBaseTexture9 *sourceTexture,
const RECT &sourceRect,
GLenum destFormat,
const gl::Offset &destOffset,
IDirect3DSurface9 *dest,
bool flipY,
bool premultiplyAlpha,
bool unmultiplyAlpha)
{
ASSERT(source != NULL && dest != NULL);
......@@ -297,8 +373,10 @@ gl::Error Blit9::copy(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum
source->GetDesc(&sourceDesc);
dest->GetDesc(&destDesc);
if (sourceDesc.Format == destDesc.Format && destDesc.Usage & D3DUSAGE_RENDERTARGET &&
d3d9_gl::IsFormatChannelEquivalent(destDesc.Format, destFormat)) // Can use StretchRect
// Check if it's possible to use StetchRect
if (sourceDesc.Format == destDesc.Format && (destDesc.Usage & D3DUSAGE_RENDERTARGET) &&
d3d9_gl::IsFormatChannelEquivalent(destDesc.Format, destFormat) && !flipY &&
premultiplyAlpha == unmultiplyAlpha)
{
RECT destRect = { destOffset.x, destOffset.y, destOffset.x + (sourceRect.right - sourceRect.left), destOffset.y + (sourceRect.bottom - sourceRect.top)};
HRESULT result = device->StretchRect(source, &sourceRect, dest, &destRect, D3DTEXF_POINT);
......@@ -313,78 +391,121 @@ gl::Error Blit9::copy(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum
}
else
{
return formatConvert(source, sourceRect, destFormat, destOffset, dest);
}
}
IDirect3DBaseTexture9 *texture = sourceTexture;
RECT adjustedSourceRect = sourceRect;
gl::Extents sourceSize(sourceDesc.Width, sourceDesc.Height, 1);
gl::Error Blit9::formatConvert(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, const gl::Offset &destOffset, IDirect3DSurface9 *dest)
{
gl::Error error = initialize();
if (error.isError())
{
return error;
}
if (texture == nullptr)
{
ANGLE_TRY(copySurfaceToTexture(source, sourceRect, &texture));
// copySurfaceToTexture only copies in the sourceRect area of the source surface.
// Adjust sourceRect so that it is now covering the entire source texture
adjustedSourceRect.left = 0;
adjustedSourceRect.right = sourceRect.right - sourceRect.left;
adjustedSourceRect.top = 0;
adjustedSourceRect.bottom = sourceRect.bottom - sourceRect.top;
sourceSize.width = sourceRect.right - sourceRect.left;
sourceSize.height = sourceRect.bottom - sourceRect.top;
}
else
{
texture->AddRef();
}
gl::Error error = formatConvert(texture, adjustedSourceRect, sourceSize, destFormat,
destOffset, dest, flipY, premultiplyAlpha, unmultiplyAlpha);
SafeRelease(texture);
IDirect3DTexture9 *texture = NULL;
error = copySurfaceToTexture(source, sourceRect, &texture);
if (error.isError())
{
return error;
}
}
gl::Error Blit9::formatConvert(IDirect3DBaseTexture9 *source,
const RECT &sourceRect,
const gl::Extents &sourceSize,
GLenum destFormat,
const gl::Offset &destOffset,
IDirect3DSurface9 *dest,
bool flipY,
bool premultiplyAlpha,
bool unmultiplyAlpha)
{
ANGLE_TRY(initialize());
IDirect3DDevice9 *device = mRenderer->getDevice();
saveState();
device->SetTexture(0, texture);
device->SetTexture(0, source);
device->SetRenderTarget(0, dest);
setViewport(sourceRect, destOffset);
setViewportAndShaderConstants(sourceRect, sourceSize, destOffset, flipY);
setCommonBlitState();
error = setFormatConvertShaders(destFormat);
gl::Error error = setFormatConvertShaders(destFormat, flipY, premultiplyAlpha, unmultiplyAlpha);
if (!error.isError())
{
render();
}
SafeRelease(texture);
restoreState();
return error;
}
gl::Error Blit9::setFormatConvertShaders(GLenum destFormat)
gl::Error Blit9::setFormatConvertShaders(GLenum destFormat,
bool flipY,
bool premultiplyAlpha,
bool unmultiplyAlpha)
{
gl::Error error = setVertexShader(SHADER_VS_STANDARD);
if (error.isError())
{
return error;
}
ANGLE_TRY(setVertexShader(SHADER_VS_STANDARD));
switch (destFormat)
{
default: UNREACHABLE();
case GL_RGBA:
case GL_BGRA_EXT:
case GL_RGB:
case GL_RG_EXT:
case GL_RED_EXT:
case GL_ALPHA:
error = setPixelShader(SHADER_PS_COMPONENTMASK);
break;
if (premultiplyAlpha == unmultiplyAlpha)
{
ANGLE_TRY(setPixelShader(SHADER_PS_COMPONENTMASK));
}
else if (premultiplyAlpha)
{
ANGLE_TRY(setPixelShader(SHADER_PS_COMPONENTMASK_PREMULTIPLY_ALPHA));
}
else
{
ASSERT(unmultiplyAlpha);
ANGLE_TRY(setPixelShader(SHADER_PS_COMPONENTMASK_UNMULTIPLY_ALPHA));
}
break;
case GL_LUMINANCE:
case GL_LUMINANCE_ALPHA:
error = setPixelShader(SHADER_PS_LUMINANCE);
break;
}
if (error.isError())
{
return error;
if (premultiplyAlpha == unmultiplyAlpha)
{
ANGLE_TRY(setPixelShader(SHADER_PS_LUMINANCE));
}
else if (premultiplyAlpha)
{
ANGLE_TRY(setPixelShader(SHADER_PS_LUMINANCE_PREMULTIPLY_ALPHA));
}
else
{
ASSERT(unmultiplyAlpha);
ANGLE_TRY(setPixelShader(SHADER_PS_LUMINANCE_UNMULTIPLY_ALPHA));
}
break;
default:
UNREACHABLE();
}
enum { X = 0, Y = 1, Z = 2, W = 3 };
......@@ -483,7 +604,9 @@ gl::Error Blit9::setFormatConvertShaders(GLenum destFormat)
return gl::Error(GL_NO_ERROR);
}
gl::Error Blit9::copySurfaceToTexture(IDirect3DSurface9 *surface, const RECT &sourceRect, IDirect3DTexture9 **outTexture)
gl::Error Blit9::copySurfaceToTexture(IDirect3DSurface9 *surface,
const RECT &sourceRect,
IDirect3DBaseTexture9 **outTexture)
{
ASSERT(surface);
......@@ -528,7 +651,10 @@ gl::Error Blit9::copySurfaceToTexture(IDirect3DSurface9 *surface, const RECT &so
return gl::Error(GL_NO_ERROR);
}
void Blit9::setViewport(const RECT &sourceRect, const gl::Offset &offset)
void Blit9::setViewportAndShaderConstants(const RECT &sourceRect,
const gl::Extents &sourceSize,
const gl::Offset &offset,
bool flipY)
{
IDirect3DDevice9 *device = mRenderer->getDevice();
......@@ -541,8 +667,19 @@ void Blit9::setViewport(const RECT &sourceRect, const gl::Offset &offset)
vp.MaxZ = 1.0f;
device->SetViewport(&vp);
float halfPixelAdjust[4] = { -1.0f/vp.Width, 1.0f/vp.Height, 0, 0 };
device->SetVertexShaderConstantF(0, halfPixelAdjust, 1);
float vertexConstants[8] = {
// halfPixelAdjust
-1.0f / vp.Width, 1.0f / vp.Height, 0, 0,
// texcoordOffset
static_cast<float>(sourceRect.left) / sourceSize.width,
static_cast<float>(flipY ? sourceRect.bottom : sourceRect.top) / sourceSize.height,
static_cast<float>(sourceRect.right - sourceRect.left) / sourceSize.width,
static_cast<float>(flipY ? sourceRect.top - sourceRect.bottom
: sourceRect.bottom - sourceRect.top) /
sourceSize.height,
};
device->SetVertexShaderConstantF(0, vertexConstants, 2);
}
void Blit9::setCommonBlitState()
......
......@@ -17,6 +17,8 @@
namespace gl
{
class Framebuffer;
class Texture;
struct Extents;
struct Offset;
}
......@@ -36,12 +38,23 @@ class Blit9 : angle::NonCopyable
// Copy from source surface to dest surface.
// sourceRect, xoffset, yoffset are in D3D coordinates (0,0 in upper-left)
gl::Error copy2D(const gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, const gl::Offset &destOffset, TextureStorage *storage, GLint level);
gl::Error copyCube(const gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, const gl::Offset &destOffset, TextureStorage *storage, GLenum target, GLint level);
// Copy from source surface to dest surface.
// sourceRect, xoffset, yoffset are in D3D coordinates (0,0 in upper-left)
// source is interpreted as RGBA and destFormat specifies the desired result format. For example, if destFormat = GL_RGB, the alpha channel will be forced to 0.
gl::Error formatConvert(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, const gl::Offset &destOffset, IDirect3DSurface9 *dest);
gl::Error copyCube(const gl::Framebuffer *framebuffer,
const RECT &sourceRect,
GLenum destFormat,
const gl::Offset &destOffset,
TextureStorage *storage,
GLenum target,
GLint level);
gl::Error copyTexture2D(const gl::Texture *source,
GLint sourceLevel,
const RECT &sourceRect,
GLenum destFormat,
const gl::Offset &destOffset,
TextureStorage *storage,
GLint destLevel,
bool flipY,
bool premultiplyAlpha,
bool unmultiplyAlpha);
// 2x2 box filter sample from source to dest.
// Requires that source is RGB(A) and dest has the same format as source.
......@@ -54,23 +67,56 @@ class Blit9 : angle::NonCopyable
IDirect3DVertexBuffer9 *mQuadVertexBuffer;
IDirect3DVertexDeclaration9 *mQuadVertexDeclaration;
gl::Error setFormatConvertShaders(GLenum destFormat);
gl::Error copy(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, const gl::Offset &destOffset, IDirect3DSurface9 *dest);
gl::Error copySurfaceToTexture(IDirect3DSurface9 *surface, const RECT &sourceRect, IDirect3DTexture9 **outTexture);
void setViewport(const RECT &sourceRect, const gl::Offset &offset);
// Copy from source texture to dest surface.
// sourceRect, xoffset, yoffset are in D3D coordinates (0,0 in upper-left)
// source is interpreted as RGBA and destFormat specifies the desired result format. For
// example, if destFormat = GL_RGB, the alpha channel will be forced to 0.
gl::Error formatConvert(IDirect3DBaseTexture9 *source,
const RECT &sourceRect,
const gl::Extents &sourceSize,
GLenum destFormat,
const gl::Offset &destOffset,
IDirect3DSurface9 *dest,
bool flipY,
bool premultiplyAlpha,
bool unmultiplyAlpha);
gl::Error setFormatConvertShaders(GLenum destFormat,
bool flipY,
bool premultiplyAlpha,
bool unmultiplyAlpha);
gl::Error copy(IDirect3DSurface9 *source,
IDirect3DBaseTexture9 *sourceTexture,
const RECT &sourceRect,
GLenum destFormat,
const gl::Offset &destOffset,
IDirect3DSurface9 *dest,
bool flipY,
bool premultiplyAlpha,
bool unmultiplyAlpha);
gl::Error copySurfaceToTexture(IDirect3DSurface9 *surface,
const RECT &sourceRect,
IDirect3DBaseTexture9 **outTexture);
void setViewportAndShaderConstants(const RECT &sourceRect,
const gl::Extents &sourceSize,
const gl::Offset &offset,
bool flipY);
void setCommonBlitState();
RECT getSurfaceRect(IDirect3DSurface9 *surface) const;
gl::Extents getSurfaceSize(IDirect3DSurface9 *surface) const;
// This enum is used to index mCompiledShaders and mShaderSource.
enum ShaderId
{
SHADER_VS_STANDARD,
SHADER_VS_FLIPY,
SHADER_PS_PASSTHROUGH,
SHADER_PS_LUMINANCE,
SHADER_PS_LUMINANCE_PREMULTIPLY_ALPHA,
SHADER_PS_LUMINANCE_UNMULTIPLY_ALPHA,
SHADER_PS_COMPONENTMASK,
SHADER_COUNT
SHADER_PS_COMPONENTMASK_PREMULTIPLY_ALPHA,
SHADER_PS_COMPONENTMASK_UNMULTIPLY_ALPHA,
SHADER_COUNT,
};
// This actually contains IDirect3DVertexShader9 or IDirect3DPixelShader9 casted to IUnknown.
......
......@@ -2460,8 +2460,15 @@ gl::Error Renderer9::copyTexture(const gl::Texture *source,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
RECT rect;
rect.left = sourceRect.x;
rect.top = sourceRect.y;
rect.right = sourceRect.x + sourceRect.width;
rect.bottom = sourceRect.y + sourceRect.height;
return mBlit->copyTexture2D(source, sourceLevel, rect, destFormat, destOffset, storage,
destLevel, unpackFlipY, unpackPremultiplyAlpha,
unpackUnmultiplyAlpha);
}
gl::Error Renderer9::copyCompressedTexture(const gl::Texture *source,
......
......@@ -595,6 +595,7 @@ void GenerateCaps(IDirect3D9 *d3d9,
extensions->unpackSubimage = true;
extensions->packSubimage = true;
extensions->syncQuery = extensions->fence;
extensions->copyTexture = true;
// D3D9 has no concept of separate masks and refs for front and back faces in the depth stencil
// state.
......
......@@ -24,6 +24,23 @@ float4 luminanceps(float4 texcoord : TEXCOORD0) : COLOR
return (tex2D(tex, texcoord.xy).xw * mult.xw + add.xw).xxxy;
};
float4 luminancepremultps(float4 texcoord : TEXCOORD0) : COLOR
{
float4 luma = (tex2D(tex, texcoord.xy).xw * mult.xw + add.xw).xxxy;
luma.rgb *= luma.a;
return luma;
};
float4 luminanceunmultps(float4 texcoord : TEXCOORD0) : COLOR
{
float4 luma = (tex2D(tex, texcoord.xy).xw * mult.xw + add.xw).xxxy;
if (luma.a > 0.0f)
{
luma.rgb /= luma.a;
}
return luma;
};
// RGB/A Component Mask Pixel Shader
// Performs a mad operation using the texture's RGBA data with mult.xyzw and add.xyzw.
// Returns data in the form of rgba
......@@ -31,3 +48,20 @@ float4 componentmaskps(float4 texcoord : TEXCOORD0) : COLOR
{
return tex2D(tex, texcoord.xy) * mult + add;
};
float4 componentmaskpremultps(float4 texcoord : TEXCOORD0) : COLOR
{
float4 color = tex2D(tex, texcoord.xy) * mult + add;
color.rgb *= color.a;
return color;
};
float4 componentmaskunmultps(float4 texcoord : TEXCOORD0) : COLOR
{
float4 color = tex2D(tex, texcoord.xy) * mult + add;
if (color.a > 0.0f)
{
color.rgb /= color.a;
}
return color;
};
......@@ -11,6 +11,7 @@ struct VS_OUTPUT
};
uniform float4 halfPixelSize : c0;
uniform float4 texcoordOffset : c1;
// Standard Vertex Shader
// Input 0 is the homogenous position.
......@@ -22,22 +23,7 @@ VS_OUTPUT standardvs(in float4 position : POSITION)
VS_OUTPUT Out;
Out.position = position + halfPixelSize;
Out.texcoord = position * float4(0.5, -0.5, 1.0, 1.0) + float4(0.5, 0.5, 0, 0);
return Out;
};
// Flip Y Vertex Shader
// Input 0 is the homogenous position.
// Outputs the homogenous position as-is.
// Outputs a tex coord with (0,1) in the upper-left corner of the screen and (1,0) in the bottom right.
// C0.XY must be the half-pixel width and height. C0.ZW must be 0.
VS_OUTPUT flipyvs(in float4 position : POSITION)
{
VS_OUTPUT Out;
Out.position = position + halfPixelSize;
Out.texcoord = position * float4(0.5, 0.5, 1.0, 1.0) + float4(0.5, 0.5, 0, 0);
Out.texcoord = ((position * float4(0.5, -0.5, 1.0, 1.0) + float4(0.5, 0.5, 0, 0)) * float4(texcoordOffset.zw, 1.0, 1.0)) + float4(texcoordOffset.xy, 0, 0);
return Out;
};
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
// Parameters:
//
// float4 add;
// float4 mult;
// sampler2D tex;
//
//
// Registers:
//
// Name Reg Size
// ------------ ----- ----
// mult c0 1
// add c1 1
// tex s0 1
//
ps_2_0
dcl t0.xy
dcl_2d s0
texld r0, t0, s0
mov r1, c0
mad r0, r0, r1, c1
mul r0.xyz, r0.w, r0
mov oC0, r0
// approximately 5 instruction slots used (1 texture, 4 arithmetic)
#endif
const BYTE g_ps20_componentmaskpremultps[] = {
0, 2, 255, 255, 254, 255, 50, 0, 67, 84, 65, 66, 28, 0, 0, 0, 143, 0, 0,
0, 0, 2, 255, 255, 3, 0, 0, 0, 28, 0, 0, 0, 0, 1, 0, 0, 136, 0,
0, 0, 88, 0, 0, 0, 2, 0, 1, 0, 1, 0, 0, 0, 92, 0, 0, 0, 0,
0, 0, 0, 108, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 92, 0, 0, 0,
0, 0, 0, 0, 113, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 120, 0, 0,
0, 0, 0, 0, 0, 97, 100, 100, 0, 1, 0, 3, 0, 1, 0, 4, 0, 1, 0,
0, 0, 0, 0, 0, 0, 109, 117, 108, 116, 0, 116, 101, 120, 0, 171, 171, 171, 4,
0, 12, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 112, 115, 95, 50,
95, 48, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76,
83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32,
54, 46, 51, 46, 57, 54, 48, 48, 46, 49, 54, 51, 56, 52, 0, 171, 171, 171, 31,
0, 0, 2, 0, 0, 0, 128, 0, 0, 3, 176, 31, 0, 0, 2, 0, 0, 0, 144,
0, 8, 15, 160, 66, 0, 0, 3, 0, 0, 15, 128, 0, 0, 228, 176, 0, 8, 228,
160, 1, 0, 0, 2, 1, 0, 15, 128, 0, 0, 228, 160, 4, 0, 0, 4, 0, 0,
15, 128, 0, 0, 228, 128, 1, 0, 228, 128, 1, 0, 228, 160, 5, 0, 0, 3, 0,
0, 7, 128, 0, 0, 255, 128, 0, 0, 228, 128, 1, 0, 0, 2, 0, 8, 15, 128,
0, 0, 228, 128, 255, 255, 0, 0};
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
// Parameters:
//
// float4 add;
// float4 mult;
// sampler2D tex;
//
//
// Registers:
//
// Name Reg Size
// ------------ ----- ----
// mult c0 1
// add c1 1
// tex s0 1
//
ps_2_0
dcl t0.xy
dcl_2d s0
texld r0, t0, s0
mov r1, c0
mad r0, r0, r1, c1
rcp r1.x, r0.w
mul r1.xyz, r0, r1.x
cmp r0.xyz, -r0.w, r0, r1
mov oC0, r0
// approximately 7 instruction slots used (1 texture, 6 arithmetic)
#endif
const BYTE g_ps20_componentmaskunmultps[] = {
0, 2, 255, 255, 254, 255, 50, 0, 67, 84, 65, 66, 28, 0, 0, 0, 143, 0, 0,
0, 0, 2, 255, 255, 3, 0, 0, 0, 28, 0, 0, 0, 0, 1, 0, 0, 136, 0,
0, 0, 88, 0, 0, 0, 2, 0, 1, 0, 1, 0, 0, 0, 92, 0, 0, 0, 0,
0, 0, 0, 108, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 92, 0, 0, 0,
0, 0, 0, 0, 113, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 120, 0, 0,
0, 0, 0, 0, 0, 97, 100, 100, 0, 1, 0, 3, 0, 1, 0, 4, 0, 1, 0,
0, 0, 0, 0, 0, 0, 109, 117, 108, 116, 0, 116, 101, 120, 0, 171, 171, 171, 4,
0, 12, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 112, 115, 95, 50,
95, 48, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76,
83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32,
54, 46, 51, 46, 57, 54, 48, 48, 46, 49, 54, 51, 56, 52, 0, 171, 171, 171, 31,
0, 0, 2, 0, 0, 0, 128, 0, 0, 3, 176, 31, 0, 0, 2, 0, 0, 0, 144,
0, 8, 15, 160, 66, 0, 0, 3, 0, 0, 15, 128, 0, 0, 228, 176, 0, 8, 228,
160, 1, 0, 0, 2, 1, 0, 15, 128, 0, 0, 228, 160, 4, 0, 0, 4, 0, 0,
15, 128, 0, 0, 228, 128, 1, 0, 228, 128, 1, 0, 228, 160, 6, 0, 0, 2, 1,
0, 1, 128, 0, 0, 255, 128, 5, 0, 0, 3, 1, 0, 7, 128, 0, 0, 228, 128,
1, 0, 0, 128, 88, 0, 0, 4, 0, 0, 7, 128, 0, 0, 255, 129, 0, 0, 228,
128, 1, 0, 228, 128, 1, 0, 0, 2, 0, 8, 15, 128, 0, 0, 228, 128, 255, 255,
0, 0};
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
// Parameters:
//
// float4 halfPixelSize;
//
//
// Registers:
//
// Name Reg Size
// ------------- ----- ----
// halfPixelSize c0 1
//
vs_2_0
def c1, 0.5, 1, 0, 0
dcl_position v0
add oPos, v0, c0
mad oT0, v0, c1.xxyy, c1.xxzz
// approximately 2 instruction slots used
#endif
const BYTE g_vs20_flipyvs[] =
{
0, 2, 254, 255, 254, 255,
36, 0, 67, 84, 65, 66,
28, 0, 0, 0, 87, 0,
0, 0, 0, 2, 254, 255,
1, 0, 0, 0, 28, 0,
0, 0, 0, 1, 0, 0,
80, 0, 0, 0, 48, 0,
0, 0, 2, 0, 0, 0,
1, 0, 0, 0, 64, 0,
0, 0, 0, 0, 0, 0,
104, 97, 108, 102, 80, 105,
120, 101, 108, 83, 105, 122,
101, 0, 171, 171, 1, 0,
3, 0, 1, 0, 4, 0,
1, 0, 0, 0, 0, 0,
0, 0, 118, 115, 95, 50,
95, 48, 0, 77, 105, 99,
114, 111, 115, 111, 102, 116,
32, 40, 82, 41, 32, 72,
76, 83, 76, 32, 83, 104,
97, 100, 101, 114, 32, 67,
111, 109, 112, 105, 108, 101,
114, 32, 54, 46, 51, 46,
57, 54, 48, 48, 46, 49,
54, 51, 56, 52, 0, 171,
171, 171, 81, 0, 0, 5,
1, 0, 15, 160, 0, 0,
0, 63, 0, 0, 128, 63,
0, 0, 0, 0, 0, 0,
0, 0, 31, 0, 0, 2,
0, 0, 0, 128, 0, 0,
15, 144, 2, 0, 0, 3,
0, 0, 15, 192, 0, 0,
228, 144, 0, 0, 228, 160,
4, 0, 0, 4, 0, 0,
15, 224, 0, 0, 228, 144,
1, 0, 80, 160, 1, 0,
160, 160, 255, 255, 0, 0
};
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
// Parameters:
//
// float4 add;
// float4 mult;
// sampler2D tex;
//
//
// Registers:
//
// Name Reg Size
// ------------ ----- ----
// mult c0 1
// add c1 1
// tex s0 1
//
ps_2_0
dcl t0.xy
dcl_2d s0
texld r0, t0, s0
mov r1.xw, c0
mad r0.x, r0.x, r1.x, c1.x
mad r0.y, r0.w, r1.w, c1.w
mul r1.xyz, r0.y, r0.x
mov r1.w, r0.y
mov oC0, r1
// approximately 7 instruction slots used (1 texture, 6 arithmetic)
#endif
const BYTE g_ps20_luminancepremultps[] = {
0, 2, 255, 255, 254, 255, 50, 0, 67, 84, 65, 66, 28, 0, 0, 0, 143, 0, 0,
0, 0, 2, 255, 255, 3, 0, 0, 0, 28, 0, 0, 0, 0, 1, 0, 0, 136, 0,
0, 0, 88, 0, 0, 0, 2, 0, 1, 0, 1, 0, 0, 0, 92, 0, 0, 0, 0,
0, 0, 0, 108, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 92, 0, 0, 0,
0, 0, 0, 0, 113, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 120, 0, 0,
0, 0, 0, 0, 0, 97, 100, 100, 0, 1, 0, 3, 0, 1, 0, 4, 0, 1, 0,
0, 0, 0, 0, 0, 0, 109, 117, 108, 116, 0, 116, 101, 120, 0, 171, 171, 171, 4,
0, 12, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 112, 115, 95, 50,
95, 48, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76,
83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32,
54, 46, 51, 46, 57, 54, 48, 48, 46, 49, 54, 51, 56, 52, 0, 171, 171, 171, 31,
0, 0, 2, 0, 0, 0, 128, 0, 0, 3, 176, 31, 0, 0, 2, 0, 0, 0, 144,
0, 8, 15, 160, 66, 0, 0, 3, 0, 0, 15, 128, 0, 0, 228, 176, 0, 8, 228,
160, 1, 0, 0, 2, 1, 0, 9, 128, 0, 0, 228, 160, 4, 0, 0, 4, 0, 0,
1, 128, 0, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 160, 4, 0, 0, 4, 0,
0, 2, 128, 0, 0, 255, 128, 1, 0, 255, 128, 1, 0, 255, 160, 5, 0, 0, 3,
1, 0, 7, 128, 0, 0, 85, 128, 0, 0, 0, 128, 1, 0, 0, 2, 1, 0, 8,
128, 0, 0, 85, 128, 1, 0, 0, 2, 0, 8, 15, 128, 1, 0, 228, 128, 255, 255,
0, 0};
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
// Parameters:
//
// float4 add;
// float4 mult;
// sampler2D tex;
//
//
// Registers:
//
// Name Reg Size
// ------------ ----- ----
// mult c0 1
// add c1 1
// tex s0 1
//
ps_2_0
dcl t0.xy
dcl_2d s0
texld r0, t0, s0
mov r1.xw, c0
mad r0.x, r0.x, r1.x, c1.x
mad r0.y, r0.w, r1.w, c1.w
rcp r0.z, r0.y
mul r0.z, r0.z, r0.x
cmp r1.xyz, -r0.y, r0.x, r0.z
mov r1.w, r0.y
mov oC0, r1
// approximately 9 instruction slots used (1 texture, 8 arithmetic)
#endif
const BYTE g_ps20_luminanceunmultps[] = {
0, 2, 255, 255, 254, 255, 50, 0, 67, 84, 65, 66, 28, 0, 0, 0, 143, 0, 0,
0, 0, 2, 255, 255, 3, 0, 0, 0, 28, 0, 0, 0, 0, 1, 0, 0, 136, 0,
0, 0, 88, 0, 0, 0, 2, 0, 1, 0, 1, 0, 0, 0, 92, 0, 0, 0, 0,
0, 0, 0, 108, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 92, 0, 0, 0,
0, 0, 0, 0, 113, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 120, 0, 0,
0, 0, 0, 0, 0, 97, 100, 100, 0, 1, 0, 3, 0, 1, 0, 4, 0, 1, 0,
0, 0, 0, 0, 0, 0, 109, 117, 108, 116, 0, 116, 101, 120, 0, 171, 171, 171, 4,
0, 12, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 112, 115, 95, 50,
95, 48, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76,
83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32,
54, 46, 51, 46, 57, 54, 48, 48, 46, 49, 54, 51, 56, 52, 0, 171, 171, 171, 31,
0, 0, 2, 0, 0, 0, 128, 0, 0, 3, 176, 31, 0, 0, 2, 0, 0, 0, 144,
0, 8, 15, 160, 66, 0, 0, 3, 0, 0, 15, 128, 0, 0, 228, 176, 0, 8, 228,
160, 1, 0, 0, 2, 1, 0, 9, 128, 0, 0, 228, 160, 4, 0, 0, 4, 0, 0,
1, 128, 0, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 160, 4, 0, 0, 4, 0,
0, 2, 128, 0, 0, 255, 128, 1, 0, 255, 128, 1, 0, 255, 160, 6, 0, 0, 2,
0, 0, 4, 128, 0, 0, 85, 128, 5, 0, 0, 3, 0, 0, 4, 128, 0, 0, 170,
128, 0, 0, 0, 128, 88, 0, 0, 4, 1, 0, 7, 128, 0, 0, 85, 129, 0, 0,
0, 128, 0, 0, 170, 128, 1, 0, 0, 2, 1, 0, 8, 128, 0, 0, 85, 128, 1,
0, 0, 2, 0, 8, 15, 128, 1, 0, 228, 128, 255, 255, 0, 0};
......@@ -5,62 +5,42 @@
// Parameters:
//
// float4 halfPixelSize;
// float4 texcoordOffset;
//
//
// Registers:
//
// Name Reg Size
// ------------- ----- ----
// halfPixelSize c0 1
// Name Reg Size
// -------------- ----- ----
// halfPixelSize c0 1
// texcoordOffset c1 1
//
vs_2_0
def c1, 0.5, -0.5, 1, 0
def c2, 0.5, -0.5, 1, 0
dcl_position v0
add oPos, v0, c0
mad oT0, v0, c1.xyzz, c1.xxww
mad r0, v0, c2.xyzz, c2.xxww
mov oT0.zw, r0
mad oT0.xy, r0, c1.zwzw, c1
// approximately 2 instruction slots used
// approximately 4 instruction slots used
#endif
const BYTE g_vs20_standardvs[] =
{
0, 2, 254, 255, 254, 255,
36, 0, 67, 84, 65, 66,
28, 0, 0, 0, 87, 0,
0, 0, 0, 2, 254, 255,
1, 0, 0, 0, 28, 0,
0, 0, 0, 1, 0, 0,
80, 0, 0, 0, 48, 0,
0, 0, 2, 0, 0, 0,
1, 0, 0, 0, 64, 0,
0, 0, 0, 0, 0, 0,
104, 97, 108, 102, 80, 105,
120, 101, 108, 83, 105, 122,
101, 0, 171, 171, 1, 0,
3, 0, 1, 0, 4, 0,
1, 0, 0, 0, 0, 0,
0, 0, 118, 115, 95, 50,
95, 48, 0, 77, 105, 99,
114, 111, 115, 111, 102, 116,
32, 40, 82, 41, 32, 72,
76, 83, 76, 32, 83, 104,
97, 100, 101, 114, 32, 67,
111, 109, 112, 105, 108, 101,
114, 32, 54, 46, 51, 46,
57, 54, 48, 48, 46, 49,
54, 51, 56, 52, 0, 171,
171, 171, 81, 0, 0, 5,
1, 0, 15, 160, 0, 0,
0, 63, 0, 0, 0, 191,
0, 0, 128, 63, 0, 0,
0, 0, 31, 0, 0, 2,
0, 0, 0, 128, 0, 0,
15, 144, 2, 0, 0, 3,
0, 0, 15, 192, 0, 0,
228, 144, 0, 0, 228, 160,
4, 0, 0, 4, 0, 0,
15, 224, 0, 0, 228, 144,
1, 0, 164, 160, 1, 0,
240, 160, 255, 255, 0, 0
};
const BYTE g_vs20_standardvs[] = {
0, 2, 254, 255, 254, 255, 44, 0, 67, 84, 65, 66, 28, 0, 0, 0, 122, 0, 0,
0, 0, 2, 254, 255, 2, 0, 0, 0, 28, 0, 0, 0, 0, 1, 0, 0, 115, 0,
0, 0, 68, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 84, 0, 0, 0, 0,
0, 0, 0, 100, 0, 0, 0, 2, 0, 1, 0, 1, 0, 0, 0, 84, 0, 0, 0,
0, 0, 0, 0, 104, 97, 108, 102, 80, 105, 120, 101, 108, 83, 105, 122, 101, 0, 171,
171, 1, 0, 3, 0, 1, 0, 4, 0, 1, 0, 0, 0, 0, 0, 0, 0, 116, 101,
120, 99, 111, 111, 114, 100, 79, 102, 102, 115, 101, 116, 0, 118, 115, 95, 50, 95, 48,
0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76,
32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 54, 46,
51, 46, 57, 54, 48, 48, 46, 49, 54, 51, 56, 52, 0, 81, 0, 0, 5, 2, 0,
15, 160, 0, 0, 0, 63, 0, 0, 0, 191, 0, 0, 128, 63, 0, 0, 0, 0, 31,
0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 144, 2, 0, 0, 3, 0, 0, 15, 192,
0, 0, 228, 144, 0, 0, 228, 160, 4, 0, 0, 4, 0, 0, 15, 128, 0, 0, 228,
144, 2, 0, 164, 160, 2, 0, 240, 160, 1, 0, 0, 2, 0, 0, 12, 224, 0, 0,
228, 128, 4, 0, 0, 4, 0, 0, 3, 224, 0, 0, 228, 128, 1, 0, 238, 160, 1,
0, 228, 160, 255, 255, 0, 0};
......@@ -21,10 +21,13 @@ if "%1" == "release" (
:: | Input file | Entry point | Type | Output file | Debug |
call:BuildShader Blit.vs standardvs vs_2_0 compiled\standardvs.h %debug%
call:BuildShader Blit.vs flipyvs vs_2_0 compiled\flipyvs.h %debug%
call:BuildShader Blit.ps passthroughps ps_2_0 compiled\passthroughps.h %debug%
call:BuildShader Blit.ps luminanceps ps_2_0 compiled\luminanceps.h %debug%
call:BuildShader Blit.ps luminancepremultps ps_2_0 compiled\luminancepremultps.h %debug%
call:BuildShader Blit.ps luminanceunmultps ps_2_0 compiled\luminanceunmultps.h %debug%
call:BuildShader Blit.ps componentmaskps ps_2_0 compiled\componentmaskps.h %debug%
call:BuildShader Blit.ps componentmaskpremultps ps_2_0 compiled\componentmaskpremultps.h %debug%
call:BuildShader Blit.ps componentmaskunmultps ps_2_0 compiled\componentmaskunmultps.h %debug%
echo.
......
......@@ -304,8 +304,11 @@
'libANGLE/renderer/d3d/d3d9/ShaderExecutable9.cpp',
'libANGLE/renderer/d3d/d3d9/ShaderExecutable9.h',
'libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskps.h',
'libANGLE/renderer/d3d/d3d9/shaders/compiled/flipyvs.h',
'libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskpremultps.h',
'libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskunmultps.h',
'libANGLE/renderer/d3d/d3d9/shaders/compiled/luminanceps.h',
'libANGLE/renderer/d3d/d3d9/shaders/compiled/luminancepremultps.h',
'libANGLE/renderer/d3d/d3d9/shaders/compiled/luminanceunmultps.h',
'libANGLE/renderer/d3d/d3d9/shaders/compiled/passthroughps.h',
'libANGLE/renderer/d3d/d3d9/shaders/compiled/standardvs.h',
'libANGLE/renderer/d3d/d3d9/StateManager9.cpp',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment