Add constant buffers to ShaderExecutable11.

TRAC #22327 Signed-off-by: Daniel Koch Signed-off-by: Geoff Lang Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1766 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 5fb979d5
...@@ -1000,7 +1000,7 @@ void ProgramBinary::applyUniforms() ...@@ -1000,7 +1000,7 @@ void ProgramBinary::applyUniforms()
} }
} }
mRenderer->applyUniforms(&mUniforms); mRenderer->applyUniforms(this, &mUniforms);
} }
// Packs varyings into generic varying registers, using the algorithm from [OpenGL ES Shading Language 1.00 rev. 17] appendix A section 7 page 111 // Packs varyings into generic varying registers, using the algorithm from [OpenGL ES Shading Language 1.00 rev. 17] appendix A section 7 page 111
......
...@@ -111,7 +111,7 @@ class Renderer ...@@ -111,7 +111,7 @@ class Renderer
virtual bool applyRenderTarget(gl::Framebuffer *frameBuffer) = 0; virtual bool applyRenderTarget(gl::Framebuffer *frameBuffer) = 0;
virtual void applyShaders(gl::ProgramBinary *programBinary) = 0; virtual void applyShaders(gl::ProgramBinary *programBinary) = 0;
virtual void applyUniforms(const gl::UniformArray *uniformArray) = 0; virtual void applyUniforms(gl::ProgramBinary *programBinary, const gl::UniformArray *uniformArray) = 0;
virtual bool applyPrimitiveType(GLenum primitiveType, GLsizei elementCount) = 0; virtual bool applyPrimitiveType(GLenum primitiveType, GLsizei elementCount) = 0;
virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances) = 0; virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances) = 0;
virtual GLenum applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo) = 0; virtual GLenum applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo) = 0;
......
...@@ -1043,7 +1043,7 @@ void Renderer11::applyShaders(gl::ProgramBinary *programBinary) ...@@ -1043,7 +1043,7 @@ void Renderer11::applyShaders(gl::ProgramBinary *programBinary)
} }
} }
void Renderer11::applyUniforms(const gl::UniformArray *uniformArray) void Renderer11::applyUniforms(gl::ProgramBinary *programBinary, const gl::UniformArray *uniformArray)
{ {
D3D11_BUFFER_DESC constantBufferDescriptionVS = {0}; D3D11_BUFFER_DESC constantBufferDescriptionVS = {0};
constantBufferDescriptionVS.ByteWidth = D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT * sizeof(float[4]); constantBufferDescriptionVS.ByteWidth = D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT * sizeof(float[4]);
......
...@@ -67,7 +67,7 @@ class Renderer11 : public Renderer ...@@ -67,7 +67,7 @@ class Renderer11 : public Renderer
virtual bool applyPrimitiveType(GLenum mode, GLsizei count); virtual bool applyPrimitiveType(GLenum mode, GLsizei count);
virtual bool applyRenderTarget(gl::Framebuffer *frameBuffer); virtual bool applyRenderTarget(gl::Framebuffer *frameBuffer);
virtual void applyShaders(gl::ProgramBinary *programBinary); virtual void applyShaders(gl::ProgramBinary *programBinary);
virtual void applyUniforms(const gl::UniformArray *uniformArray); virtual void applyUniforms(gl::ProgramBinary *programBinary, const gl::UniformArray *uniformArray);
virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances); virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances);
virtual GLenum applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo); virtual GLenum applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo);
......
...@@ -1606,7 +1606,7 @@ void Renderer9::applyShaders(gl::ProgramBinary *programBinary) ...@@ -1606,7 +1606,7 @@ void Renderer9::applyShaders(gl::ProgramBinary *programBinary)
} }
} }
void Renderer9::applyUniforms(const gl::UniformArray *uniformArray) void Renderer9::applyUniforms(gl::ProgramBinary *programBinary, const gl::UniformArray *uniformArray)
{ {
for (std::vector<gl::Uniform*>::const_iterator ub = uniformArray->begin(), ue = uniformArray->end(); ub != ue; ++ub) for (std::vector<gl::Uniform*>::const_iterator ub = uniformArray->begin(), ue = uniformArray->end(); ub != ue; ++ub)
{ {
......
...@@ -90,7 +90,7 @@ class Renderer9 : public Renderer ...@@ -90,7 +90,7 @@ class Renderer9 : public Renderer
virtual bool applyRenderTarget(gl::Framebuffer *frameBuffer); virtual bool applyRenderTarget(gl::Framebuffer *frameBuffer);
virtual void applyShaders(gl::ProgramBinary *programBinary); virtual void applyShaders(gl::ProgramBinary *programBinary);
virtual void applyUniforms(const gl::UniformArray *uniformArray); virtual void applyUniforms(gl::ProgramBinary *programBinary, const gl::UniformArray *uniformArray);
virtual bool applyPrimitiveType(GLenum primitiveType, GLsizei elementCount); virtual bool applyPrimitiveType(GLenum primitiveType, GLsizei elementCount);
virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances); virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances);
virtual GLenum applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo); virtual GLenum applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo);
......
// //
// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. // Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
...@@ -19,6 +19,8 @@ ShaderExecutable11::ShaderExecutable11(const void *function, size_t length, ID3D ...@@ -19,6 +19,8 @@ ShaderExecutable11::ShaderExecutable11(const void *function, size_t length, ID3D
{ {
mPixelExecutable = executable; mPixelExecutable = executable;
mVertexExecutable = NULL; mVertexExecutable = NULL;
mConstantBuffer = NULL;
} }
ShaderExecutable11::ShaderExecutable11(const void *function, size_t length, ID3D11VertexShader *executable) ShaderExecutable11::ShaderExecutable11(const void *function, size_t length, ID3D11VertexShader *executable)
...@@ -26,6 +28,8 @@ ShaderExecutable11::ShaderExecutable11(const void *function, size_t length, ID3D ...@@ -26,6 +28,8 @@ ShaderExecutable11::ShaderExecutable11(const void *function, size_t length, ID3D
{ {
mVertexExecutable = executable; mVertexExecutable = executable;
mPixelExecutable = NULL; mPixelExecutable = NULL;
mConstantBuffer = NULL;
} }
ShaderExecutable11::~ShaderExecutable11() ShaderExecutable11::~ShaderExecutable11()
...@@ -38,6 +42,11 @@ ShaderExecutable11::~ShaderExecutable11() ...@@ -38,6 +42,11 @@ ShaderExecutable11::~ShaderExecutable11()
{ {
mPixelExecutable->Release(); mPixelExecutable->Release();
} }
if (mConstantBuffer)
{
mConstantBuffer->Release();
}
} }
ShaderExecutable11 *ShaderExecutable11::makeShaderExecutable11(ShaderExecutable *executable) ShaderExecutable11 *ShaderExecutable11::makeShaderExecutable11(ShaderExecutable *executable)
...@@ -46,14 +55,19 @@ ShaderExecutable11 *ShaderExecutable11::makeShaderExecutable11(ShaderExecutable ...@@ -46,14 +55,19 @@ ShaderExecutable11 *ShaderExecutable11::makeShaderExecutable11(ShaderExecutable
return static_cast<ShaderExecutable11*>(executable); return static_cast<ShaderExecutable11*>(executable);
} }
ID3D11VertexShader *ShaderExecutable11::getVertexShader() ID3D11VertexShader *ShaderExecutable11::getVertexShader() const
{ {
return mVertexExecutable; return mVertexExecutable;
} }
ID3D11PixelShader *ShaderExecutable11::getPixelShader() ID3D11PixelShader *ShaderExecutable11::getPixelShader() const
{ {
return mPixelExecutable; return mPixelExecutable;
} }
ID3D11Buffer *ShaderExecutable11::getConstantBuffer()
{
return mConstantBuffer;
}
} }
\ No newline at end of file
// //
// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. // Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
...@@ -27,14 +27,18 @@ class ShaderExecutable11 : public ShaderExecutable ...@@ -27,14 +27,18 @@ class ShaderExecutable11 : public ShaderExecutable
static ShaderExecutable11 *makeShaderExecutable11(ShaderExecutable *executable); static ShaderExecutable11 *makeShaderExecutable11(ShaderExecutable *executable);
ID3D11PixelShader *getPixelShader(); ID3D11PixelShader *getPixelShader() const;
ID3D11VertexShader *getVertexShader(); ID3D11VertexShader *getVertexShader() const;
ID3D11Buffer *getConstantBuffer();
private: private:
DISALLOW_COPY_AND_ASSIGN(ShaderExecutable11); DISALLOW_COPY_AND_ASSIGN(ShaderExecutable11);
ID3D11PixelShader *mPixelExecutable; ID3D11PixelShader *mPixelExecutable;
ID3D11VertexShader *mVertexExecutable; ID3D11VertexShader *mVertexExecutable;
ID3D11Buffer *mConstantBuffer;
}; };
} }
......
// //
// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. // Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
...@@ -46,12 +46,12 @@ ShaderExecutable9 *ShaderExecutable9::makeShaderExecutable9(ShaderExecutable *ex ...@@ -46,12 +46,12 @@ ShaderExecutable9 *ShaderExecutable9::makeShaderExecutable9(ShaderExecutable *ex
return static_cast<ShaderExecutable9*>(executable); return static_cast<ShaderExecutable9*>(executable);
} }
IDirect3DVertexShader9 *ShaderExecutable9::getVertexShader() IDirect3DVertexShader9 *ShaderExecutable9::getVertexShader() const
{ {
return mVertexExecutable; return mVertexExecutable;
} }
IDirect3DPixelShader9 *ShaderExecutable9::getPixelShader() IDirect3DPixelShader9 *ShaderExecutable9::getPixelShader() const
{ {
return mPixelExecutable; return mPixelExecutable;
} }
......
// //
// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. // Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
...@@ -26,8 +26,8 @@ class ShaderExecutable9 : public ShaderExecutable ...@@ -26,8 +26,8 @@ class ShaderExecutable9 : public ShaderExecutable
static ShaderExecutable9 *makeShaderExecutable9(ShaderExecutable *executable); static ShaderExecutable9 *makeShaderExecutable9(ShaderExecutable *executable);
IDirect3DPixelShader9 *getPixelShader(); IDirect3DPixelShader9 *getPixelShader() const;
IDirect3DVertexShader9 *getVertexShader(); IDirect3DVertexShader9 *getVertexShader() const;
private: private:
DISALLOW_COPY_AND_ASSIGN(ShaderExecutable9); DISALLOW_COPY_AND_ASSIGN(ShaderExecutable9);
......
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