Skip to content
Merged
3 changes: 0 additions & 3 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,6 @@ jobs:
build\bin\RelWithDebInfo\Test_Ogre.exe
- name: Visual Tests D3D11
if: ${{ !cancelled() && steps.build.outcome == 'success' }}
# TODO: make blocking once fixed: PlayPen_BillboardAccurateFacing fails as the default
# BillboardSet material uses lighting, but billboards have no normals
continue-on-error: true
timeout-minutes: 15
working-directory: build/bin/RelWithDebInfo
run: ./TestContext.exe -rs "Direct3D11 Rendering Subsystem"
Expand Down
9 changes: 6 additions & 3 deletions RenderSystems/Direct3D11/src/OgreD3D11HardwarePixelBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ THE SOFTWARE.
#include "OgreLogManager.h"
#include "OgreStringConverter.h"
#include "OgreBitwise.h"
#include "OgreImage.h"

#include "OgreRoot.h"
#include "OgreRenderSystem.h"
Expand Down Expand Up @@ -277,11 +278,13 @@ namespace Ogre {
//-----------------------------------------------------------------------------
void D3D11HardwarePixelBuffer::blitFromMemory(const PixelBox &src, const Box &dst)
{
// D3D11 cannot scale while copying, so scale on the CPU
if (src.getSize() != dst.getSize())
{
OGRE_EXCEPT(Exception::ERR_RENDERINGAPI_ERROR,
"D3D11 device cannot copy a subresource - source and dest size are not the same and they have to be the same in DX11.",
"D3D11HardwarePixelBuffer::blitFromMemory");
Image scaled(src.format, dst.getWidth(), dst.getHeight(), dst.getDepth());
Image::scale(src, scaled.getPixelBox());
blitFromMemory(scaled.getPixelBox(), dst); // recursive call
return;
}

// convert to pixelbuffer's native format if necessary
Expand Down
4 changes: 3 additions & 1 deletion Tests/VisualTests/PlayPen/src/PlayPenTestPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ THE SOFTWARE.
#include "PlayPenTestPlugin.h"
#include "PlayPenTests.h"
#include "OgreResourceGroupManager.h"
#include "OgreGpuProgramManager.h"

PlaypenTestPlugin::PlaypenTestPlugin()
:SamplePlugin("PlaypenTestPlugin")
Expand Down Expand Up @@ -142,7 +143,8 @@ PlaypenTestPlugin::PlaypenTestPlugin()
addSample(new PlayPen_MaterialSchemesWithMismatchedLOD());
}

if (!only_common && Root::getSingletonPtr()->getRenderSystem()->getName().find("OpenGL ES 2") == String::npos)
if (!only_common && GpuProgramManager::getSingleton().isLanguageSupported("cg") &&
Root::getSingletonPtr()->getRenderSystem()->getName().find("OpenGL ES 2") == String::npos)
{
addSample(new PlayPen_SpotlightViewProj()); // Only Cg at this time
addSample(new PlayPen_TextureShadowsCustomCasterMat()); // Only Cg at this time
Expand Down
46 changes: 28 additions & 18 deletions Tests/VisualTests/PlayPen/src/PlayPenTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,11 @@ void PlayPen_ProjectSphere::setupContent()
MaterialPtr mat = MaterialManager::getSingleton().create(
"scissormat", TRANSIENT_RESOURCE_GROUP);
Pass* p = mat->getTechnique(0)->getPass(0);
// the scissor rect has neither normals nor texture coordinates, so colour it per vertex
p->setLightingEnabled(false);
p->setVertexColourTracking(TVC_DIFFUSE);
p->setDepthWriteEnabled(false);
p->setSceneBlending(SBT_TRANSPARENT_ALPHA);
TextureUnitState* t = p->createTextureUnitState();
t->setColourOperationEx(LBX_SOURCE1, LBS_MANUAL, LBS_CURRENT,
ColourValue::Red);
t->setAlphaOperation(LBX_SOURCE1, LBS_MANUAL, LBS_CURRENT, 0.5f);


mScissorRect = mSceneMgr->createManualObject("mScissorRect");
Expand All @@ -269,9 +268,11 @@ void PlayPen_ProjectSphere::setupContent()
aabb.setInfinite();
mScissorRect->setBoundingBox(aabb);
mScissorRect->begin(mat->getName());
mScissorRect->position(Vector3::ZERO);
mScissorRect->position(Vector3::ZERO);
mScissorRect->position(Vector3::ZERO);
for (int i = 0; i < 4; ++i)
{
mScissorRect->position(Vector3::ZERO);
mScissorRect->colour(1, 0, 0, 0.5);
}
mScissorRect->quad(0, 1, 2, 3);
mScissorRect->end();
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(mScissorRect);
Expand All @@ -289,9 +290,13 @@ bool PlayPen_ProjectSphere::frameStarted(const FrameEvent& evt)

mScissorRect->beginUpdate(0);
mScissorRect->position(left, top, 0);
mScissorRect->colour(1, 0, 0, 0.5);
mScissorRect->position(left, bottom, 0);
mScissorRect->colour(1, 0, 0, 0.5);
mScissorRect->position(right, bottom, 0);
mScissorRect->colour(1, 0, 0, 0.5);
mScissorRect->position(right, top, 0);
mScissorRect->colour(1, 0, 0, 0.5);
mScissorRect->quad(0,1,2,3);
mScissorRect->end();
return true;
Expand Down Expand Up @@ -1424,14 +1429,17 @@ void PlayPen_BillboardAccurateFacing::setupContent()
pPlaneEnt->setCastShadows(false);
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(pPlaneEnt);

// Billboards have no normals, so use an unlit material
BillboardSet* bbs = mSceneMgr->createBillboardSet("1");
bbs->setMaterialName("BaseWhiteNoLighting");
bbs->setDefaultDimensions(50, 50);
bbs->createBillboard(-100, 25, 0);
bbs->setBillboardType(BBT_ORIENTED_COMMON);
bbs->setCommonDirection(Vector3::UNIT_Y);
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(bbs);

bbs = mSceneMgr->createBillboardSet("2");
bbs->setMaterialName("BaseWhiteNoLighting");
bbs->setDefaultDimensions(50, 50);
bbs->createBillboard(100, 25, 0);
bbs->setUseAccurateFacing(true);
Expand Down Expand Up @@ -1524,18 +1532,19 @@ void PlayPen_BillboardOrigins::setupContent()
{
mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5));

// Billboards currently have no normals.
// Vector3 dir(-1, -1, 0.5);
// dir.normalise();
// Light* l = mSceneMgr->createLight("light1");
// l->setType(Light::LT_DIRECTIONAL);
// l->setDirection(dir);
// Billboards have no normals, so use unlit materials
auto unlit = [](const String& texture) {
MaterialPtr mat = MaterialManager::getSingleton().create(texture, TRANSIENT_RESOURCE_GROUP);
mat->setLightingEnabled(false);
mat->getTechnique(0)->getPass(0)->createTextureUnitState(texture);
return mat;
};

BillboardSet* bbs = mSceneMgr->createBillboardSet("1");
bbs->setDefaultDimensions(50,50);
bbs->createBillboard(0, 0, 0);
bbs->setBillboardOrigin(BBO_TOP_LEFT);
bbs->setMaterialName("2 - Default");
bbs->setMaterial(unlit("MtlPlat2.jpg"));
// bbs->setBillboardType(BBT_ORIENTED_COMMON);
bbs->setCommonDirection(Vector3::UNIT_Y);
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(bbs);
Expand All @@ -1544,7 +1553,7 @@ void PlayPen_BillboardOrigins::setupContent()
bbs->setDefaultDimensions(50,50);
bbs->createBillboard(0, -10, 0);
bbs->setBillboardOrigin(BBO_CENTER);
bbs->setMaterialName("Examples/RustySteel");
bbs->setMaterial(unlit("RustySteel.jpg"));
// bbs->setBillboardType(BBT_ORIENTED_COMMON);
bbs->setCommonDirection(Vector3::UNIT_Y);
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(bbs);
Expand All @@ -1553,7 +1562,7 @@ void PlayPen_BillboardOrigins::setupContent()
bbs->setDefaultDimensions(50,50);
bbs->createBillboard(0, -20, 0);
bbs->setBillboardOrigin(BBO_BOTTOM_RIGHT);
bbs->setMaterialName("Examples/OgreLogo");
bbs->setMaterial(unlit("ogrelogo.png"));
// bbs->setBillboardType(BBT_ORIENTED_COMMON);
bbs->setCommonDirection(Vector3::UNIT_Y);
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(bbs);
Expand Down Expand Up @@ -5874,8 +5883,9 @@ void PlayPen_StencilShadowsMixedOpSubMeshes::setupContent()
//mCamera->setOrientation(Quaternion(0.7265, -0.2064, 0.6304, 0.1791));


// the manual object has neither normals nor texture coordinates
ManualObject* man = mSceneMgr->createManualObject("testMO_");
man->begin("2 - Default");
man->begin("BaseWhiteNoLighting");
man->position(0, 200, 0);
man->position(0, 50, 100);
man->position(100, 50, -100);
Expand All @@ -5884,7 +5894,7 @@ void PlayPen_StencilShadowsMixedOpSubMeshes::setupContent()
man->triangle(0, 2, 3);
man->triangle(0, 3, 1);
man->end();
man->begin("2 - Default", RenderOperation::OT_LINE_STRIP);
man->begin("BaseWhiteNoLighting", RenderOperation::OT_LINE_STRIP);
man->position(0, 200, 0);
man->position(50, 250, 0);
man->position(200, 300, 0);
Expand Down
Loading